From 0a50adfa3b2d3118b53716bb39d2cf4cafe9de60 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 21 Aug 2014 18:29:30 -0700 Subject: Fixes to web commit for auto deleting bookmarks --- .../daneren2005/dsub/service/DownloadService.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index b18928e1..5b489255 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -49,6 +49,7 @@ import github.daneren2005.dsub.util.SimpleServiceBinder; import github.daneren2005.dsub.util.SyncUtil; import github.daneren2005.dsub.util.Util; import github.daneren2005.dsub.util.compat.RemoteControlClientHelper; +import github.daneren2005.dsub.view.UpdateView; import github.daneren2005.serverproxy.BufferProxy; import java.io.File; @@ -556,7 +557,7 @@ public class DownloadService extends Service { lifecycleSupport.post(new Runnable() { @Override public void run() { - if(online) { + if (online) { checkDownloads(); } else { clearIncomplete(); @@ -1377,7 +1378,7 @@ public class DownloadService extends Service { mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() { public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.i(TAG, "Buffered " + percent + "%"); - if(percent == 100) { + if (percent == 100) { mediaPlayer.setOnBufferingUpdateListener(null); } } @@ -1506,7 +1507,7 @@ public class DownloadService extends Service { if(downloadFile.getSong() instanceof PodcastEpisode) { toDelete.add(downloadFile); } - clearCurrentBookmark(false); + clearCurrentBookmark(downloadFile.getSong(), false); } else { // If file is not completely downloaded, restart the playback from the current position. synchronized (DownloadService.this) { @@ -1786,15 +1787,14 @@ public class DownloadService extends Service { } private void clearCurrentBookmark() { - clearCurrentBookmark(true); - } - private void clearCurrentBookmark(boolean checkPosition) { // If current is null, nothing to do if(currentPlaying == null) { return; } - - final MusicDirectory.Entry entry = currentPlaying.getSong(); + + clearCurrentBookmark(currentPlaying.getSong(), true); + } + private void clearCurrentBookmark(final MusicDirectory.Entry entry, boolean checkPosition) { // If no bookmark, move on if(entry.getBookmark() == null) { return; @@ -1814,6 +1814,7 @@ public class DownloadService extends Service { if(found != null) { found.setBookmark(null); } + return null; } @Override -- cgit v1.2.3