aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-10-27 13:41:34 -0700
committerScott Jackson <daneren2005@gmail.com>2013-10-27 13:41:34 -0700
commitfc6b17b5c3be344ce4ceda1e186f759e440c9c22 (patch)
treea0f7c398f8b8969af7de665511a08749a8b200c2 /src/github
parentc507a6780f34111a4a0298799fa4f2298a9d953e (diff)
downloaddsub-fc6b17b5c3be344ce4ceda1e186f759e440c9c22.tar.gz
dsub-fc6b17b5c3be344ce4ceda1e186f759e440c9c22.tar.bz2
dsub-fc6b17b5c3be344ce4ceda1e186f759e440c9c22.zip
Add option to hide podcast tab
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java28
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
2 files changed, 21 insertions, 8 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 03183637..b041e18c 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -140,18 +140,30 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
if(drawerItems == null) {
drawerItems = getResources().getStringArray(R.array.drawerItems);
drawerItemsDescriptions = getResources().getStringArray(R.array.drawerItemsDescriptions);
-
+
+ // Remove listings that user wants hidden
SharedPreferences prefs = Util.getPreferences(this);
+ int alreadyRemoved = 0;
+ List<String> drawerItemsList = new ArrayList<String>(Arrays.asList(drawerItems));
+ List<String> drawerItemsDescriptionsList = new ArrayList<String>(Arrays.asList(drawerItemsDescriptions));
+
+ // Selectively remove podcast listing [3]
+ if(!prefs.getBoolean(Constants.PREFERENCES_KEY_PODCASTS_ENABLED, true)) {
+ drawerItemsList.remove(3 - alreadyRemoved);
+ drawerItemsDescriptionsList.remove(3 - alreadyRemoved);
+ alreadyRemoved++;
+ }
+
// Selectively remove chat listing: [4]
if(!prefs.getBoolean(Constants.PREFERENCES_KEY_CHAT_ENABLED, true)) {
- List<String> tmp = new ArrayList<String>(Arrays.asList(drawerItems));
- tmp.remove(4);
- drawerItems = tmp.toArray(new String[0]);
-
- tmp = new ArrayList<String>(Arrays.asList(drawerItemsDescriptions));
- tmp.remove(4);
- drawerItemsDescriptions = tmp.toArray(new String[0]);
+ drawerItemsList.remove(4 - alreadyRemoved);
+ drawerItemsDescriptionsList.remove(4 - alreadyRemoved);
+ alreadyRemoved++;
}
+
+ // Put list back together
+ drawerItems = drawerItemsList.toArray(new String[0]);
+ drawerItemsDescriptions = drawerItemsDescriptionsList.toArray(new String[0]);
}
drawerList = (ListView) findViewById(R.id.left_drawer);
drawerList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, drawerItems));
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java
index 36ea928c..f01a9c48 100644
--- a/src/github/daneren2005/dsub/util/Constants.java
+++ b/src/github/daneren2005/dsub/util/Constants.java
@@ -119,6 +119,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_CONTROL_MODE = "remoteControlMode";
public static final String PREFERENCES_KEY_PAUSE_DISCONNECT = "pauseOnDisconnect";
public static final String PREFERENCES_KEY_HIDE_WIDGET = "hideWidget";
+ public static final String PREFERENCES_KEY_PODCASTS_ENABLED = "podcastsEnabled";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";