Merge pull request #2272 from minusf/develop

Skip favorite episodes during autodelete
This commit is contained in:
Martin Fietz 2017-10-15 21:43:24 +02:00 committed by GitHub
commit 688e123c34
4 changed files with 15 additions and 1 deletions

View File

@ -135,6 +135,12 @@
android:key="prefSkipKeepsEpisode"
android:summary="@string/pref_skip_keeps_episodes_sum"
android:title="@string/pref_skip_keeps_episodes_title"/>
<de.danoeh.antennapod.preferences.SwitchCompatPreference
android:defaultValue="true"
android:enabled="true"
android:key="prefFavoriteKeepsEpisode"
android:summary="@string/pref_favorite_keeps_episodes_sum"
android:title="@string/pref_favorite_keeps_episodes_title"/>
<de.danoeh.antennapod.preferences.SwitchCompatPreference
android:defaultValue="false"
android:enabled="true"

View File

@ -67,6 +67,7 @@ public class UserPreferences {
public static final String PREF_HARDWARE_PREVIOUS_BUTTON_RESTARTS = "prefHardwarePreviousButtonRestarts";
public static final String PREF_FOLLOW_QUEUE = "prefFollowQueue";
public static final String PREF_SKIP_KEEPS_EPISODE = "prefSkipKeepsEpisode";
public static final String PREF_FAVORITE_KEEPS_EPISODE = "prefFavoriteKeepsEpisode";
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";
@ -295,6 +296,10 @@ public class UserPreferences {
public static boolean shouldSkipKeepEpisode() { return prefs.getBoolean(PREF_SKIP_KEEPS_EPISODE, true); }
public static boolean shouldFavoriteKeepEpisode() {
return prefs.getBoolean(PREF_FAVORITE_KEEPS_EPISODE, true);
}
public static boolean isAutoDelete() {
return prefs.getBoolean(PREF_AUTO_DELETE, false);
}

View File

@ -892,7 +892,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
// isInQueue remains false
}
// Delete episode if enabled
if (item.getFeed().getPreferences().getCurrentAutoDelete()) {
if (item.getFeed().getPreferences().getCurrentAutoDelete() &&
!(item.isTagged(FeedItem.TAG_FAVORITE) && UserPreferences.shouldFavoriteKeepEpisode())) {
DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media.getId());
Log.d(TAG, "Episode Deleted");
}

View File

@ -320,6 +320,8 @@
<string name="pref_smart_mark_as_played_title">Smart Mark as Played</string>
<string name="pref_skip_keeps_episodes_sum">Keep episodes when they are skipped</string>
<string name="pref_skip_keeps_episodes_title">Keep Skipped Episodes</string>
<string name="pref_favorite_keeps_episodes_sum">Keep episodes when they are marked Favorite</string>
<string name="pref_favorite_keeps_episodes_title">Keep Favorite Episodes</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>