aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-03-21 21:11:30 -0700
committerScott Jackson <daneren2005@gmail.com>2013-03-21 21:11:30 -0700
commitc342ad3b3404da540b9729ab6fbd6ffd7ed2319b (patch)
treeace0b15a8fcfe33cb3b39788b8fa857066569141
parenta0c87a2136db0d06c9f49f02c1b36a9c07b68645 (diff)
downloaddsub-c342ad3b3404da540b9729ab6fbd6ffd7ed2319b.tar.gz
dsub-c342ad3b3404da540b9729ab6fbd6ffd7ed2319b.tar.bz2
dsub-c342ad3b3404da540b9729ab6fbd6ffd7ed2319b.zip
Make persistent notification optional (off by default)
-rw-r--r--subsonic-android/res/values/strings.xml2
-rw-r--r--subsonic-android/res/xml/settings.xml6
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java7
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/Constants.java1
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";