diff options
author | Tom Hennen <tom.hennen@gmail.com> | 2015-09-20 20:10:51 -0400 |
---|---|---|
committer | Tom Hennen <tom.hennen@gmail.com> | 2015-09-20 20:10:51 -0400 |
commit | f0904fbe49f9b92b850de0bd3460fec286003732 (patch) | |
tree | 3314e888318c78137461ffc3136286f961e6448b | |
parent | 73a16b4be824f9660c471fac2abf7976f63b833e (diff) | |
download | AntennaPod-f0904fbe49f9b92b850de0bd3460fec286003732.zip |
added preference to not remove items from queue when skipping
4 files changed, 16 insertions, 6 deletions
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index af20eddfd..68cab74f9 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -91,6 +91,12 @@ <CheckBoxPreference android:defaultValue="false" android:enabled="true" + android:key="prefSkipRemovesFromQueue" + android:summary="@string/pref_skip_removes_from_queue_sum" + android:title="@string/pref_skip_removes_from_queue_title"/> + <CheckBoxPreference + android:defaultValue="false" + android:enabled="true" android:key="prefAutoDelete" android:summary="@string/pref_auto_delete_sum" android:title="@string/pref_auto_delete_title"/> diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index e6a2a2464..ca9fbb1ba 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -57,6 +57,7 @@ public class UserPreferences { public static final String PREF_PAUSE_ON_HEADSET_DISCONNECT = "prefPauseOnHeadsetDisconnect"; public static final String PREF_UNPAUSE_ON_HEADSET_RECONNECT = "prefUnpauseOnHeadsetReconnect"; public static final String PREF_FOLLOW_QUEUE = "prefFollowQueue"; + public static final String PREF_SKIP_REMOVES = "prefSkipRemovesFromQueue"; public static final String PREF_AUTO_DELETE = "prefAutoDelete"; public static final String PREF_SMART_MARK_AS_PLAYED_SECS = "prefSmartMarkAsPlayedSecs"; public static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray"; @@ -216,6 +217,8 @@ public class UserPreferences { return prefs.getBoolean(PREF_FOLLOW_QUEUE, false); } + public static boolean isSkipRemoveFromQueue() { return prefs.getBoolean(PREF_SKIP_REMOVES, false); } + public static boolean isAutoDelete() { return prefs.getBoolean(PREF_AUTO_DELETE, false); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index a0ac9d591..30c30a5bc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -577,7 +577,7 @@ public class PlaybackService extends Service { e.printStackTrace(); // isInQueue remains false } - if (isInQueue) { + if (isInQueue && UserPreferences.isSkipRemoveFromQueue()) { DBWriter.removeQueueItem(PlaybackService.this, item, true); } DBWriter.addItemToPlaybackHistory(media); @@ -875,29 +875,28 @@ public class PlaybackService extends Service { .setWhen(0) // we don't need the time .setPriority(UserPreferences.getNotifyPriority()); // set notification priority IntList actionList = new IntList(); - int actionIndex = 0; if (playerStatus == PlayerStatus.PLAYING) { notificationBuilder.addAction(android.R.drawable.ic_media_pause, //pause action getString(R.string.pause_label), pauseButtonPendingIntent); - actionList.add(actionIndex++); + actionList.add(actionList.size()); } else { notificationBuilder.addAction(android.R.drawable.ic_media_play, //play action getString(R.string.play_label), playButtonPendingIntent); - actionList.add(actionIndex++); + actionList.add(actionList.size()); } if (UserPreferences.isFollowQueue()) { notificationBuilder.addAction(android.R.drawable.ic_media_next, getString(R.string.skip_episode_label), skipButtonPendingIntent); - actionList.add(actionIndex++); + actionList.add(actionList.size()); } if (UserPreferences.isPersistNotify()) { notificationBuilder.addAction(android.R.drawable.ic_menu_close_clear_cancel, // stop action getString(R.string.stop_label), stopButtonPendingIntent); - actionList.add(actionIndex++); + actionList.add(actionList.size()); } if (Build.VERSION.SDK_INT >= 21) { diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index ff9891bab..ffa6a781a 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -268,6 +268,8 @@ <string name="pref_auto_delete_title">Auto Delete</string> <string name="pref_smart_mark_as_played_sum">Mark episodes as played even if less than a certain amount of seconds of playing time is still left</string> <string name="pref_smart_mark_as_played_title">Smart mark as played</string> + <string name="pref_skip_removes_from_queue_sum">Remove episodes from the queue when they are skipped</string> + <string name="pref_skip_removes_from_queue_title">Skip removes episode</string> <string name="playback_pref">Playback</string> <string name="network_pref">Network</string> <string name="pref_autoUpdateIntervallOrTime_title">Update Interval or Time of Day</string> |