diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-03-03 17:22:42 -0500 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-03-03 17:22:42 -0500 |
commit | 30a202665a7cb0356aa6bc39d8d10f43be3df7b2 (patch) | |
tree | f81bd3d62a742e1d68b2a0d38dcc27c0b02bf649 /core/src/main | |
parent | b4d2ea97afb0d984ab03b2a8e4b628f3a0627426 (diff) | |
parent | ab34f84e2c837e927e359c978f5d1ea15be80971 (diff) | |
download | AntennaPod-30a202665a7cb0356aa6bc39d8d10f43be3df7b2.zip |
Merge pull request #618 from rharriso/master
added preference to add to front of queue
Diffstat (limited to 'core/src/main')
3 files changed, 14 insertions, 2 deletions
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 a3b9f6049..7cbb69a7f 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 @@ -60,6 +60,7 @@ public class UserPreferences implements 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"; + public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront"; // TODO: Make this value configurable private static final float PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT = 0.8f; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index 87bbdf455..dd6905797 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -7,7 +7,6 @@ import android.content.SharedPreferences; import android.database.Cursor; import android.preference.PreferenceManager; import android.util.Log; - import org.shredzone.flattr4j.model.Flattr; import java.io.File; @@ -35,6 +34,7 @@ import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedPreferences; import de.danoeh.antennapod.core.preferences.GpodnetPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.util.QueueAccess; @@ -386,7 +386,16 @@ public class DBWriter { context, itemIds[i]); if (item != null) { - queue.add(item); + // add item to either front ot back of queue + boolean addToFront = PreferenceManager.getDefaultSharedPreferences(context) + .getBoolean(UserPreferences.PREF_QUEUE_ADD_TO_FRONT, false); + + if(addToFront){ + queue.add(0, item); + }else{ + queue.add(item); + } + queueModified = true; if (!item.isRead()) { item.setRead(true); diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 9b7cb3585..e8c3408b2 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -272,6 +272,8 @@ <string name="pref_persistNotify_title">Persistent playback controls</string> <string name="pref_persistNotify_sum">Keep notification and lockscreen controls when playback is paused.</string> <string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string> + <string name="pref_queueAddToFront_sum">Add new episodes to the front of the queue.</string> + <string name="pref_queueAddToFront_title">Enqueue at front.</string> <!-- Auto-Flattr dialog --> <string name="auto_flattr_enable">Enable automatic flattring</string> |