aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/settings.xml10
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java28
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
4 files changed, 34 insertions, 9 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 579acf3a..1dffdd1c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -322,7 +322,7 @@
<string name="settings.gapless_playback_summary">The Galaxy S3 seems to be experiencing freezes/other weird issue since the introduction of gapless playback. Turn this off to fix the issue.</string>
<string name="settings.chat_refresh">Chat Refresh Rate (Secs)</string>
<string name="settings.chat_enabled">Chat Enabled</string>
- <string name="settings.chat_enabled_summary">Whether or not to display the chat tab. Restart app after changing.</string>
+ <string name="settings.chat_enabled_summary">Whether or not to display the chat listing. Restart app after changing.</string>
<string name="settings.video_title">Video</string>
<string name="settings.video_player">Video Player</string>
<string name="settings.video_raw">Raw (Requires Subsonic 4.8+)</string>
@@ -333,6 +333,8 @@
<string name="settings.playback_title">Playback</string>
<string name="settings.hide_widget_title">Hide Widget</string>
<string name="settings.hide_widget_summary">Hide widget after exiting app</string>
+ <string name="settings.podcasts_enabled">Podcasts Enabled</string>
+ <string name="settings.podcasts_enabled_summary">Whether or not to display the podcasts listing. Restart app after changing.</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 8f6759c0..a53b1ee4 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -60,6 +60,16 @@
android:defaultValue="30"
android:digits="0123456789"/>
</PreferenceCategory>
+
+ <PreferenceCategory
+ android:title="@string/settings.other_title">
+
+ <CheckBoxPreference
+ android:title="@string/settings.podcasts_enabled"
+ android:summary="@string/settings.podcasts_enabled_summary"
+ android:key="podcastsEnabled"
+ android:defaultValue="true"/>
+ </PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
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";