mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Remove stop button for now and show play/pause in compact mode
This commit is contained in:
parent
35c4c35416
commit
59f22abb3e
1 changed files with 4 additions and 12 deletions
|
@ -101,7 +101,6 @@ public class MediaSession {
|
||||||
if (mPlaybackState == PLAYBACK_STATE_PLAYING) {
|
if (mPlaybackState == PLAYBACK_STATE_PLAYING) {
|
||||||
filter.addAction(KEY_MEDIA_PAUSE);
|
filter.addAction(KEY_MEDIA_PAUSE);
|
||||||
}
|
}
|
||||||
filter.addAction(KEY_MEDIA_STOP);
|
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
if (mMediaSessionActionReceiver == null) {
|
if (mMediaSessionActionReceiver == null) {
|
||||||
|
@ -116,9 +115,6 @@ public class MediaSession {
|
||||||
} else if (intent.getAction().equals(KEY_MEDIA_PLAY)) {
|
} else if (intent.getAction().equals(KEY_MEDIA_PLAY)) {
|
||||||
mView.mediaSessionAction(ACTION_PLAY);
|
mView.mediaSessionAction(ACTION_PLAY);
|
||||||
Log.d("MediaSession", "PLAY action");
|
Log.d("MediaSession", "PLAY action");
|
||||||
} else if (intent.getAction().equals(KEY_MEDIA_STOP)) {
|
|
||||||
mView.mediaSessionAction(ACTION_STOP);
|
|
||||||
Log.d("MediaSession", "STOP action");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -128,18 +124,11 @@ public class MediaSession {
|
||||||
|
|
||||||
mContext.registerReceiver(mMediaSessionActionReceiver, filter);
|
mContext.registerReceiver(mMediaSessionActionReceiver, filter);
|
||||||
|
|
||||||
Intent stopIntent = new Intent(KEY_MEDIA_STOP);
|
|
||||||
Notification.Action stopAction =
|
|
||||||
new Notification.Action(R.drawable.media_session_stop, "Stop",
|
|
||||||
PendingIntent.getBroadcast(mContext, 0, stopIntent, 0));
|
|
||||||
|
|
||||||
Notification.Builder builder = new Notification.Builder(mContext, this.MEDIA_CHANNEL_ID);
|
Notification.Builder builder = new Notification.Builder(mContext, this.MEDIA_CHANNEL_ID);
|
||||||
builder
|
builder
|
||||||
.setSmallIcon(R.drawable.media_session_icon)
|
.setSmallIcon(R.drawable.media_session_icon)
|
||||||
.setContentTitle(mTitle)
|
.setContentTitle(mTitle)
|
||||||
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
.setVisibility(Notification.VISIBILITY_PUBLIC);
|
||||||
.addAction(stopAction)
|
|
||||||
.setStyle(new Notification.MediaStyle());
|
|
||||||
|
|
||||||
String contentText = new String();
|
String contentText = new String();
|
||||||
if (mArtist != null && !mArtist.isEmpty()) {
|
if (mArtist != null && !mArtist.isEmpty()) {
|
||||||
|
@ -173,6 +162,9 @@ public class MediaSession {
|
||||||
builder.addAction(pauseAction);
|
builder.addAction(pauseAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder.setStyle(new Notification.MediaStyle()
|
||||||
|
.setShowActionsInCompactView(0));
|
||||||
|
|
||||||
NotificationManager notificationManager =
|
NotificationManager notificationManager =
|
||||||
mContext.getSystemService(NotificationManager.class);
|
mContext.getSystemService(NotificationManager.class);
|
||||||
notificationManager.notify(id, builder.build());
|
notificationManager.notify(id, builder.build());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue