PlaybackNotificationImpl
Base class for creating and updating a media-style notification.
Action customization
Playback actions can be included or omitted as follows:
usePlayPauseActions- Sets whether the play and pause actions are used.Corresponding setter: PlaybackNotificationConfig.setUsePlayPauseActions
Default:
trueuseRewindAction- Sets whether the rewind action is used.Corresponding setter: PlaybackNotificationConfig.setUseRewindAction
Default:
trueuseRewindActionInCompactView- IfuseRewindActionistrue, sets whether the rewind action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseRewindActionInCompactView
Default:
falseuseFastForwardAction- Sets whether the fast forward action is used.Corresponding setter: PlaybackNotificationConfig.setUseFastForwardAction
Default:
trueuseFastForwardActionInCompactView- IfuseFastForwardActionistrue, sets whether the fast forward action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseFastForwardActionInCompactView
Default:
falseusePreviousAction- Whether the previous action is used.Corresponding setter: PlaybackNotificationConfig.setUsePreviousAction
Default:
trueusePreviousActionInCompactView- IfusePreviousActionistrue, sets whether the previous action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUsePreviousActionInCompactView
Default:
falseuseNextAction- Whether the next action is used.Corresponding setter: PlaybackNotificationConfig.setUseNextAction
Default:
trueuseNextActionInCompactView- IfuseNextActionistrue, sets whether the next action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseNextActionInCompactView
Default:
false
Overriding drawables
The action icons can be set programatically by using the PlaybackNotificationConfig. The large icon (i.e. the icon passed to Notification.Builder.setLargeIcon is obtained from the MediaDescriptionAdapter passed to PlaybackNotificationConfig.setAdapter
notification.setConfig(new MediaPlaybackNotification.Config(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setUseNextAction(false)
.setPriority(NotificationCompat.PRIORITY_MAX)
. setAdapter(new MediaPlaybackNotification.MediaDescriptionAdapter() {
@Override
public CharSequence getCurrentContentTitle(MediaPlayback playback) {
return "Your custom title";
}
@Nullable
@Override
public Bitmap getCurrentLargeIcon(MediaPlayback playback, BitmapCallback callback) {
// TODO: return your bitmap
}
})
);
*