Merge pull request #2225 from mfietz/issue/2222-not-add-to-queue

Setting whether or not to enqueue downloaded episodes
This commit is contained in:
Martin Fietz 2017-04-09 20:26:00 +02:00 committed by GitHub
commit 4d256b7323
4 changed files with 15 additions and 6 deletions

View File

@ -161,6 +161,12 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/network_pref"> <PreferenceCategory android:title="@string/network_pref">
<de.danoeh.antennapod.preferences.SwitchCompatPreference
android:defaultValue="true"
android:enabled="true"
android:key="prefEnqueueDownloaded"
android:summary="@string/pref_enqueue_downloaded_summary"
android:title="@string/pref_enqueue_downloaded_title" />
<Preference <Preference
android:key="prefAutoUpdateIntervall" android:key="prefAutoUpdateIntervall"
android:summary="@string/pref_autoUpdateIntervallOrTime_sum" android:summary="@string/pref_autoUpdateIntervallOrTime_sum"

View File

@ -74,6 +74,7 @@ public class UserPreferences {
public static final String PREF_RESUME_AFTER_CALL = "prefResumeAfterCall"; public static final String PREF_RESUME_AFTER_CALL = "prefResumeAfterCall";
// Network // Network
public static final String PREF_ENQUEUE_DOWNLOADED = "prefEnqueueDownloaded";
public static final String PREF_UPDATE_INTERVAL = "prefAutoUpdateIntervall"; public static final String PREF_UPDATE_INTERVAL = "prefAutoUpdateIntervall";
public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate"; public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate";
public static final String PREF_EPISODE_CLEANUP = "prefEpisodeCleanup"; public static final String PREF_EPISODE_CLEANUP = "prefEpisodeCleanup";
@ -258,11 +259,10 @@ public class UserPreferences {
return prefs.getBoolean(PREF_SHOW_DOWNLOAD_REPORT, true); return prefs.getBoolean(PREF_SHOW_DOWNLOAD_REPORT, true);
} }
/** public static boolean enqueueDownloadedEpisodes() {
* Returns {@code true} if new queue elements are added to the front return prefs.getBoolean(PREF_ENQUEUE_DOWNLOADED, true);
* }
* @return {@code true} if new queue elements are added to the front; {@code false} otherwise
*/
public static boolean enqueueAtFront() { public static boolean enqueueAtFront() {
return prefs.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false); return prefs.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false);
} }

View File

@ -1051,7 +1051,8 @@ public class DownloadService extends Service {
DBWriter.setFeedMedia(media).get(); DBWriter.setFeedMedia(media).get();
if (item != null && !DBTasks.isInQueue(DownloadService.this, item.getId())) { if (item != null && UserPreferences.enqueueDownloadedEpisodes() &&
!DBTasks.isInQueue(DownloadService.this, item.getId())) {
DBWriter.addQueueItem(DownloadService.this, item).get(); DBWriter.addQueueItem(DownloadService.this, item).get();
} }
} catch (ExecutionException | InterruptedException e) { } catch (ExecutionException | InterruptedException e) {

View File

@ -421,6 +421,8 @@
<string name="pref_cast_title">Chromecast support</string> <string name="pref_cast_title">Chromecast support</string>
<string name="pref_cast_message_play_flavor">Enable support for remote media playback on Cast devices (such as Chromecast, Audio Speakers or Android TV)</string> <string name="pref_cast_message_play_flavor">Enable support for remote media playback on Cast devices (such as Chromecast, Audio Speakers or Android TV)</string>
<string name="pref_cast_message_free_flavor">Chromecast requires third party proprietary libraries that are disabled in this version of AntennaPod</string> <string name="pref_cast_message_free_flavor">Chromecast requires third party proprietary libraries that are disabled in this version of AntennaPod</string>
<string name="pref_enqueue_downloaded_title">Enqueue Dowloaded</string>
<string name="pref_enqueue_downloaded_summary">Add downloaded episodes to the queue</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>