aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-18 18:23:21 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-18 18:23:21 -0700
commit3578521ad997f424f6edd3e14117546cc50bf03f (patch)
tree2c100604143e1246d321b6fe00ea3aef1075c48a /src
parent5f91cd3038577351752d25daadbdfdc16d595bc2 (diff)
downloaddsub-3578521ad997f424f6edd3e14117546cc50bf03f.tar.gz
dsub-3578521ad997f424f6edd3e14117546cc50bf03f.tar.bz2
dsub-3578521ad997f424f6edd3e14117546cc50bf03f.zip
Fix localState being null because restore hasn't happened yet
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java2
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java5
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java4
3 files changed, 9 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 7f267f28..8bc27c84 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -557,7 +557,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
// Make sure we wait until download service is ready
DownloadService downloadService = getDownloadService();
- while(downloadService == null) {
+ while(downloadService == null || !downloadService.isInitialized()) {
Util.sleepQuietly(100L);
downloadService = getDownloadService();
}
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 6767e95e..d4d97fd5 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -440,7 +440,6 @@ public class DownloadService extends Service {
shufflePlay = true;
} else if(startShufflePlay == SHUFFLE_MODE_ARTIST) {
artistRadio = true;
- Log.d(TAG, "Artist id: " + prefs.getString(Constants.PREFERENCES_KEY_SHUFFLE_MODE_EXTRA, null));
artistRadioBuffer.restoreArtist(prefs.getString(Constants.PREFERENCES_KEY_SHUFFLE_MODE_EXTRA, null));
}
SharedPreferences.Editor editor = prefs.edit();
@@ -466,6 +465,10 @@ public class DownloadService extends Service {
suggestedPlaylistId = prefs.getString(Constants.PREFERENCES_KEY_PLAYLIST_ID, null);
}
+ public boolean isInitialized() {
+ return lifecycleSupport != null && lifecycleSupport.isInitialized();
+ }
+
public synchronized Date getLastStateChanged() {
return lifecycleSupport.getLastChange();
}
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index ca103332..8a83d881 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -171,6 +171,10 @@ public class DownloadServiceLifecycleSupport {
new CacheCleaner(downloadService, downloadService).clean();
}
+ public boolean isInitialized() {
+ return setup.get();
+ }
+
public void onStart(final Intent intent) {
if (intent != null) {
final String action = intent.getAction();