public abstract class

NotificationCompat.Style

extends java.lang.Object

 java.lang.Object

↳androidx.core.app.NotificationCompat.Style

Subclasses:

NotificationCompat.BigPictureStyle, NotificationCompat.BigTextStyle, NotificationCompat.MessagingStyle, NotificationCompat.InboxStyle, NotificationCompat.DecoratedCustomViewStyle, MediaStyleNotificationHelper.MediaStyle, MediaStyleNotificationHelper.DecoratedMediaCustomViewStyle, NotificationCompat.MediaStyle, NotificationCompat.DecoratedMediaCustomViewStyle

Overview

An object that can apply a rich notification style to a object.
If the platform does not provide rich notification styles, methods in this class have no effect.

Summary

Fields
protected NotificationCompat.BuildermBuilder

Constructors
publicStyle()

Methods
public voidaddCompatExtras(Bundle extras)

This is called with the extras of the framework Notification during the NotificationCompat.Builder.build() process, after apply() has been called.

public voidapply(NotificationBuilderWithBuilderAccessor builder)

Applies the compat style data to the framework Notification in a backwards compatible way.

public RemoteViewsapplyStandardTemplate(boolean showSmallIcon, int resId, boolean fitIn1U)

public Notificationbuild()

If this Style object has been set on a notification builder, this method will build that notification and return it.

public voidbuildIntoRemoteViews(RemoteViews outerView, RemoteViews innerView)

protected voidclearCompatExtraKeys(Bundle extras)

public BitmapcreateColoredBitmap(int iconId, int color)

Create a bitmap using the given icon together with a color filter created from the given color.

public booleandisplayCustomViewInline()

public static NotificationCompat.StyleextractStyleFromNotification(Notification notification)

protected java.lang.StringgetClassName()

public RemoteViewsmakeBigContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViewsmakeContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViewsmakeHeadsUpContentView(NotificationBuilderWithBuilderAccessor builder)

protected voidrestoreFromCompatExtras(Bundle extras)

public voidsetBuilder(NotificationCompat.Builder builder)

Link this rich notification style with a notification builder.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

protected NotificationCompat.Builder mBuilder

Constructors

public Style()

Methods

public void setBuilder(NotificationCompat.Builder builder)

Link this rich notification style with a notification builder.

public Notification build()

If this Style object has been set on a notification builder, this method will build that notification and return it. Otherwise, it will return null.

protected java.lang.String getClassName()

public void apply(NotificationBuilderWithBuilderAccessor builder)

Applies the compat style data to the framework Notification in a backwards compatible way. All other data should be stored within the Notification's extras.

public boolean displayCustomViewInline()

Returns:

Whether custom content views are displayed inline in the style

public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViews makeHeadsUpContentView(NotificationBuilderWithBuilderAccessor builder)

public void addCompatExtras(Bundle extras)

This is called with the extras of the framework Notification during the NotificationCompat.Builder.build() process, after apply() has been called. This means that you only need to add data which won't be populated by the framework Notification which was built so far. Moreover, recovering builders and styles is only supported at API 19 and above, no implementation is required for current BigTextStyle, BigPictureStyle, or InboxStyle.

protected void restoreFromCompatExtras(Bundle extras)

protected void clearCompatExtraKeys(Bundle extras)

public static NotificationCompat.Style extractStyleFromNotification(Notification notification)

public RemoteViews applyStandardTemplate(boolean showSmallIcon, int resId, boolean fitIn1U)

public Bitmap createColoredBitmap(int iconId, int color)

Create a bitmap using the given icon together with a color filter created from the given color.

public void buildIntoRemoteViews(RemoteViews outerView, RemoteViews innerView)