diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-10-09 16:33:28 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-10-09 16:33:28 -0700 |
commit | 4863fd70fc687e6ad85d718fc37882a6607f3ce6 (patch) | |
tree | b3876342ff0b6c4faef77a3cf8777029e0db7cdd /app | |
parent | 3da246de2ca75afaa03985a8a5a73c12bf1995c4 (diff) | |
parent | 89a6640791144d5f562c9a5bfb70056d075633e8 (diff) | |
download | dsub-4863fd70fc687e6ad85d718fc37882a6607f3ce6.tar.gz dsub-4863fd70fc687e6ad85d718fc37882a6607f3ce6.tar.bz2 dsub-4863fd70fc687e6ad85d718fc37882a6607f3ce6.zip |
Merge branch 'master' into auto
Diffstat (limited to 'app')
-rw-r--r-- | app/app-release.apk | bin | 4277404 -> 0 bytes | |||
-rw-r--r-- | app/src/main/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java | 12 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 17 |
4 files changed, 20 insertions, 11 deletions
diff --git a/app/app-release.apk b/app/app-release.apk Binary files differdeleted file mode 100644 index eac41b21..00000000 --- a/app/app-release.apk +++ /dev/null diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index efaf4ecc..edd354d6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="github.daneren2005.dsub" android:installLocation="internalOnly" - android:versionCode="159" + android:versionCode="162" android:versionName="5.0.4"> <instrumentation android:name="android.test.InstrumentationTestRunner" diff --git a/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java b/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java index 83733618..18660fa2 100644 --- a/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java +++ b/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java @@ -165,10 +165,14 @@ public class DSubWidgetProvider extends AppWidgetProvider { MusicDirectory.Entry currentPlaying = null; if(service == null) { // Deserialize from playling list to setup - PlayerQueue state = FileUtil.deserialize(context, DownloadServiceLifecycleSupport.FILENAME_DOWNLOADS_SER, PlayerQueue.class); - if(state != null && state.currentPlayingIndex != -1) { - currentPlaying = state.songs.get(state.currentPlayingIndex); - } + try { + PlayerQueue state = FileUtil.deserialize(context, DownloadServiceLifecycleSupport.FILENAME_DOWNLOADS_SER, PlayerQueue.class); + if (state != null && state.currentPlayingIndex != -1) { + currentPlaying = state.songs.get(state.currentPlayingIndex); + } + } catch(Exception e) { + Log.e(TAG, "Failed to grab current playing", e); + } } else { currentPlaying = service.getCurrentPlaying() == null ? null : service.getCurrentPlaying().getSong(); } diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index d057c7fd..4c8ac586 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -286,10 +286,7 @@ public class DownloadServiceLifecycleSupport { public void serializeDownloadQueueNow(List<DownloadFile> songs, boolean serializeRemote) { final PlayerQueue state = new PlayerQueue(); for (DownloadFile downloadFile : songs) { - MusicDirectory.Entry song = downloadFile.getSong(); - if(song.isOnlineId(downloadService)) { - state.songs.add(downloadFile.getSong()); - } + state.songs.add(downloadFile.getSong()); } for (DownloadFile downloadFile : downloadService.getToDelete()) { state.toDelete.add(downloadFile.getSong()); @@ -324,11 +321,19 @@ public class DownloadServiceLifecycleSupport { position = 0; } + MusicDirectory.Entry currentPlaying = state.songs.get(index); + List<MusicDirectory.Entry> songs = new ArrayList<>(); + for(MusicDirectory.Entry song: state.songs) { + if(song.isOnlineId(downloadService)) { + songs.add(song); + } + } + MusicService musicService = MusicServiceFactory.getMusicService(downloadService); - musicService.savePlayQueue(state.songs, state.songs.get(index), position, downloadService, null); - currentSavePlayQueueTask = null; + musicService.savePlayQueue(songs, currentPlaying, position, downloadService, null); } catch (Exception e) { Log.e(TAG, "Failed to save playing queue to server", e); + } finally { currentSavePlayQueueTask = null; } |