bug fixed

- fixed a bug where the music controller activity won’t update when
song is changed from android wear
- clean up of some methods
This commit is contained in:
Karim Abou Zeid 2015-02-08 16:19:18 +01:00
commit 45f3f0d565
2 changed files with 6 additions and 9 deletions

View file

@ -257,7 +257,7 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
@Override
public void onCompletion(MediaPlayer mp) {
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.SONG_COMPLETED);
if (isLastTrack()) {
if (isLastTrack() && getRepeatMode() == REPEAT_MODE_NONE) {
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.QUEUE_COMPLETED);
playingNotificationHelper.updatePlayState(isPlaying());
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);

View file

@ -76,8 +76,6 @@ public class MusicControllerActivity extends AbsFabActivity implements OnMusicRe
moveSeekBarIntoPlace();
updateCurrentSong();
setUpMusicControllers();
prepareViewsForOpenAnimation();
@ -86,7 +84,7 @@ public class MusicControllerActivity extends AbsFabActivity implements OnMusicRe
}
private void updateCurrentSong() {
getCurrentSongAndQueue();
getCurrentSong();
setHeadersText();
setUpArtistArt();
setUpAlbumArtAndApplyPalette();
@ -176,11 +174,9 @@ public class MusicControllerActivity extends AbsFabActivity implements OnMusicRe
}
}
private void getCurrentSongAndQueue() {
if (getApp().getMusicPlayerRemote().getPosition() >= 0) {
song = getApp().getMusicPlayerRemote().getPlayingQueue().get(getApp().getMusicPlayerRemote().getPosition());
} else {
song = new Song();
private void getCurrentSong() {
song = getApp().getMusicPlayerRemote().getCurrentSong();
if(song.id == -1){
finish();
}
}
@ -308,6 +304,7 @@ public class MusicControllerActivity extends AbsFabActivity implements OnMusicRe
protected void onResume() {
super.onResume();
startMusicControllerStateUpdateThread();
updateCurrentSong();
}
private void startMusicControllerStateUpdateThread() {