Added in API level 24

DecoratedMediaCustomViewStyle


open class DecoratedMediaCustomViewStyle : Notification.MediaStyle

Notification style for media custom views that are decorated by the system

Instead of providing a media notification that is completely custom, a developer can set this style and still obtain system decorations like the notification header with the expand affordance and actions.

Use android.app.Notification.Builder#setCustomContentView(RemoteViews), android.app.Notification.Builder#setCustomBigContentView(RemoteViews) and android.app.Notification.Builder#setCustomHeadsUpContentView(RemoteViews) to set the corresponding custom views to display.

Contrary to MediaStyle a developer has to opt-in to the colorizing of the notification by using Notification.Builder.setColorized(boolean).

To use this style with your Notification, feed it to Notification.Builder.setStyle(android.app.Notification.Style) like so:

Notification noti = new Notification.Builder()
      .setSmallIcon(R.drawable.ic_stat_player)
      .setLargeIcon(albumArtBitmap))
      .setCustomContentView(contentView);
      .setStyle(<b>new Notification.DecoratedMediaCustomViewStyle()</b>.setMediaSession(mySession))
      .build();
  

Summary

Public constructors

Inherited functions
Notification! build()

Calls android.app.Notification.Builder#build() on the Builder this Style is attached to.

Note: Calling build() multiple times returns the same Notification instance, so reusing a builder to create multiple Notifications is discouraged.

Unit checkBuilder()

RemoteViews! getStandardView(layoutId: Int)

Unit internalSetBigContentTitle(title: CharSequence!)

Overrides ContentTitle in the expanded form of the template. This defaults to the value passed to setContentTitle().

Unit internalSetSummaryText(cs: CharSequence!)

Set the first line of text after the detail section in the expanded form of the template.

Unit setBuilder(builder: Notification.Builder!)

Notification.MediaStyle! setMediaSession(token: MediaSession.Token!)

Attach a android.media.session.MediaSession.Token to this Notification to provide additional playback information and control to the SystemUI.

Notification.MediaStyle setRemotePlaybackInfo(deviceName: CharSequence, iconResource: Int, chipIntent: PendingIntent?)

For media notifications associated with playback on a remote device, provide device information that will replace the default values for the output switcher chip on the media control, as well as an intent to use when the output switcher chip is tapped, on devices where this is supported.

This method is intended for system applications to provide information and/or functionality that would otherwise be unavailable to the default output switcher because the media originated on a remote device.
Requires android.Manifest.permission#MEDIA_CONTENT_CONTROL

Notification.MediaStyle! setShowActionsInCompactView(vararg actions: Int)

Request up to 3 actions (by index in the order of addition) to be shown in the compact notification view.

Inherited properties

Public constructors

DecoratedMediaCustomViewStyle

Added in API level 24
DecoratedMediaCustomViewStyle()