aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java35
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());
}
});
}