diff options
-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; } } |