diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-01-31 19:50:44 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-01-31 19:50:44 -0800 |
commit | dc8ed2b98d149e2c9e734857032d06e2f16d71bc (patch) | |
tree | 9a6b568059ccd68b9fdf496b42d2d4659b36d4d6 /src | |
parent | 4ddad20e6af83ccda537334c5416b660758d9791 (diff) | |
download | dsub-dc8ed2b98d149e2c9e734857032d06e2f16d71bc.tar.gz dsub-dc8ed2b98d149e2c9e734857032d06e2f16d71bc.tar.bz2 dsub-dc8ed2b98d149e2c9e734857032d06e2f16d71bc.zip |
#270 Add albumId/artistId to get around showAlbum issue
Diffstat (limited to 'src')
6 files changed, 37 insertions, 14 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index 9b1d307a..a83d203f 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -269,6 +269,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity { Bundle args = new Bundle();
args.putString(Constants.INTENT_EXTRA_NAME_ID, getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_PARENT_ID));
args.putString(Constants.INTENT_EXTRA_NAME_NAME, getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_PARENT_NAME));
+ args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
fragment.setArguments(args);
replaceFragment(fragment, R.id.fragment_list_layout, currentFragment.getSupportTag());
diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java index 8233ee48..f3521252 100644 --- a/src/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java @@ -110,6 +110,8 @@ public class MusicDirectory implements Serializable { private String id; private String parent; private String grandParent; + private String albumId; + private String artistId; private boolean directory; private String title; private String album; @@ -186,6 +188,22 @@ public class MusicDirectory implements Serializable { this.grandParent = grandParent; } + public String getAlbumId() { + return albumId; + } + + public void setAlbumId(String albumId) { + this.albumId = albumId; + } + + public String getArtistId() { + return artistId; + } + + public void setArtistId(String artistId) { + this.artistId = artistId; + } + public boolean isDirectory() { return directory; } @@ -368,7 +386,7 @@ public class MusicDirectory implements Serializable { public String toString() { return title; } - } + } public static class EntryComparator implements Comparator<Entry> { public int compare(Entry lhs, Entry rhs) { diff --git a/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/src/github/daneren2005/dsub/fragments/DownloadFragment.java index e58de995..cc940945 100644 --- a/src/github/daneren2005/dsub/fragments/DownloadFragment.java +++ b/src/github/daneren2005/dsub/fragments/DownloadFragment.java @@ -569,13 +569,20 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe Intent intent = new Intent(context, SubsonicFragmentActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_VIEW_ALBUM, true);
- intent.putExtra(Constants.INTENT_EXTRA_NAME_ID, entry.getParent());
+ if(Util.isTagBrowsing(context)) {
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_ID, entry.getAlbumId());
+ } else {
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_ID, entry.getParent());
+ }
intent.putExtra(Constants.INTENT_EXTRA_NAME_NAME, entry.getAlbum());
intent.putExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE, "Artist");
if(entry.getGrandParent() != null) {
intent.putExtra(Constants.INTENT_EXTRA_NAME_PARENT_ID, entry.getGrandParent());
intent.putExtra(Constants.INTENT_EXTRA_NAME_PARENT_NAME, entry.getArtist());
+ } else if(Util.isTagBrowsing(context)) {
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_PARENT_ID, entry.getArtistId());
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_PARENT_NAME, entry.getArtist());
}
if(Util.isOffline(context)) {
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 722f94c9..b5e0f22b 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -277,7 +277,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter menu.removeItem(R.id.song_menu_remove_playlist);
}
// Remove show artists if parent is not set and if not on a album list
- if((albumListType == null || entry.getParent() == null) && !Util.isOffline(context)) {
+ if((albumListType == null || (entry.getParent() == null && entry.getArtistId() == null)) && !Util.isOffline(context)) {
menu.removeItem(R.id.album_menu_show_artist);
}
if(podcastId != null && !Util.isOffline(context)) {
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 3ec1471f..e8ae6f1e 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -1121,7 +1121,11 @@ public class SubsonicFragment extends Fragment { public void showArtist(MusicDirectory.Entry entry) {
SubsonicFragment fragment = new SelectDirectoryFragment();
Bundle args = new Bundle();
- args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getParent());
+ if(Util.isTagBrowsing(context)) {
+ args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getArtistId());
+ } else {
+ args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getParent());
+ }
args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getArtist());
args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
fragment.setArguments(args);
diff --git a/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java b/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java index b9a77aa8..dcf9fd30 100644 --- a/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java +++ b/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java @@ -32,16 +32,8 @@ public class MusicDirectoryEntryParser extends AbstractParser { protected MusicDirectory.Entry parseEntry(String artist) { MusicDirectory.Entry entry = new MusicDirectory.Entry(); entry.setId(get("id")); - String albumId = get("albumId"); - if(albumId != null) { - entry.setParent(albumId); - entry.setGrandParent(get("artistId")); - } else { - entry.setParent(get("parent")); - } - if(entry.getParent() == null) { - entry.setParent(get("artistId")); - } + entry.setParent(get("parent")); + entry.setArtistId(get("artistId")); entry.setTitle(get("title")); if(entry.getTitle() == null) { entry.setTitle(get("name")); @@ -55,6 +47,7 @@ public class MusicDirectoryEntryParser extends AbstractParser { if (!entry.isDirectory()) { entry.setAlbum(get("album")); + entry.setAlbumId(get("albumId")); entry.setTrack(getInteger("track")); entry.setContentType(get("contentType")); entry.setSuffix(get("suffix")); |