diff options
Diffstat (limited to 'src')
3 files changed, 26 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 8077bf9f..acc659b2 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -3,6 +3,7 @@ package github.daneren2005.dsub.fragments; import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
@@ -180,6 +181,14 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter menu.removeItem(R.id.menu_remove_playlist);
}
}
+
+ SharedPreferences prefs = Util.getPreferences(context);
+ if(!prefs.getBoolean(Constants.PREFERENCES_KEY_MENU_PLAY_NEXT, true)) {
+ menu.setGroupVisible(R.id.hide_play_next, false);
+ }
+ if(!prefs.getBoolean(Constants.PREFERENCES_KEY_MENU_PLAY_LAST, true)) {
+ menu.setGroupVisible(R.id.hide_play_last, false);
+ }
} else {
if(Util.isOffline(context)) {
menuInflater.inflate(R.menu.select_podcast_episode_offline, menu);
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 224c051b..c9040048 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -202,12 +202,25 @@ public class SubsonicFragment extends Fragment { if(!Util.checkServerVersion(context, "1.10.1")) {
menu.setGroupVisible(R.id.server_1_10, false);
}
+ SharedPreferences prefs = Util.getPreferences(context);
+ if(!prefs.getBoolean(Constants.PREFERENCES_KEY_MENU_PLAY_NEXT, true)) {
+ menu.setGroupVisible(R.id.hide_play_next, false);
+ }
+ if(!prefs.getBoolean(Constants.PREFERENCES_KEY_MENU_PLAY_LAST, true)) {
+ menu.setGroupVisible(R.id.hide_play_last, false);
+ }
+ if(!prefs.getBoolean(Constants.PREFERENCES_KEY_MENU_STAR, true)) {
+ menu.setGroupVisible(R.id.hide_star, false);
+ }
}
protected void recreateContextMenu(ContextMenu menu) {
List<MenuItem> menuItems = new ArrayList<MenuItem>();
for(int i = 0; i < menu.size(); i++) {
- menuItems.add(menu.getItem(i));
+ MenuItem item = menu.getItem(i);
+ if(item.isVisible()) {
+ menuItems.add(item);
+ }
}
menu.clear();
for(int i = 0; i < menuItems.size(); i++) {
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java index c539b45a..b4acb2e5 100644 --- a/src/github/daneren2005/dsub/util/Constants.java +++ b/src/github/daneren2005/dsub/util/Constants.java @@ -130,6 +130,9 @@ public final class Constants { public static final String PREFERENCES_KEY_PODCASTS_ENABLED = "podcastsEnabled"; public static final String PREFERENCES_KEY_BOOKMARKS_ENABLED = "bookmarksEnabled"; public static final String PREFERENCES_KEY_CUSTOM_SORT_ENABLED = "customSortEnabled"; + public static final String PREFERENCES_KEY_MENU_PLAY_NEXT = "showPlayNext"; + public static final String PREFERENCES_KEY_MENU_PLAY_LAST = "showPlayLast"; + public static final String PREFERENCES_KEY_MENU_STAR = "showStar"; public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount"; public static final String OFFLINE_SCROBBLE_ID = "scrobbleID"; |