From 9cc335cb81ce7845e91d87d935935094f96c422a Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Tue, 22 Oct 2013 13:42:47 -0700 Subject: Attempt to fix service being restarted when exiting --- src/github/daneren2005/dsub/activity/SubsonicActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/github/daneren2005') 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 backStack = new ArrayList(); 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(); -- cgit v1.2.3