summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/preferences
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-09-29 17:34:34 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2014-09-29 17:34:34 +0200
commit441165ff3f8febb10e02338b634c0250e8734472 (patch)
tree10f2b4b8e8e5ba046d3b96bca91aea8535ce3e77 /src/de/danoeh/antennapod/preferences
parent24b49f1a13bf9b175c0b404f6f14ceb1fb4bb18e (diff)
parentccb1b2522c6c4bd5b738dab1daa9aeff53b545fe (diff)
downloadAntennaPod-441165ff3f8febb10e02338b634c0250e8734472.zip
Merge branch 'mchelen-notifymore2' into develop
Diffstat (limited to 'src/de/danoeh/antennapod/preferences')
-rw-r--r--src/de/danoeh/antennapod/preferences/UserPreferences.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/de/danoeh/antennapod/preferences/UserPreferences.java b/src/de/danoeh/antennapod/preferences/UserPreferences.java
index 2020ddfae..73a4a1a14 100644
--- a/src/de/danoeh/antennapod/preferences/UserPreferences.java
+++ b/src/de/danoeh/antennapod/preferences/UserPreferences.java
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
+import android.support.v4.app.NotificationCompat;
import android.util.Log;
import org.apache.commons.lang3.StringUtils;
@@ -53,6 +54,8 @@ public class UserPreferences implements
private static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray";
public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss";
private static final String PREF_SEEK_DELTA_SECS = "prefSeekDeltaSecs";
+ private static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
+ private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
// TODO: Make this value configurable
private static final float PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT = 0.8f;
@@ -82,6 +85,8 @@ public class UserPreferences implements
private boolean pauseForFocusLoss;
private int seekDeltaSecs;
private boolean isFreshInstall;
+ private int notifyPriority;
+ private boolean persistNotify;
private UserPreferences(Context context) {
this.context = context;
@@ -138,6 +143,13 @@ public class UserPreferences implements
PREF_PLAYBACK_SPEED_ARRAY, null));
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
seekDeltaSecs = Integer.valueOf(sp.getString(PREF_SEEK_DELTA_SECS, "30"));
+ if (sp.getBoolean(PREF_EXPANDED_NOTIFICATION, false)) {
+ notifyPriority = NotificationCompat.PRIORITY_MAX;
+ }
+ else {
+ notifyPriority = NotificationCompat.PRIORITY_DEFAULT;
+ }
+ persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
}
private int readThemeValue(String valueFromPrefs) {
@@ -243,6 +255,17 @@ public class UserPreferences implements
return instance.autoFlattr;
}
+ public static int getNotifyPriority() {
+ instanceAvailable();
+ return instance.notifyPriority;
+ }
+
+ public static boolean isPersistNotify() {
+ instanceAvailable();
+ return instance.persistNotify;
+ }
+
+
/**
* Returns the time after which an episode should be auto-flattr'd in percent of the episode's
* duration.
@@ -366,6 +389,15 @@ public class UserPreferences implements
} else if (key.equals(PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD)) {
autoFlattrPlayedDurationThreshold = sp.getFloat(PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD,
PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT);
+ } else if (key.equals(PREF_EXPANDED_NOTIFICATION)) {
+ if (sp.getBoolean(PREF_EXPANDED_NOTIFICATION, false)) {
+ notifyPriority = NotificationCompat.PRIORITY_MAX;
+ }
+ else {
+ notifyPriority = NotificationCompat.PRIORITY_DEFAULT;
+ }
+ } else if (key.equals(PREF_PERSISTENT_NOTIFICATION)) {
+ persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
}
}