From 0f801b780e82943bde5b3e7d96af1c6b29ba4edc Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 28 Apr 2015 17:45:51 -0700 Subject: Fix background update running on hidden NowPlayingFragment --- .../daneren2005/dsub/fragments/NowPlayingFragment.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java index 953b429a..80183c40 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -832,7 +832,11 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis @Override public void onResume() { super.onResume(); - onResumeHandlers(); + if(this.primaryFragment) { + onResumeHandlers(); + } else { + update(); + } } private void onResumeHandlers() { final Handler handler = new Handler(); @@ -894,11 +898,14 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis onPauseHandlers(); } private void onPauseHandlers() { - executorService.shutdown(); - if(getDownloadService() != null) { - getDownloadService().stopRemoteScan(); + if(executorService != null) { + executorService.shutdown(); + if (getDownloadService() != null) { + getDownloadService().stopRemoteScan(); + } + executorService = null; + playlistFlipper.setDisplayedChild(0); } - playlistFlipper.setDisplayedChild(0); } @Override -- cgit v1.2.3