aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-16 08:34:55 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-16 08:34:55 -0700
commitde6e2b66b476b8d8b3e16c2859e4ec8aee7f8625 (patch)
tree922d2ff22f272d8de80ebd436521cda97f06277c /src/github
parentda714fe36a31381c90670150adb9c6d8d3a05620 (diff)
downloaddsub-de6e2b66b476b8d8b3e16c2859e4ec8aee7f8625.tar.gz
dsub-de6e2b66b476b8d8b3e16c2859e4ec8aee7f8625.tar.bz2
dsub-de6e2b66b476b8d8b3e16c2859e4ec8aee7f8625.zip
Fix trying to popup confirm in background thread, clear and add instead of restore
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 68666b84..54db1b91 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -547,6 +547,8 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
private void loadRemotePlayQueue() {
final Context context = this;
new SilentBackgroundTask<Void>(this) {
+ private PlayerQueue playerQueue;
+
@Override
protected Void doInBackground() throws Throwable {
try {
@@ -564,7 +566,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
if(remoteState != null) {
Date localChange = downloadService.getLastStateChanged();
if(localChange == null || localChange.after(remoteState.changed)) {
- promptRestoreFromRemoteQueue(remoteState);
+ playerQueue = remoteState;
}
}
} catch (Exception e) {
@@ -573,13 +575,28 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
return null;
}
+
+ @Override
+ protected void done(Void arg) {
+ if(playerQueue != null) {
+ promptRestoreFromRemoteQueue(playerQueue);
+ }
+ }
}.execute();
}
private void promptRestoreFromRemoteQueue(final PlayerQueue remoteState) {
Util.confirmDialog(this, R.string.download_restore_play_queue, new SimpleDateFormat("MMM dd hh:mm").format(remoteState.changed), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- getDownloadService().restore(remoteState.songs, null, remoteState.currentPlayingIndex, remoteState.currentPlayingPosition);
+ new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
+ @Override
+ protected Void doInBackground() throws Throwable {
+ DownloadService downloadService = getDownloadService();
+ downloadService.clear();
+ downloadService.download(remoteState.songs, false, false, false, false, remoteState.currentPlayingIndex, remoteState.currentPlayingPosition);
+ return null;
+ }
+ }.execute();
}
});
}