Merge pull request #1253 from TomHennen/fix1228

Keep episode media if we're supposed to keep skipped episodes
This commit is contained in:
Tom Hennen 2015-10-12 17:29:03 -04:00
commit 017747d09b
4 changed files with 13 additions and 11 deletions

View File

@ -89,11 +89,11 @@
android:summary="@string/pref_followQueue_sum"
android:title="@string/pref_followQueue_title"/>
<CheckBoxPreference
android:defaultValue="false"
android:defaultValue="true"
android:enabled="true"
android:key="prefSkipRemovesFromQueue"
android:summary="@string/pref_skip_removes_from_queue_sum"
android:title="@string/pref_skip_removes_from_queue_title"/>
android:key="prefSkipKeepsEpisode"
android:summary="@string/pref_skip_keeps_episodes_sum"
android:title="@string/pref_skip_keeps_episodes_title"/>
<CheckBoxPreference
android:defaultValue="false"
android:enabled="true"

View File

@ -61,7 +61,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_SKIP_KEEPS_EPISODE = "prefSkipKeepsEpisode";
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";
@ -226,7 +226,7 @@ public class UserPreferences {
return prefs.getBoolean(PREF_FOLLOW_QUEUE, true);
}
public static boolean shouldSkipRemoveFromQueue() { return prefs.getBoolean(PREF_SKIP_REMOVES, false); }
public static boolean shouldSkipKeepEpisode() { return prefs.getBoolean(PREF_SKIP_KEEPS_EPISODE, true); }
public static boolean isAutoDelete() {
return prefs.getBoolean(PREF_AUTO_DELETE, false);

View File

@ -20,7 +20,6 @@ import android.os.Build;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.util.Log;
import android.util.Pair;
import android.view.KeyEvent;
@ -577,7 +576,10 @@ public class PlaybackService extends Service {
e.printStackTrace();
// isInQueue remains false
}
if (isInQueue && (!wasSkipped || UserPreferences.shouldSkipRemoveFromQueue())) {
boolean shouldKeep = wasSkipped && UserPreferences.shouldSkipKeepEpisode();
if (isInQueue && !shouldKeep) {
DBWriter.removeQueueItem(PlaybackService.this, item, true);
}
DBWriter.addItemToPlaybackHistory(media);
@ -588,7 +590,7 @@ public class PlaybackService extends Service {
}
// Delete episode if enabled
if(item.getFeed().getPreferences().getCurrentAutoDelete()) {
if(item.getFeed().getPreferences().getCurrentAutoDelete() && !shouldKeep ) {
DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media.getId());
Log.d(TAG, "Episode Deleted");
}

View File

@ -283,8 +283,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="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="playback_pref">Playback</string>
<string name="network_pref">Network</string>
<string name="pref_autoUpdateIntervallOrTime_title">Update Interval or Time of Day</string>