NotificationCompat.Metric.FixedFloat


public final class NotificationCompat.Metric.FixedFloat extends NotificationCompat.Metric.MetricValue


Metric corresponding to a floating point value.

Summary

Public constructors

FixedFloat(float value)

Creates a FixedFloat instance with no unit and 0 minimum and 3 maximum fractional digits.

FixedFloat(float value, @Nullable CharSequence unit)

Creates a FixedFloat instance with 0 minimum and 2 maximum fractional digits.

FixedFloat(
    float value,
    @Nullable CharSequence unit,
    @IntRange(from = 0, to = 6) int minFractionDigits,
    @IntRange(from = 0, to = 6) int maxFractionDigits
)

Creates a FixedFloat instance.

Public methods

boolean
@IntRange(from = 0, to = 6) int

Maximum number of fractional digits to display.

@IntRange(from = 0, to = 6) int

Minimum number of fractional digits to display.

@Nullable CharSequence

The unit of measurement for the value, if required.

float

The fractional value.

int
@NonNull String

Public constructors

FixedFloat

public FixedFloat(float value)

Creates a FixedFloat instance with no unit and 0 minimum and 3 maximum fractional digits.

FixedFloat

public FixedFloat(float value, @Nullable CharSequence unit)

Creates a FixedFloat instance with 0 minimum and 2 maximum fractional digits.

Parameters
float value

numeric value

@Nullable CharSequence unit

optional unit for the value. Limit this to a few characters.

FixedFloat

public FixedFloat(
    float value,
    @Nullable CharSequence unit,
    @IntRange(from = 0, to = 6) int minFractionDigits,
    @IntRange(from = 0, to = 6) int maxFractionDigits
)

Creates a FixedFloat instance.

Parameters
float value

numeric value

@Nullable CharSequence unit

optional unit for the value. Limit this to a few characters.

@IntRange(from = 0, to = 6) int minFractionDigits

minimum number of factional digits to display (0-6)

@IntRange(from = 0, to = 6) int maxFractionDigits

maximum number of factional digits to display (0-6 and >= minFractionDigits)

Throws
java.lang.IllegalArgumentException

if minFractionDigits or maxFractionDigits do not respect the specified constraints

Public methods

equals

public boolean equals(Object obj)

getMaxFractionDigits

public @IntRange(from = 0, to = 6) int getMaxFractionDigits()

Maximum number of fractional digits to display.

getMinFractionDigits

public @IntRange(from = 0, to = 6) int getMinFractionDigits()

Minimum number of fractional digits to display.

getUnit

public @Nullable CharSequence getUnit()

The unit of measurement for the value, if required.

This may not be shown to the user in all views.

The space allocated to this will be limited. It's recommended to limit this to just a few characters.

getValue

public float getValue()

The fractional value.

hashCode

public int hashCode()

toString

public @NonNull String toString()