class Timer.Builder


Builder for Timer.

Summary

Public constructors

Builder(timer: Timer)

Constructor for Timer.Builder with all the existing values.

Builder(namespace: String, id: String)

Constructor for Timer.Builder.

Public functions

T
addAlternateName(alternateName: String)

Adds an alias for the item.

T
addPotentialAction(newPotentialAction: PotentialAction)

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

Timer

Builds the Timer.

Thing

Builds a Thing object.

T

Clears the aliases, if any, for the item.

T

Clear all the potential actions for this document.

T
setBaseTimeMillis(
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long,
    bootCount: Int
)

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

T
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
setBaseTimeMillis(
    context: Context,
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long
)

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

T
setCreationTimestampMillis(creationTimestampMillis: Long)

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

T
setDescription(description: String?)

Sets the description for the item.

T
setDocumentScore(documentScore: Int)

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

T
setDocumentTtlMillis(documentTtlMillis: Long)

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

T
setDurationMillis(durationMillis: Long)

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

T
setImage(image: String?)

Sets the URL for an image of the item.

T
setName(name: String?)

Sets the name of the item.

T
setOriginalDurationMillis(originalDurationMillis: Long)

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

T
setRemainingDurationMillis(remainingDurationMillis: Long)

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

T
setRingtone(ringtone: String?)

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

T
setShouldVibrate(shouldVibrate: Boolean)

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

T
setStartTimeMillis(startTimeMillis: Long)

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

T
setStatus(status: Int)

Sets the current status.

T
setUrl(url: String?)

Sets the deeplink URL of the item.

Public constructors

Builder

Added in 1.1.0-alpha04
Builder(timer: Timer)

Constructor for Timer.Builder with all the existing values.

Builder

Added in 1.1.0-alpha04
Builder(namespace: String, id: String)

Constructor for Timer.Builder.

Parameters
namespace: String

Namespace for the Document. See Document.Namespace.

id: String

Unique identifier for the Document. See Document.Id.

Public functions

addAlternateName

Added in 1.1.0-alpha04
fun addAlternateName(alternateName: String): T

Adds an alias for the item.

addPotentialAction

Added in 1.1.0-alpha04
fun addPotentialAction(newPotentialAction: PotentialAction): T

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

build

Added in 1.1.0-alpha04
fun build(): Timer

Builds the Timer.

build

Added in 1.1.0-alpha04
fun build(): Thing

Builds a Thing object.

clearAlternateNames

Added in 1.1.0-alpha04
fun clearAlternateNames(): T

Clears the aliases, if any, for the item.

clearPotentialActions

Added in 1.1.0-alpha04
fun clearPotentialActions(): T

Clear all the potential actions for this document.

setBaseTimeMillis

Added in 1.1.0-alpha04
fun setBaseTimeMillis(
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long,
    bootCount: Int
): T

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
baseTimeMillis: Long

The base time in milliseconds using the currentTimeMillis time base.

baseTimeMillisInElapsedRealtime: Long

The base time in milliseconds using the elapsedRealtime time base.

bootCount: Int

The current boot count of the device. See BOOT_COUNT.

setBaseTimeMillis

Added in 1.1.0-alpha04
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
fun setBaseTimeMillis(
    context: Context,
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long
): T

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
context: Context

The app context used to fetch boot count.

baseTimeMillis: Long

The base time in milliseconds using the currentTimeMillis time base.

baseTimeMillisInElapsedRealtime: Long

The base time in milliseconds using the elapsedRealtime time base.

setCreationTimestampMillis

Added in 1.1.0-alpha04
fun setCreationTimestampMillis(creationTimestampMillis: Long): T

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

This timestamp refers to the creation time of the AppSearch entity, not when the document is written into AppSearch.

If not set, then the current timestamp will be used.

See androidx.appsearch.annotation.Document.CreationTimestampMillis for more information on creation timestamp.

setDescription

Added in 1.1.0-alpha04
fun setDescription(description: String?): T

Sets the description for the item.

setDocumentScore

Added in 1.1.0-alpha04
fun setDocumentScore(documentScore: Int): T

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

See androidx.appsearch.annotation.Document.Score for more information on score.

setDocumentTtlMillis

Added in 1.1.0-alpha04
fun setDocumentTtlMillis(documentTtlMillis: Long): T

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

The document will be automatically deleted when the TTL expires.

If not set, then the document will never expire.

See androidx.appsearch.annotation.Document.TtlMillis for more information on TTL.

setDurationMillis

Added in 1.1.0-alpha04
fun setDurationMillis(durationMillis: Long): T

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

setImage

Added in 1.1.0-alpha04
fun setImage(image: String?): T

Sets the URL for an image of the item.

setName

Added in 1.1.0-alpha04
fun setName(name: String?): T

Sets the name of the item.

setOriginalDurationMillis

Added in 1.1.0-alpha04
fun setOriginalDurationMillis(originalDurationMillis: Long): T

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

setRemainingDurationMillis

Added in 1.1.0-alpha04
fun setRemainingDurationMillis(remainingDurationMillis: Long): T

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.1.0-alpha04
fun setRingtone(ringtone: String?): T

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

setShouldVibrate

Added in 1.1.0-alpha04
fun setShouldVibrate(shouldVibrate: Boolean): T

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

setStartTimeMillis

Added in 1.1.0-alpha04
fun setStartTimeMillis(startTimeMillis: Long): T

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.1.0-alpha04
fun setStatus(status: Int): T

Sets the current status.

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

setUrl

Added in 1.1.0-alpha04
fun setUrl(url: String?): T

Sets the deeplink URL of the item.

If this item can be displayed by any system UI surface, or can be read by another Android package, through one of the androidx.appsearch.app.SetSchemaRequest.Builder methods, this url should act as a deeplink into the activity that can open it. Callers should be able to construct an ACTION_VIEW intent with the url as the setData to view the item inside your application.

See Allowing Other Apps to Start Your Activity for more details on how to make activities in your app open for use by other apps by defining intent filters.

Protected properties

mAlternateNames

protected val mAlternateNames: (Mutable)List<String!>!

mBaseTimeMillis

protected val mBaseTimeMillisLong

mBaseTimeMillisInElapsedRealtime

protected val mBaseTimeMillisInElapsedRealtimeLong

mBootCount

protected val mBootCountInt

mCreationTimestampMillis

protected val mCreationTimestampMillisLong

mDescription

protected val mDescriptionString!

mDocumentScore

protected val mDocumentScoreInt

mDocumentTtlMillis

protected val mDocumentTtlMillisLong

mDurationMillis

protected val mDurationMillisLong

mId

protected val mIdString!

mImage

protected val mImageString!

mName

protected val mNameString!

mNamespace

protected val mNamespaceString!

mOriginalDurationMillis

protected val mOriginalDurationMillisLong

mPotentialActions

protected val mPotentialActions: (Mutable)List<PotentialAction!>!

mRemainingDurationMillis

protected val mRemainingDurationMillisLong

mRingtone

protected val mRingtoneString!

mShouldVibrate

protected val mShouldVibrateBoolean

mStartTimeMillis

protected val mStartTimeMillisLong

mStatus

protected val mStatusInt

mUrl

protected val mUrlString!