mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-16 17:22:23 +03:00
Clean up a few things that didn't work to fix missing lock screen
controls.
This commit is contained in:
parent
004493921c
commit
dc5025f12a
@ -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
|
||||
}
|
||||
|
@ -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 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user