Clean up a few things that didn't work to fix missing lock screen

controls.
This commit is contained in:
Brian Rodgers 2013-02-20 20:24:16 -06:00
parent 004493921c
commit dc5025f12a
2 changed files with 21 additions and 21 deletions

View File

@ -18,29 +18,17 @@
*/
package net.sourceforge.subsonic.androidapp.domain;
import android.media.RemoteControlClient;
/**
* @author Sindre Mehus
* @version $Id$
*/
public enum PlayerState {
IDLE(RemoteControlClient.PLAYSTATE_STOPPED),
DOWNLOADING(RemoteControlClient.PLAYSTATE_BUFFERING),
PREPARING(RemoteControlClient.PLAYSTATE_BUFFERING),
PREPARED(RemoteControlClient.PLAYSTATE_STOPPED),
STARTED(RemoteControlClient.PLAYSTATE_PLAYING),
STOPPED(RemoteControlClient.PLAYSTATE_STOPPED),
PAUSED(RemoteControlClient.PLAYSTATE_PAUSED),
COMPLETED(RemoteControlClient.PLAYSTATE_STOPPED);
private final int mRemoteControlClientPlayState;
private PlayerState(int playState) {
mRemoteControlClientPlayState = playState;
}
public int getRemoteControlClientPlayState() {
return mRemoteControlClientPlayState;
}
IDLE,
DOWNLOADING,
PREPARING,
PREPARED,
STARTED,
STOPPED,
PAUSED,
COMPLETED
}

View File

@ -760,7 +760,19 @@ public class DownloadServiceImpl extends Service implements DownloadService {
RemoteControlHelper.registerRemoteControlClient(audioManager, remoteControlClientCompat);
}
remoteControlClientCompat.setPlaybackState(playerState.getRemoteControlClientPlayState());
switch (playerState)
{
case STARTED:
remoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
break;
case PAUSED:
remoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED);
break;
case IDLE:
case STOPPED:
remoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
break;
}
remoteControlClientCompat.setTransportControlFlags(
RemoteControlClient.FLAG_KEY_MEDIA_PLAY |