summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/danoeh/antennapod')
-rw-r--r--src/de/danoeh/antennapod/preferences/UserPreferences.java31
-rw-r--r--src/de/danoeh/antennapod/service/playback/PlaybackService.java17
2 files changed, 43 insertions, 5 deletions
diff --git a/src/de/danoeh/antennapod/preferences/UserPreferences.java b/src/de/danoeh/antennapod/preferences/UserPreferences.java
index 2020ddfae..1f2d720c9 100644
--- a/src/de/danoeh/antennapod/preferences/UserPreferences.java
+++ b/src/de/danoeh/antennapod/preferences/UserPreferences.java
@@ -53,6 +53,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 +84,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 +142,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 = 2; // max priority
+ }
+ else {
+ notifyPriority = 0; // default priority
+ }
+ persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
}
private int readThemeValue(String valueFromPrefs) {
@@ -243,6 +254,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 +388,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 = 2; // max priority
+ }
+ else {
+ notifyPriority = 0; // default priority
+ }
+ } else if (key.equals(PREF_PERSISTENT_NOTIFICATION)) {
+ persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
}
}
diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackService.java b/src/de/danoeh/antennapod/service/playback/PlaybackService.java
index 60e39275a..49c5eca75 100644
--- a/src/de/danoeh/antennapod/service/playback/PlaybackService.java
+++ b/src/de/danoeh/antennapod/service/playback/PlaybackService.java
@@ -402,7 +402,13 @@ public class PlaybackService extends Service {
taskManager.cancelPositionSaver();
saveCurrentPosition(false, 0);
taskManager.cancelWidgetUpdater();
-// stopForeground(true); // do not remove notification on pause
+ if (UserPreferences.isPersistNotify()) {
+ // do not remove notification on pause
+ }
+ else {
+ // remove notifcation on pause
+ stopForeground(true);
+ }
break;
case STOPPED:
@@ -744,13 +750,14 @@ public class PlaybackService extends Service {
.setContentIntent(pIntent)
.setLargeIcon(icon)
.setSmallIcon(R.drawable.ic_stat_antenna)
- .addAction(android.R.drawable.ic_media_pause, //pause action
- getString(R.string.pause_label),
- pauseButtonPendingIntent)
+ .setPriority(UserPreferences.getNotifyPriority()) // set notification priority
.addAction(android.R.drawable.ic_media_play, //play action
getString(R.string.play_label),
playButtonPendingIntent)
- .addAction(android.R.drawable.ic_media_stop, // stop action
+ .addAction(android.R.drawable.ic_media_pause, //pause action
+ getString(R.string.pause_label),
+ pauseButtonPendingIntent)
+ .addAction(android.R.drawable.ic_menu_close_clear_cancel, // stop action
getString(R.string.stop_label),
stopButtonPendingIntent);
notification = notificationBuilder.build();