aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-02-29 17:57:46 -0800
committerScott Jackson <daneren2005@gmail.com>2016-02-29 17:57:46 -0800
commit81d79dded8e9ba1fc15b2411e8a7d39ec2efd052 (patch)
treeefb52088677e15d1d06a76a19f0530670d5bc77a /app/src
parent7f5b47da42439fdfd210d4bc614b3b0bdb1158a6 (diff)
downloaddsub-81d79dded8e9ba1fc15b2411e8a7d39ec2efd052.tar.gz
dsub-81d79dded8e9ba1fc15b2411e8a7d39ec2efd052.tar.bz2
dsub-81d79dded8e9ba1fc15b2411e8a7d39ec2efd052.zip
Fixes #652: Add Show Artist/Album context menu items to search/starred songs
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java5
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java9
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java15
-rw-r--r--app/src/main/res/menu/select_album_context.xml9
-rw-r--r--app/src/main/res/menu/select_album_context_offline.xml6
-rw-r--r--app/src/main/res/menu/select_song_context.xml18
-rw-r--r--app/src/main/res/menu/select_song_context_offline.xml10
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"