Status

public final class Status implements TimeDependentText


Base class to represent the status of an Ongoing Activity and render it.

A status is composed of Parts, and they are joined together with a template.

Note that for backwards compatibility reasons the code rendering this status message may not have all of the [Part] classes that are available in later versions of the library. Templates that do not have values for all of the named parts will not be used. The template list will be iterated through looking for the first template with all matching named parts available, this will be selected for rendering the status.

To provide for backwards compatibility, you should provide one (or more) fallback templates which use status parts from earlier versions of the API. e.g. TextPart, TimerPart &StopwatchPart

The status and part classes here use timestamps for updating the displayed representation of the status, in cases when this is needed (chronometers), as returned by elapsedRealtime

Summary

Nested types

Status.Builder

Helper to Build OngoingActivityStatus instances.

Status.Part

Abstract class to represent An Ongoing activity status or part of it.

Status.StopwatchPart

An Ongoing activity status (or part of it) representing a stopwatch

Status.TextPart

An Ongoing activity status (or part of it) representing a plain, static text.

Status.TimerOrStopwatchPart

Base class for TimerPart and StopwatchPart, defines the getters but can't be created directly, create one of those instead.

Status.TimerPart

An Ongoing activity status (or part of it) representing a timer.

Public constructors

Public methods

static @NonNull Status

Convenience method for creating a Status with no template and a single Part.

@Override long
getNextChangeTimeMillis(long fromTimeMillis)

Returns the next time this status could have a different rendering.

@Nullable Status.Part

Returns the value of the part with the given name.

@NonNull Set<String>
@NonNull List<CharSequence>
@NonNull @Override CharSequence
getText(@NonNull Context context, long timeNowMillis)

Returns a textual representation of this status at the given time.

Public constructors

Status

public final Status()

Public methods

forPart

public static