From 01f6eb5e7f1b66e4bbba63debe018947d96f981e Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 9 Aug 2015 12:20:02 -0700 Subject: Fix repeat not updating --- .../dsub/fragments/NowPlayingFragment.java | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 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 cc4fd9f0..bc645e0c 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -117,10 +117,9 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis private ImageButton bookmarkButton; private ImageButton rateBadButton; private ImageButton rateGoodButton; - private View mainLayout; + private ScheduledExecutorService executorService; private DownloadFile currentPlaying; - private long currentRevision; private int swipeDistance; private int swipeVelocity; private ScheduledFuture hideControlsFuture; @@ -159,8 +158,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis rootView = inflater.inflate(R.layout.download, container, false); setTitle(R.string.button_bar_now_playing); - mainLayout = rootView.findViewById(R.id.download_layout); - WindowManager w = context.getWindowManager(); Display d = w.getDefaultDisplay(); swipeDistance = (d.getWidth() + d.getHeight()) * PERCENTAGE_OF_SCREEN_FOR_SWIPE / 100; @@ -220,7 +217,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis DownloadService downloadService = getDownloadService(); downloadService.remove(downloadFile); songListAdapter.removeItem(downloadFile); - currentRevision = downloadService.getDownloadListUpdateRevision(); } }); touchHelper.attachToRecyclerView(playlistView); @@ -371,6 +367,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis default: break; } + updateRepeatButton(); setControlsVisible(true); } }); @@ -808,6 +805,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis downloadService.startRemoteScan(); downloadService.addOnSongChangedListener(NowPlayingFragment.this, true); } + updateRepeatButton(); } }); } @@ -1329,21 +1327,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis } emptyTextView.setVisibility(songs.isEmpty() ? View.VISIBLE : View.GONE); - currentRevision = downloadService.getDownloadListUpdateRevision(); - - switch (downloadService.getRepeatMode()) { - case OFF: - repeatButton.setImageResource(DrawableTint.getDrawableRes(context, R.attr.media_button_repeat_off)); - break; - case ALL: - repeatButton.setImageResource(DrawableTint.getDrawableRes(context, R.attr.media_button_repeat_all)); - break; - case SINGLE: - repeatButton.setImageResource(DrawableTint.getDrawableRes(context, R.attr.media_button_repeat_single)); - break; - default: - break; - } if(scrollWhenLoaded) { scrollToCurrent(); @@ -1434,4 +1417,21 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis break; } } + + public void updateRepeatButton() { + DownloadService downloadService = getDownloadService(); + switch (downloadService.getRepeatMode()) { + case OFF: + repeatButton.setImageResource(DrawableTint.getDrawableRes(context, R.attr.media_button_repeat_off)); + break; + case ALL: + repeatButton.setImageResource(DrawableTint.getDrawableRes(context, R.attr.media_button_repeat_all)); + break; + case SINGLE: + repeatButton.setImageResource(DrawableTint.getDrawableRes(context, R.attr.media_button_repeat_single)); + break; + default: + break; + } + } } -- cgit v1.2.3