diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-03-18 19:05:51 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-03-18 19:05:51 -0700 |
commit | bdaea96b3bf875c32fc3e66bf555072979250a76 (patch) | |
tree | 90c98a1b1e3539938f965424ea1ae51c7b6dd3db /src/github/daneren2005 | |
parent | fc694f05cf76310f9999840194b255e7fd23bb72 (diff) | |
download | dsub-bdaea96b3bf875c32fc3e66bf555072979250a76.tar.gz dsub-bdaea96b3bf875c32fc3e66bf555072979250a76.tar.bz2 dsub-bdaea96b3bf875c32fc3e66bf555072979250a76.zip |
#311 Allow Show Artist even if grandParent isn't filled out
Diffstat (limited to 'src/github/daneren2005')
4 files changed, 21 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index 5c9591a4..0d421168 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -273,6 +273,9 @@ public class SubsonicFragmentActivity extends SubsonicActivity { if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_ARTIST)) {
args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
}
+ if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_CHILD_ID)) {
+ args.putString(Constants.INTENT_EXTRA_NAME_CHILD_ID, getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_CHILD_ID));
+ }
fragment.setArguments(args);
replaceFragment(fragment, fragment.getSupportTag());
diff --git a/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/src/github/daneren2005/dsub/fragments/DownloadFragment.java index 6c9be122..198cc9d2 100644 --- a/src/github/daneren2005/dsub/fragments/DownloadFragment.java +++ b/src/github/daneren2005/dsub/fragments/DownloadFragment.java @@ -542,8 +542,6 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe if (downloadFile.getSong().getParent() == null) {
menu.findItem(R.id.menu_show_album).setVisible(false);
- }
- if (downloadFile.getSong().getGrandParent() == null) {
menu.findItem(R.id.menu_show_artist).setVisible(false);
}
@@ -589,6 +587,9 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe albumId = entry.getArtistId();
} else {
albumId = entry.getGrandParent();
+ if(albumId == null) {
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_CHILD_ID, entry.getParent());
+ }
}
albumName = entry.getArtist();
intent.putExtra(Constants.INTENT_EXTRA_NAME_ARTIST, true);
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 60a42c32..870d6549 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -68,6 +68,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter boolean refreshListing = false;
boolean showAll = false;
boolean restoredInstance = false;
+ boolean lookupParent = false;
public SelectDirectoryFragment() {
super();
@@ -130,6 +131,12 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter albumListSize = args.getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0);
refreshListing = args.getBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS);
artist = args.getBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, false);
+
+ String childId = args.getString(Constants.INTENT_EXTRA_NAME_CHILD_ID);
+ if(childId != null) {
+ id = childId;
+ lookupParent = true;
+ }
if(entries == null) {
entries = (List<MusicDirectory.Entry>) args.getSerializable(Constants.FRAGMENT_LIST);
}
@@ -390,7 +397,13 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter new LoadTask() {
@Override
protected MusicDirectory load(MusicService service) throws Exception {
- return getMusicDirectory(id, name, refresh, service, this);
+ MusicDirectory dir = getMusicDirectory(id, name, refresh, service, this);
+
+ if(lookupParent) {
+ dir = getMusicDirectory(dir.getParent(), name, refresh, service, this);
+ }
+
+ return dir;
}
@Override
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java index 0ed86bc8..20040f97 100644 --- a/src/github/daneren2005/dsub/util/Constants.java +++ b/src/github/daneren2005/dsub/util/Constants.java @@ -39,6 +39,7 @@ public final class Constants { public static final String INTENT_EXTRA_NAME_NAME = "subsonic.name"; public static final String INTENT_EXTRA_NAME_PARENT_ID = "subsonic.parent_id"; public static final String INTENT_EXTRA_NAME_PARENT_NAME = "subsonic.parent_name"; + public static final String INTENT_EXTRA_NAME_CHILD_ID = "subsonic.child.id"; public static final String INTENT_EXTRA_NAME_ARTIST = "subsonic.artist"; public static final String INTENT_EXTRA_NAME_TITLE = "subsonic.title"; public static final String INTENT_EXTRA_NAME_AUTOPLAY = "subsonic.playall"; |