diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-11-11 17:59:29 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-11-11 17:59:29 -0800 |
commit | ec1b17c7bce3633a59774fd64681dc1f30a04240 (patch) | |
tree | f09544983e81926c9f3ae3f307e0e06e511dac4d /app | |
parent | cb24d39926ffbeb000ce59cb00fabb1c06d08218 (diff) | |
download | dsub-ec1b17c7bce3633a59774fd64681dc1f30a04240.tar.gz dsub-ec1b17c7bce3633a59774fd64681dc1f30a04240.tar.bz2 dsub-ec1b17c7bce3633a59774fd64681dc1f30a04240.zip |
Don't constantly update position for Auto
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index 40538eae..0ed79d52 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1461,7 +1461,7 @@ public class DownloadService extends Service { subtractNextPosition = 0; } } - onSongProgress(); + onSongProgress(cachedPosition < 2000 ? true: false); Thread.sleep(1000L); } catch(Exception e) { @@ -2632,7 +2632,11 @@ public class DownloadService extends Service { }); } } + private synchronized void onSongProgress() { + onSongProgress(true); + } + private synchronized void onSongProgress(boolean manual) { final long atRevision = revision; final Integer duration = getPlayerDuration(); final boolean isSeekable = isSeekable(); @@ -2648,12 +2652,15 @@ public class DownloadService extends Service { }); } - handler.post(new Runnable() { - @Override - public void run() { - mRemoteControl.setPlaybackState(playerState.getRemoteControlClientPlayState()); - } - }); + if(manual) { + Log.d(TAG, "Manual update"); + handler.post(new Runnable() { + @Override + public void run() { + mRemoteControl.setPlaybackState(playerState.getRemoteControlClientPlayState()); + } + }); + } } private void onStateUpdate() { final long atRevision = revision; |