diff options
-rw-r--r-- | .gitignore | 3 | ||||
m--------- | ActionBarSherlock | 0 | ||||
m--------- | DragSortListView | 0 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 29 |
4 files changed, 21 insertions, 11 deletions
@@ -2,5 +2,4 @@ subsonic-android/.classpath subsonic-android/.project
subsonic-android/bin/*
subsonic-android/gen/*
-/subsonic-android/libs/ActionBarSherlock/gen/
-/subsonic-android/private/*
\ No newline at end of file +subsonic-android/private/*
\ No newline at end of file diff --git a/ActionBarSherlock b/ActionBarSherlock -Subproject 9598f2bb2ceed4a834cd5586a903f270ca4c0cc +Subproject 90939dc3925ffaaa0de269bbbe1b35e274968ea diff --git a/DragSortListView b/DragSortListView new file mode 160000 +Subproject c4166a8fb4fd46688061ec915d4fa51de374e0a diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 6ff45dee..e04fc00c 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -30,6 +30,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.RemoteControlClient; +import android.os.AsyncTask; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.util.Log; @@ -181,15 +182,7 @@ public class DownloadServiceLifecycleSupport { } public void serializeDownloadQueue() { - State state = new State(); - for (DownloadFile downloadFile : downloadService.getSongs()) { - state.songs.add(downloadFile.getSong()); - } - state.currentPlayingIndex = downloadService.getCurrentPlayingIndex(); - state.currentPlayingPosition = downloadService.getPlayerPosition(); - - Log.i(TAG, "Serialized currentPlayingIndex: " + state.currentPlayingIndex + ", currentPlayingPosition: " + state.currentPlayingPosition); - FileUtil.serialize(downloadService, state, FILENAME_DOWNLOADS_SER); + new SerializeTask().execute(); } private void deserializeDownloadQueue() { @@ -277,4 +270,22 @@ public class DownloadServiceLifecycleSupport { private int currentPlayingIndex; private int currentPlayingPosition; } + + private class SerializeTask extends AsyncTask<Void, Void, Void> { + @Override + protected Void doInBackground(Void... params) { + List<DownloadFile> songs = new ArrayList<DownloadFile>(downloadService.getSongs()); + State state = new State(); + for (DownloadFile downloadFile : songs) { + state.songs.add(downloadFile.getSong()); + } + state.currentPlayingIndex = downloadService.getCurrentPlayingIndex(); + state.currentPlayingPosition = downloadService.getPlayerPosition(); + + Log.i(TAG, "Serialized currentPlayingIndex: " + state.currentPlayingIndex + ", currentPlayingPosition: " + state.currentPlayingPosition); + FileUtil.serialize(downloadService, state, FILENAME_DOWNLOADS_SER); + + return null; + } + } }
\ No newline at end of file |