diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-04-06 21:56:33 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-04-06 21:56:33 -0700 |
commit | 881615e22e10220766ed840526fe1b5c8896a034 (patch) | |
tree | 8b5a4a83e149d2d0bdc2cb387cf09bab9087d940 /subsonic-android | |
parent | b1a8e2e312b31b6ac9eaadbd0a61aa6bdc5a3068 (diff) | |
download | dsub-881615e22e10220766ed840526fe1b5c8896a034.tar.gz dsub-881615e22e10220766ed840526fe1b5c8896a034.tar.bz2 dsub-881615e22e10220766ed840526fe1b5c8896a034.zip |
Only have one background thread running onProgressUpdate at a time
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java index 6e02cc62..f90a1832 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java @@ -126,6 +126,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi private boolean nowPlaying = true; private ScheduledFuture<?> hideControlsFuture; private SongListAdapter songListAdapter; + private SilentBackgroundTask<Void> onProgressChangedTask; /** * Called when the activity is first created. @@ -978,11 +979,12 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi } private void onProgressChanged() { - if (getDownloadService() == null) { + // Make sure to only be trying to run one of these at a time + if (getDownloadService() == null || onProgressChangedTask != null) { return; } - new SilentBackgroundTask<Void>(this) { + onProgressChangedTask = new SilentBackgroundTask<Void>(this) { DownloadService downloadService; boolean isJukeboxEnabled; int millisPlayed; @@ -1052,8 +1054,10 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi } jukeboxButton.setTextColor(isJukeboxEnabled ? COLOR_BUTTON_ENABLED : COLOR_BUTTON_DISABLED); + onProgressChangedTask = null; } - }.execute(); + }; + onProgressChangedTask.execute(); } private void changeProgress(final int ms) { |