diff options
Diffstat (limited to 'app/src')
7 files changed, 57 insertions, 15 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java index 9a7823a5..1aef5982 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java @@ -187,6 +187,11 @@ public class SearchFragment extends SubsonicFragment implements SectionAdapter.O return selectedMedia; } + @Override + protected boolean isShowArtistEnabled() { + return true; + } + public void search(final String query, final boolean autoplay) { if(skipSearch) { skipSearch = false; diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index f4f0ac30..f1a52399 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -312,10 +312,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section if(!entry.isVideo() && !Util.isOffline(context) && (playlistId == null || !playlistOwner) && (podcastId == null || Util.isOffline(context) && podcastId != null)) { 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 && entry.getArtistId() == null)) && !Util.isOffline(context)) { - menu.removeItem(R.id.album_menu_show_artist); - } recreateContextMenu(menu); } @@ -388,6 +384,11 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section } } + @Override + protected boolean isShowArtistEnabled() { + return albumListType != null; + } + private void load(boolean refresh) { if(refreshListing) { refresh = true; diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java index a7896763..606c79e6 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -272,7 +272,6 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR menu.removeItem(R.id.menu_rate); } } - menu.findItem(entry.isDirectory() ? R.id.album_menu_star : R.id.song_menu_star).setTitle(entry.isStarred() ? R.string.common_unstar : R.string.common_star); } else if(!entry.isVideo()) { if(Util.isOffline(context)) { menuInflater.inflate(R.menu.select_song_context_offline, menu); @@ -284,7 +283,6 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR menu.removeItem(R.id.bookmark_menu_delete); } } - menu.findItem(entry.isDirectory() ? R.id.album_menu_star : R.id.song_menu_star).setTitle(entry.isStarred() ? R.string.common_unstar : R.string.common_star); } else { if(Util.isOffline(context)) { menuInflater.inflate(R.menu.select_video_context_offline, menu); @@ -293,6 +291,15 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR menuInflater.inflate(R.menu.select_video_context, menu); } } + + MenuItem starMenu = menu.findItem(entry.isDirectory() ? R.id.album_menu_star : R.id.song_menu_star); + if(starMenu != null) { + starMenu.setTitle(entry.isStarred() ? R.string.common_unstar : R.string.common_star); + } + + if(!isShowArtistEnabled() || entry.getParent() == null || (Util.isTagBrowsing(context) && entry.getArtistId() == null)) { + menu.setGroupVisible(R.id.hide_show_artist, false); + } } else if(selected instanceof Artist) { Artist artist = (Artist) selected; if(Util.isOffline(context)) { @@ -1908,6 +1915,10 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR UpdateHelper.toggleStarred(context, getSelectedEntries()); } + protected boolean isShowArtistEnabled() { + return false; + } + public abstract class RecursiveLoader extends LoadingTask<Boolean> { protected MusicService musicService; protected static final int MAX_SONGS = 500; diff --git a/app/src/main/res/menu/select_album_context.xml b/app/src/main/res/menu/select_album_context.xml index e4a901ac..0415da3c 100644 --- a/app/src/main/res/menu/select_album_context.xml +++ b/app/src/main/res/menu/select_album_context.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/album_menu_info" android:title="@string/common.info"/> @@ -47,9 +46,11 @@ android:title="@string/menu.delete_cache"/> </group> - <item - android:id="@+id/album_menu_show_artist" - android:title="@string/menu.show_artist"/> + <group android:id="@+id/hide_show_artist"> + <item + android:id="@+id/album_menu_show_artist" + android:title="@string/menu.show_artist"/> + </group> <group android:id="@+id/hide_star"> <item diff --git a/app/src/main/res/menu/select_album_context_offline.xml b/app/src/main/res/menu/select_album_context_offline.xml index c10f2c62..37e2ae66 100644 --- a/app/src/main/res/menu/select_album_context_offline.xml +++ b/app/src/main/res/menu/select_album_context_offline.xml @@ -35,6 +35,12 @@ android:title="@string/menu.delete_cache"/> </group> + <group android:id="@+id/hide_show_artist"> + <item + android:id="@+id/album_menu_show_artist" + android:title="@string/menu.show_artist"/> + </group> + <group android:id="@+id/hide_star"> <item android:id="@+id/album_menu_star" diff --git a/app/src/main/res/menu/select_song_context.xml b/app/src/main/res/menu/select_song_context.xml index 34ea27a6..b68dcad9 100644 --- a/app/src/main/res/menu/select_song_context.xml +++ b/app/src/main/res/menu/select_song_context.xml @@ -1,11 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:compat="http://schemas.android.com/apk/res-auto"> - +<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/song_menu_info" - android:title="@string/common.info" - /> + android:title="@string/common.info"/> + + + <group android:id="@+id/hide_show_artist"> + <item + android:id="@+id/song_menu_show_album" + android:title="@string/download.menu_show_album"/> + + <item + android:id="@+id/song_menu_show_artist" + android:title="@string/menu.show_artist"/> + </group> <group android:id="@+id/hide_play_next"> <item diff --git a/app/src/main/res/menu/select_song_context_offline.xml b/app/src/main/res/menu/select_song_context_offline.xml index 1c52e792..d7182068 100644 --- a/app/src/main/res/menu/select_song_context_offline.xml +++ b/app/src/main/res/menu/select_song_context_offline.xml @@ -6,6 +6,16 @@ android:id="@+id/song_menu_info" android:title="@string/common.info"/> + <group android:id="@+id/hide_show_artist"> + <item + android:id="@+id/song_menu_show_album" + android:title="@string/download.menu_show_album"/> + + <item + android:id="@+id/song_menu_show_artist" + android:title="@string/menu.show_artist"/> + </group> + <group android:id="@+id/hide_play_next"> <item android:id="@+id/song_menu_play_next" |