diff options
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadService.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index a5b647a9..afa91d90 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -575,7 +575,7 @@ public class DownloadService extends Service { // Delete podcast if fully listened to int position = getPlayerPosition(); int duration = getPlayerDuration(); - boolean cutoff = isPastCutoff(position, duration); + boolean cutoff = isPastCutoff(position, duration, true); if(currentPlaying != null && currentPlaying.getSong() instanceof PodcastEpisode) { if(cutoff) { currentPlaying.delete(); @@ -1888,6 +1888,9 @@ public class DownloadService extends Service { return isPastCutoff(getPlayerPosition(), getPlayerDuration()); } private boolean isPastCutoff(int position, int duration) { + return isPastCutoff(position, duration, false); + } + private boolean isPastCutoff(int position, int duration, boolean allowSkipping) { if(currentPlaying == null) { return false; } @@ -1904,6 +1907,18 @@ public class DownloadService extends Service { } } + // Check to make sure we aren't in a series of similar content before deleting bookmark + if(isPastCutoff && allowSkipping) { + // Check to make sure: + // Is an audio book + // Next playing exists and is not a wrap around or a shuffle + // Next playing is from same context as current playing, so not at end of list + if(entry.isAudioBook() && nextPlaying != null && downloadList.indexOf(nextPlaying) != 0 && !shuffleMode && !shuffleRemote + && entry.getParent() != null && entry.getParent().equals(nextPlaying.getSong().getParent())) { + isPastCutoff = false; + } + } + return isPastCutoff; } |