aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-10-17 13:46:50 -0700
committerScott Jackson <daneren2005@gmail.com>2015-10-17 13:46:50 -0700
commit7bf60cbee7650834d64656f49748e4c70848d991 (patch)
treee0547d43005a111e943c27f0f1a8f049b8b0ffbe /app/src/main/java
parentdbf8a12eb38102f02ff4b0ed0636a4fe59d702a4 (diff)
downloaddsub-7bf60cbee7650834d64656f49748e4c70848d991.tar.gz
dsub-7bf60cbee7650834d64656f49748e4c70848d991.tar.bz2
dsub-7bf60cbee7650834d64656f49748e4c70848d991.zip
Poll for service available instead of just relying on next call to getDownloadService to execute waiting handlers
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
index d67893ef..dc64e9d1 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -954,6 +954,22 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
runnable.run();
} else {
afterServiceAvailable.add(runnable);
+ checkIfServiceAvailable();
+ }
+ }
+ private void checkIfServiceAvailable() {
+ if(getDownloadService() == null) {
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ checkIfServiceAvailable();
+ }
+ }, 50);
+ } else if(afterServiceAvailable.size() > 0) {
+ for(Runnable runnable: afterServiceAvailable) {
+ handler.post(runnable);
+ }
+ afterServiceAvailable.clear();
}
}