Merge pull request #618 from rharriso/master

added preference to add to front of queue
This commit is contained in:
Tom Hennen 2015-03-03 17:22:42 -05:00
commit 30a202665a
5 changed files with 26 additions and 4 deletions

View File

@ -59,8 +59,6 @@ public class PreferenceController {
public static final String PREF_GPODNET_LOGOUT = "pref_gpodnet_logout"; public static final String PREF_GPODNET_LOGOUT = "pref_gpodnet_logout";
public static final String PREF_GPODNET_HOSTNAME = "pref_gpodnet_hostname"; public static final String PREF_GPODNET_HOSTNAME = "pref_gpodnet_hostname";
public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
private final PreferenceUI ui; private final PreferenceUI ui;

View File

@ -22,6 +22,17 @@
android:summary="@string/pref_persistNotify_sum" android:summary="@string/pref_persistNotify_sum"
android:title="@string/pref_persistNotify_title"/> android:title="@string/pref_persistNotify_title"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/queue_label">
<CheckBoxPreference
android:defaultValue="false"
android:enabled="true"
android:key="prefQueueAddToFront"
android:summary="@string/pref_queueAddToFront_sum"
android:title="@string/pref_queueAddToFront_title"/>
/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/playback_pref"> <PreferenceCategory android:title="@string/playback_pref">
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -111,6 +122,7 @@
</PreferenceScreen> </PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/services_label"> <PreferenceCategory android:title="@string/services_label">
<PreferenceScreen <PreferenceScreen
android:key="prefFlattrSettings" android:key="prefFlattrSettings"

View File

@ -60,6 +60,7 @@ public class UserPreferences implements
private static final String PREF_SEEK_DELTA_SECS = "prefSeekDeltaSecs"; private static final String PREF_SEEK_DELTA_SECS = "prefSeekDeltaSecs";
private static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; private static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify"; private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront";
// TODO: Make this value configurable // TODO: Make this value configurable
private static final float PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT = 0.8f; private static final float PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT = 0.8f;

View File

@ -7,7 +7,6 @@ import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import org.shredzone.flattr4j.model.Flattr; import org.shredzone.flattr4j.model.Flattr;
import java.io.File; 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.feed.FeedPreferences;
import de.danoeh.antennapod.core.preferences.GpodnetPreferences; import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; 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.download.DownloadStatus;
import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.core.util.QueueAccess; import de.danoeh.antennapod.core.util.QueueAccess;
@ -386,7 +386,16 @@ public class DBWriter {
context, itemIds[i]); context, itemIds[i]);
if (item != null) { 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; queueModified = true;
if (!item.isRead()) { if (!item.isRead()) {
item.setRead(true); item.setRead(true);

View File

@ -272,6 +272,8 @@
<string name="pref_persistNotify_title">Persistent playback controls</string> <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_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_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 --> <!-- Auto-Flattr dialog -->
<string name="auto_flattr_enable">Enable automatic flattring</string> <string name="auto_flattr_enable">Enable automatic flattring</string>