diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-15 14:17:47 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-15 14:17:47 -0700 |
commit | ad83dd0a96b5cd20feff5af0868029f163dcd869 (patch) | |
tree | eb98bcbc90506551e708137de1efd50be76c8eef /src/github | |
parent | 3895e6a34561f9384d09836551039e57ac5ed9b9 (diff) | |
download | dsub-ad83dd0a96b5cd20feff5af0868029f163dcd869.tar.gz dsub-ad83dd0a96b5cd20feff5af0868029f163dcd869.tar.bz2 dsub-ad83dd0a96b5cd20feff5af0868029f163dcd869.zip |
Change to pass entire Entry instead of pieces of information to fix cache updates
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 4acccad2..5a60077b 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -72,8 +72,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter String id;
String name;
- boolean starred;
- int rating;
+ Entry directory;
String playlistId;
String playlistName;
boolean playlistOwner;
@@ -117,8 +116,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter if(args != null) {
id = args.getString(Constants.INTENT_EXTRA_NAME_ID);
name = args.getString(Constants.INTENT_EXTRA_NAME_NAME);
- starred = args.getBoolean(Constants.INTENT_EXTRA_NAME_STARRED, false);
- rating = args.getInt(Constants.INTENT_EXTRA_NAME_RATING, 0);
+ directory = (Entry) args.getSerializable(Constants.INTENT_EXTRA_NAME_DIRECTORY);
playlistId = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID);
playlistName = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME);
playlistOwner = args.getBoolean(Constants.INTENT_EXTRA_NAME_PLAYLIST_OWNER, false);
@@ -398,8 +396,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter Bundle args = new Bundle();
args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getId());
args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
- args.putBoolean(Constants.INTENT_EXTRA_NAME_STARRED, entry.isStarred());
- args.putInt(Constants.INTENT_EXTRA_NAME_RATING, entry.getRating());
+ args.putSerializable(Constants.INTENT_EXTRA_DIRECTORY, entry);
if ("newest".equals(albumListType)) {
args.putBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS, true);
}
@@ -730,8 +727,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter Bundle args = new Bundle();
args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getId());
args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
- args.putBoolean(Constants.INTENT_EXTRA_NAME_STARRED, entry.isStarred());
- args.putInt(Constants.INTENT_EXTRA_NAME_RATING, entry.getRating());
+ args.putSerializable(Constants.INTENT_EXTRA_DIRECTORY, entry);
if ("newest".equals(albumListType)) {
args.putBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS, true);
}
@@ -1292,23 +1288,16 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter });
}
- final Entry album = new Entry();
- album.setId(id);
- album.setTitle(name);
- album.setDirectory(true);
- album.setStarred(starred);
- album.setRating(rating);
-
final ImageButton starButton = (ImageButton) header.findViewById(R.id.select_album_star);
- if(id != null && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_STAR, true)) {
- starButton.setImageResource(album.isStarred() ? android.R.drawable.btn_star_big_on : android.R.drawable.btn_star_big_off);
+ if(directory != null && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_STAR, true)) {
+ starButton.setImageResource(directory.isStarred() ? android.R.drawable.btn_star_big_on : android.R.drawable.btn_star_big_off);
starButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- toggleStarred(album, new OnStarChange() {
+ toggleStarred(directory, new OnStarChange() {
@Override
void starChange(boolean starred) {
- starButton.setImageResource(album.isStarred() ? android.R.drawable.btn_star_big_on : android.R.drawable.btn_star_big_off);
+ starButton.setImageResource(directory.isStarred() ? android.R.drawable.btn_star_big_on : android.R.drawable.btn_star_big_off);
}
});
}
@@ -1319,15 +1308,15 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter View ratingBarWrapper = header.findViewById(R.id.select_album_rate_wrapper);
final RatingBar ratingBar = (RatingBar) header.findViewById(R.id.select_album_rate);
- if(id != null && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_RATING, true) && !Util.isOffline(context)) {
- ratingBar.setRating(album.getRating());
+ if(directory != null && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_RATING, true) && !Util.isOffline(context)) {
+ ratingBar.setRating(directory.getRating());
ratingBarWrapper.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- setRating(album, new OnRatingChange() {
+ setRating(directory, new OnRatingChange() {
@Override
void ratingChange(int rating) {
- ratingBar.setRating(album.getRating());
+ ratingBar.setRating(directory.getRating());
}
});
}
|