aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-10-22 13:42:47 -0700
committerdaneren2005 <daneren2005@gmail.com>2013-10-22 13:42:47 -0700
commit9cc335cb81ce7845e91d87d935935094f96c422a (patch)
tree7148b3d3cd6639ab0c5575a1da48351c6663bec1 /src/github
parentfd0a4220e47ec0c46946b65c7eca0d932310b221 (diff)
downloaddsub-9cc335cb81ce7845e91d87d935935094f96c422a.tar.gz
dsub-9cc335cb81ce7845e91d87d935935094f96c422a.tar.bz2
dsub-9cc335cb81ce7845e91d87d935935094f96c422a.zip
Attempt to fix service being restarted when exiting
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index da9c25a6..313d6957 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -69,6 +69,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
private static String[] drawerItemsDescriptions = {"Home", "Library", "Playlists", "Podcasts", "Chat", "Now Playing", "Settings", "Exit"};
private static String[] drawerItems;
private boolean destroyed = false;
+ private boolean finished = false;
protected List<SubsonicFragment> backStack = new ArrayList<SubsonicFragment>();
protected SubsonicFragment currentFragment;
Spinner actionBarSpinner;
@@ -309,6 +310,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
intent.putExtra(Constants.INTENT_EXTRA_NAME_EXIT, true);
Util.startActivityWithoutTransition(this, intent);
} else {
+ finished = true;
this.stopService(new Intent(this, DownloadServiceImpl.class));
this.finish();
}
@@ -417,6 +419,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
}
public DownloadService getDownloadService() {
+ if(finished) {
+ return null;
+ }
+
// If service is not available, request it to start and wait for it.
for (int i = 0; i < 5; i++) {
DownloadService downloadService = DownloadServiceImpl.getInstance();