@ExperimentalAppSearchApi
public class Timer.BuilderBase<T extends Timer.BuilderBase<T>> extends Thing.BuilderBase

Known direct subclasses
Timer.Builder

Builder for Timer.


Summary

Public constructors

Constructor for Timer.BuilderBase with all the existing values.

Constructor for Timer.BuilderBase.

Public methods

@NonNull Timer

Builds the Timer.

@NonNull T
setBaseTimeMillis(long baseTimeMillis)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis.

@NonNull T
setBaseTimeMillis(
    long baseTimeMillis,
    long baseTimeMillisInElapsedRealtime,
    int bootCount
)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis.

@NonNull T
setBaseTimeMillis(
    @NonNull Context context,
    long baseTimeMillis,
    long baseTimeMillisInElapsedRealtime
)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis.

@NonNull T
setBaseTimeMillisInElapsedRealtime(
    long baseTimeMillisInElapsedRealtime
)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis.

@NonNull T
setBootCount(int bootCount)

Sets the boot count of the device.

@NonNull T
setDurationMillis(long durationMillis)

Sets the total duration in milliseconds, including additional time added by the user.

@NonNull T
setOriginalDurationMillis(long originalDurationMillis)

Sets the original duration in milliseconds when the Timer was first created.

@NonNull T
setRemainingDurationMillis(long remainingDurationMillis)

Sets the amount of time remaining in milliseconds for the Timer relative to its setBaseTimeMillis.

@NonNull T

Sets the content URI for the ringtone to be played, or VALUE_RINGTONE_SILENT if no ringtone will be played.

@NonNull T
setShouldVibrate(boolean shouldVibrate)

Sets whether or not to activate the device vibrator when the Timer expires.

@NonNull T
setStartTimeMillis(long startTimeMillis)

Sets the start time in milliseconds using the currentTimeMillis time base.

@NonNull T
setStatus(int status)

Sets the current status.

Inherited methods

From androidx.appsearch.builtintypes.Thing.BuilderBase
@NonNull T

Adds an alias for the item.

@NonNull T

Add a new action to the list of potential actions for this document.

@NonNull T

Clears the aliases, if any, for the item.

@NonNull T

Clear all the potential actions for this document.

void

If built, make a copy of previous data for every field so that the builder can be reused.

@NonNull T

Sets a list of aliases for the item.

@NonNull T
setCreationTimestampMillis(long creationTimestampMillis)

Sets the creation timestamp for the current AppSearch entity, in milliseconds using the currentTimeMillis time base.

@NonNull T

Sets the description for the item.

@NonNull T
setDocumentScore(int documentScore)

Sets the user-provided opaque document score of the current AppSearch document, which can be used for ranking using RANKING_STRATEGY_DOCUMENT_SCORE.

@NonNull T
setDocumentTtlMillis(long documentTtlMillis)

Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds.

@NonNull T

Sets the URL for an image of the item.

@NonNull T

Sets the name of the item.

@NonNull T

Sets a list of potential actions for this document.

@NonNull T

Sets the deeplink URL of the item.

Public constructors

BuilderBase

Added in 1.2.0-alpha02
public BuilderBase(@NonNull Timer timer)

Constructor for Timer.BuilderBase with all the existing values.

Parameters
@NonNull Timer timer

The existing Timer to copy values from.

BuilderBase

public BuilderBase(@NonNull String namespace, @NonNull String id)

Constructor for Timer.BuilderBase.

Parameters
@NonNull String namespace

Namespace for the Document. See Document.Namespace.

@NonNull String id

Unique identifier for the Document. See Document.Id.

Public methods

build

public @NonNull Timer build()

Builds the Timer.

setBaseTimeMillis

Added in 1.2.0-alpha02
public @NonNullsetBaseTimeMillis(long baseTimeMillis)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis. In milliseconds using the currentTimeMillis time base.

setBaseTimeMillis

Added in 1.2.0-alpha02
public @NonNullsetBaseTimeMillis(
    long baseTimeMillis,
    long baseTimeMillisInElapsedRealtime,
    int bootCount
)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis.

The expire time of the Timer can be calculated using the sum of its base time and remaining time.

Base time should be sampled in both the currentTimeMillis and elapsedRealtime time base. In addition, the boot count of the device is needed to check if the elapsedRealtime time base is valid.

Parameters
long baseTimeMillis

The base time in milliseconds using the currentTimeMillis time base.

long baseTimeMillisInElapsedRealtime

The base time in milliseconds using the elapsedRealtime time base.

int bootCount

The current boot count of the device. See BOOT_COUNT.

setBaseTimeMillis

Added in 1.2.0-alpha02
public @NonNullsetBaseTimeMillis(
    @NonNull Context context,
    long baseTimeMillis,
    long baseTimeMillisInElapsedRealtime
)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis.

The expire time of the Timer can be calculated using the sum of its base time and remaining time.

See setBaseTimeMillis.

Parameters
@NonNull Context context

The app context used to fetch boot count.

long baseTimeMillis

The base time in milliseconds using the currentTimeMillis time base.

long baseTimeMillisInElapsedRealtime

The base time in milliseconds using the elapsedRealtime time base.

setBaseTimeMillisInElapsedRealtime

Added in 1.2.0-alpha02
public @NonNullsetBaseTimeMillisInElapsedRealtime(
    long baseTimeMillisInElapsedRealtime
)

Sets the point in time that the Timer counts down from, relative to its setRemainingDurationMillis. In milliseconds using the elapsedRealtime time base.

setBootCount

Added in 1.2.0-alpha02
public @NonNullsetBootCount(int bootCount)

Sets the boot count of the device.

setDurationMillis

Added in 1.2.0-alpha02
public @NonNullsetDurationMillis(long durationMillis)

Sets the total duration in milliseconds, including additional time added by the user.

setOriginalDurationMillis

Added in 1.2.0-alpha02
public @NonNullsetOriginalDurationMillis(long originalDurationMillis)

Sets the original duration in milliseconds when the Timer was first created.

setRemainingDurationMillis

Added in 1.2.0-alpha02
public @NonNullsetRemainingDurationMillis(long remainingDurationMillis)

Sets the amount of time remaining in milliseconds for the Timer relative to its setBaseTimeMillis.

The expire time of the Timer can be calculated using the sum of its base time and remaining time.

setRingtone

Added in 1.2.0-alpha02
public @NonNullsetRingtone(@Nullable String ringtone)

Sets the content URI for the ringtone to be played, or VALUE_RINGTONE_SILENT if no ringtone will be played.

setShouldVibrate

Added in 1.2.0-alpha02
public @NonNullsetShouldVibrate(boolean shouldVibrate)

Sets whether or not to activate the device vibrator when the Timer expires.

setStartTimeMillis

Added in 1.2.0-alpha02
public @NonNullsetStartTimeMillis(long startTimeMillis)

Sets the start time in milliseconds using the currentTimeMillis time base.

The start time is the first time that a new Timer, or a Timer that has been reset is started. Pausing and resuming should not change its start time.

setStatus

Added in 1.2.0-alpha02
public @NonNullsetStatus(int status)

Sets the current status.

Status can be STATUS_UNKNOWN, STATUS_STARTED, STATUS_PAUSED, STATUS_EXPIRED, STATUS_MISSED, or STATUS_RESET.