diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-25 18:55:23 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-25 18:55:23 -0700 |
commit | 5d5a0e607c753ffe32b4d0288d391ac3c56d9df8 (patch) | |
tree | 5ad613013baeb70c686be583a6c6ef29bbdb4330 /src/github | |
parent | 311dc13aa0d3c36e536a7e38fb646ad8406e94e1 (diff) | |
download | dsub-5d5a0e607c753ffe32b4d0288d391ac3c56d9df8.tar.gz dsub-5d5a0e607c753ffe32b4d0288d391ac3c56d9df8.tar.bz2 dsub-5d5a0e607c753ffe32b4d0288d391ac3c56d9df8.zip |
Fix widget startup
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/provider/DSubWidgetProvider.java | 14 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 10 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java b/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java index 34e1c41b..f6b28b21 100644 --- a/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java +++ b/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java @@ -44,8 +44,11 @@ import github.daneren2005.dsub.activity.DownloadActivity; import github.daneren2005.dsub.activity.SubsonicActivity; import github.daneren2005.dsub.activity.SubsonicFragmentActivity; import github.daneren2005.dsub.domain.MusicDirectory; +import github.daneren2005.dsub.service.DownloadFile; import github.daneren2005.dsub.service.DownloadService; +import github.daneren2005.dsub.service.DownloadServiceLifecycleSupport; import github.daneren2005.dsub.util.Constants; +import github.daneren2005.dsub.util.FileUtil; import github.daneren2005.dsub.util.ImageLoader; import github.daneren2005.dsub.util.Util; @@ -161,20 +164,15 @@ public class DSubWidgetProvider extends AppWidgetProvider { } // Get Entry from current playing DownloadFile - DownloadFile currentFile; MusicDirectory.Entry currentPlaying = null; if(service == null) { // Deserialize from playling list to setup - DownloadServiceLifecycleSupport.State state = FileUtil.deserialize(context, DownloadLifecycleSupport.FILENAME_DOWNLOADS_SER, DownloadServiceLifecycleSupport.State.class); + DownloadServiceLifecycleSupport.State state = FileUtil.deserialize(context, DownloadServiceLifecycleSupport.FILENAME_DOWNLOADS_SER, DownloadServiceLifecycleSupport.State.class); if(state != null && state.currentPlayingIndex != -1) { - currentFile = state.songs.get(state.currentPlayingIndex); + currentPlaying = state.songs.get(state.currentPlayingIndex); } } else { - currentFile = service.getCurrentPlaying(); - } - - if(currentFile != null) { - currentPlaying = currentFile.getSong(); + currentPlaying = service.getCurrentPlaying() == null ? null : service.getCurrentPlaying().getSong(); } String title = currentPlaying == null ? null : currentPlaying.getTitle(); diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 8e9db735..13c3cea7 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -361,10 +361,10 @@ public class DownloadServiceLifecycleSupport { public static class State implements Serializable { private static final long serialVersionUID = -6346438781062572271L; - private List<MusicDirectory.Entry> songs = new ArrayList<MusicDirectory.Entry>(); - private List<MusicDirectory.Entry> toDelete = new ArrayList<MusicDirectory.Entry>(); - private int currentPlayingIndex; - private int currentPlayingPosition; - private boolean renameCurrent = false; + public List<MusicDirectory.Entry> songs = new ArrayList<MusicDirectory.Entry>(); + public List<MusicDirectory.Entry> toDelete = new ArrayList<MusicDirectory.Entry>(); + public int currentPlayingIndex; + public int currentPlayingPosition; + public boolean renameCurrent = false; } } |