Metric


class Metric
kotlin.Any
   ↳ android.app.Notification.Metric

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

Summary

Nested classes

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.

abstract

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(value: Notification.Metric.MetricValue, label: CharSequence, semanticStyle: Int)

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

Public methods
Boolean
equals(other: Any?)

CharSequence

A label for the metric.

Int

Applies semantics to the metric.

Notification.Metric.MetricValue

A value for the metric.

Int

String

Public constructors

Metric

Metric(
    value: Notification.Metric.MetricValue,
    label: CharSequence)

Creates a Metric with the specified value and label.

Parameters
value Notification.Metric.MetricValue: one of the subclasses of MetricValue, such as FixedInt
This value cannot be null.
label CharSequence: metric label -- should be 10 characters or fewer.
This value cannot be null.

Metric

Metric(
    value: Notification.Metric.MetricValue,
    label: CharSequence,
    semanticStyle: Int)

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

Parameters
value Notification.Metric.MetricValue: one of the subclasses of MetricValue, such as FixedInt
This value cannot be null.
label CharSequence: metric label -- should be 10 characters or fewer.
This value cannot be null.
semanticStyle Int: semantic style applied to the metric. When the notification is promoted the metric value will be displayed (e.g. colored) according to this style.
Value is one of the following:

Public methods

equals

fun equals(other: Any?): Boolean

getLabel

fun getLabel(): CharSequence

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.

Return
CharSequence This value cannot be null.

getSemanticStyle

fun getSemanticStyle(): Int

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

Return
Int Value is one of the following:

getValue

fun getValue(): Notification.Metric.MetricValue

A value for the metric.

Return
Notification.Metric.MetricValue This value cannot be null.

hashCode

fun hashCode(): Int

toString

fun toString(): String