NotificationCompat.Metric


@RequiresApi(value = 26)
public final class NotificationCompat.Metric


A metric, used with MetricStyle, and which has a value and a label.

Summary

Nested types

A metric value for showing a date.

Metric corresponding to a floating point value.

Metric corresponding to an integer value.

Metric corresponding to a text value.

A metric value for showing a clock time.

A superclass for the various value types used by the Metric class.

This represents a timer, a stopwatch, or a countdown to an event.

Public constructors

Creates a Metric with the specified value and label.

Metric(
    @NonNull NotificationCompat.Metric.MetricValue value,
    @NonNull CharSequence label,
    int semanticStyle
)

Creates a Metric with the specified value, label, and semantic style.

Public methods

boolean
@NonNull CharSequence

A label for the metric.

int

Applies semantics to the metric.

@NonNull NotificationCompat.Metric.MetricValue

A value for the metric.

int
@NonNull String

Public constructors

Metric

public Metric(
    @NonNull NotificationCompat.Metric.MetricValue value,
    @NonNull CharSequence label
)

Creates a Metric with the specified value and label.

Parameters
@NonNull NotificationCompat.Metric.MetricValue value

one of the subclasses of MetricValue, such as FixedInt

@NonNull CharSequence label

metric label -- should be 10 characters or fewer

Metric

public Metric(
    @NonNull NotificationCompat.Metric.MetricValue value,
    @NonNull CharSequence label,
    int semanticStyle
)

Creates a Metric with the specified value, label, and semantic style.

Parameters
@NonNull NotificationCompat.Metric.MetricValue value

one of the subclasses of MetricValue, such as FixedInt

@NonNull CharSequence label

metric label -- should be 10 characters or fewer

int semanticStyle

semantic style applied to the metric. When the notification is promoted the metric value will be displayed (e.g. colored) according to this style.

Public methods

equals

public boolean equals(Object obj)

getLabel

public @NonNull CharSequence getLabel()

A label for the metric.

The space allocated to this will depend on the number of metrics on the notification, but it's recommended to keep this to 10 characters or fewer.

getSemanticStyle

public int getSemanticStyle()

Applies semantics to the metric. When the notification is promoted the metric value will be displayed (e.g. colored) according to this style.

getValue

public @NonNull NotificationCompat.Metric.MetricValue getValue()

A value for the metric.

hashCode

public int hashCode()

toString

public @NonNull String toString()