OSDN Git Service

Eleven: Make album art show up more consistently in shuffle and not repeat
authorlinus_lee <llee@cyngn.com>
Wed, 26 Nov 2014 02:13:15 +0000 (18:13 -0800)
committerlinus_lee <llee@cyngn.com>
Tue, 9 Dec 2014 20:02:08 +0000 (12:02 -0800)
A more complete fix needs a music service rewrite - I've tried to find a
complete solution that doesn't need a rewrite but cannot figure out a good one
For now this will make all of them but the first one of the next round show up

https://cyanogen.atlassian.net/browse/MUSIC-189

Change-Id: Idd64754001a679cf9a9b16f71d285e0fb4dd1b6d

src/com/cyngn/eleven/MusicPlaybackService.java
src/com/cyngn/eleven/ui/fragments/AudioPlayerFragment.java

index 674a3a4..3a202d1 100644 (file)
@@ -1223,13 +1223,12 @@ public class MusicPlaybackService extends Service {
                 }
             }
 
-            // if we've played each track at least once
-            if (minNumPlays > 0) {
-                // if we aren't repeating all and we're not forcing a track
-                // return no more tracks
-                if (mRepeatMode != REPEAT_ALL && !force) {
+            // if we've played each track at least once and all tracks have been played an equal
+            // # of times and we aren't repeating all and we're not forcing a track, then
+            // return no more tracks
+            if (minNumPlays > 0 && numTracksWithMinNumPlays == numTracks
+                    && mRepeatMode != REPEAT_ALL && !force) {
                     return -1;
-                }
             }
 
             // else pick a track from the least number of played tracks
index 1a2d966..5fd0ca3 100644 (file)
@@ -769,6 +769,11 @@ public class AudioPlayerFragment extends Fragment implements ServiceConnection,
             final AudioPlayerFragment audioPlayerFragment = mReference.get();
             final String action = intent.getAction();
             if (action.equals(MusicPlaybackService.META_CHANGED)) {
+                // if we are repeating current and the track has changed, re-create the adapter
+                if (MusicUtils.getRepeatMode() == MusicPlaybackService.REPEAT_CURRENT) {
+                    mReference.get().createAndSetAdapter();
+                }
+
                 // Current info
                 audioPlayerFragment.updateNowPlayingInfo();
                 audioPlayerFragment.dismissPopupMenu();