diff options
Diffstat (limited to 'src/de/danoeh/antennapod/preferences')
-rw-r--r-- | src/de/danoeh/antennapod/preferences/UserPreferences.java | 32 |
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); } } |