Merge pull request #4888 from ByteHamster/fix-extended-widget-actions

Fix extended widget buttons
This commit is contained in:
ByteHamster 2021-01-21 18:34:38 +01:00 committed by GitHub
commit 86bf6a50f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -107,7 +107,6 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
RemoteViews views; RemoteViews views;
views = new RemoteViews(getPackageName(), R.layout.player_widget); views = new RemoteViews(getPackageName(), R.layout.player_widget);
boolean nothingPlaying = false;
Playable media; Playable media;
PlayerStatus status; PlayerStatus status;
if (playbackService != null) { if (playbackService != null) {
@ -169,11 +168,13 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
createMediaButtonIntent(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE)); createMediaButtonIntent(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
views.setOnClickPendingIntent(R.id.butPlayExtended, views.setOnClickPendingIntent(R.id.butPlayExtended,
createMediaButtonIntent(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE)); createMediaButtonIntent(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
views.setOnClickPendingIntent(R.id.butRew,
createMediaButtonIntent(KeyEvent.KEYCODE_MEDIA_REWIND));
views.setOnClickPendingIntent(R.id.butFastForward,
createMediaButtonIntent(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD));
views.setOnClickPendingIntent(R.id.butSkip,
createMediaButtonIntent(KeyEvent.KEYCODE_MEDIA_NEXT));
} else { } else {
nothingPlaying = true;
}
if (nothingPlaying) {
// start the app if they click anything // start the app if they click anything
views.setOnClickPendingIntent(R.id.layout_left, startMediaPlayer); views.setOnClickPendingIntent(R.id.layout_left, startMediaPlayer);
views.setOnClickPendingIntent(R.id.butPlay, startMediaPlayer); views.setOnClickPendingIntent(R.id.butPlay, startMediaPlayer);