diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-03-21 21:11:30 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-03-21 21:11:30 -0700 |
commit | c342ad3b3404da540b9729ab6fbd6ffd7ed2319b (patch) | |
tree | ace0b15a8fcfe33cb3b39788b8fa857066569141 | |
parent | a0c87a2136db0d06c9f49f02c1b36a9c07b68645 (diff) | |
download | dsub-c342ad3b3404da540b9729ab6fbd6ffd7ed2319b.tar.gz dsub-c342ad3b3404da540b9729ab6fbd6ffd7ed2319b.tar.bz2 dsub-c342ad3b3404da540b9729ab6fbd6ffd7ed2319b.zip |
Make persistent notification optional (off by default)
4 files changed, 15 insertions, 1 deletions
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml index dd27f426..3ab94f24 100644 --- a/subsonic-android/res/values/strings.xml +++ b/subsonic-android/res/values/strings.xml @@ -261,6 +261,8 @@ <string name="settings.temp_loss_pause_lower">Pause, lower volume when requested</string>
<string name="settings.temp_loss_lower">Always lower volume</string>
<string name="settings.temp_loss_nothing">Do Nothing</string>
+ <string name="settings.persistent_title">Persistent Notification</string>
+ <string name="settings.persistent_summary">Show the notification even after pausing. Press the stop button to clear it away.</string>
<string name="shuffle.startYear">Start Year:</string>
<string name="shuffle.endYear">End Year:</string>
diff --git a/subsonic-android/res/xml/settings.xml b/subsonic-android/res/xml/settings.xml index 30c5bfbc..a2ae7b20 100644 --- a/subsonic-android/res/xml/settings.xml +++ b/subsonic-android/res/xml/settings.xml @@ -182,6 +182,12 @@ android:defaultValue="1" android:entryValues="@array/tempLossValues" android:entries="@array/tempLossNames"/> + + <CheckBoxPreference + android:title="@string/settings.persistent_title" + android:summary="@string/settings.persistent_summary" + android:key="persistentNotification" + android:defaultValue="false"/> </PreferenceCategory> <PreferenceCategory diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 20e19f56..114edd1d 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -819,7 +819,12 @@ public class DownloadServiceImpl extends Service implements DownloadService { if (show) { Util.showPlayingNotification(this, this, handler, currentPlaying.getSong()); } else if (pause) { - Util.showPlayingNotification(this, this, handler, currentPlaying.getSong()); + SharedPreferences prefs = Util.getPreferences(this); + if(prefs.getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false)) { + Util.showPlayingNotification(this, this, handler, currentPlaying.getSong()); + } else { + Util.hidePlayingNotification(this, this, handler); + } } else if(hide) { Util.hidePlayingNotification(this, this, handler); } diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java index 3ee7d7e8..ae88a2ef 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java @@ -90,6 +90,7 @@ public final class Constants { public static final String PREFERENCES_KEY_BUFFER_LENGTH = "bufferLength"; public static final String PREFERENCES_EQUALIZER_ON = "equalizerOn"; public static final String PREFERENCES_EQUALIZER_SETTINGS = "equalizerSettings"; + public static final String PREFERENCES_KEY_PERSISTENT_NOTIFICATION = "persistentNotification"; // Name of the preferences file. public static final String PREFERENCES_FILE_NAME = "github.daneren2005.dsub_preferences"; |