diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-03-16 08:34:55 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-03-16 08:34:55 -0700 |
commit | de6e2b66b476b8d8b3e16c2859e4ec8aee7f8625 (patch) | |
tree | 922d2ff22f272d8de80ebd436521cda97f06277c /src/github/daneren2005 | |
parent | da714fe36a31381c90670150adb9c6d8d3a05620 (diff) | |
download | dsub-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/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java | 21 |
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();
}
});
}
|