Restored minor fixes

This commit is contained in:
Nite 2020-06-23 19:27:04 +02:00
parent 0820763c7f
commit c3be251e8b
No known key found for this signature in database
GPG Key ID: 1D1AD59B1C6386C1
3 changed files with 9 additions and 2 deletions

View File

@ -79,6 +79,7 @@ public class DownloadServiceLifecycleSupport
downloadQueueSerializer.getValue().deserializeDownloadQueue(new Consumer<State>() {
@Override
public void accept(State state) {
// TODO: here the autoPlay = false creates problems when Ultrasonic is started by a Play MediaButton as the player won't start this way.
downloadService.restore(state.songs, state.currentPlayingIndex, state.currentPlayingPosition, false, false);
// Work-around: Serialize again, as the restore() method creates a serialization without current playing info.
@ -176,7 +177,11 @@ public class DownloadServiceLifecycleSupport
downloadService.stop();
break;
case KeyEvent.KEYCODE_MEDIA_PLAY:
if (downloadService.getPlayerState() != PlayerState.STARTED)
if (downloadService.getPlayerState() == PlayerState.IDLE)
{
downloadService.play();
}
else if (downloadService.getPlayerState() != PlayerState.STARTED)
{
downloadService.start();
}

View File

@ -257,6 +257,7 @@ public class MediaPlayerService extends Service
{
tabInstance.hideNowPlaying();
stopForeground(true);
player.getValue().clearRemoteControl();
isInForeground = false;
stopSelf();
}
@ -465,6 +466,7 @@ public class MediaPlayerService extends Service
if (tabInstance != null)
{
stopForeground(true);
player.getValue().clearRemoteControl();
isInForeground = false;
tabInstance.hideNowPlaying();
stopSelf();

View File

@ -478,7 +478,7 @@ public class Player
}
}
private void clearRemoteControl()
public void clearRemoteControl()
{
if (remoteControlClient != null)
{