aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-04-06 21:56:33 -0700
committerScott Jackson <daneren2005@gmail.com>2013-04-06 21:56:33 -0700
commit881615e22e10220766ed840526fe1b5c8896a034 (patch)
tree8b5a4a83e149d2d0bdc2cb387cf09bab9087d940
parentb1a8e2e312b31b6ac9eaadbd0a61aa6bdc5a3068 (diff)
downloaddsub-881615e22e10220766ed840526fe1b5c8896a034.tar.gz
dsub-881615e22e10220766ed840526fe1b5c8896a034.tar.bz2
dsub-881615e22e10220766ed840526fe1b5c8896a034.zip
Only have one background thread running onProgressUpdate at a time
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java10
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) {