class Stopwatch.Builder


Builder for Stopwatch.

Summary

Public constructors

Builder(stopwatch: Stopwatch)

Constructor for Stopwatch.Builder with all the existing values.

Builder(namespace: String, id: String)

Constructor for Stopwatch.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.

Stopwatch

Builds the Stopwatch.

Thing

Builds a Thing object.

T

Clears the aliases, if any, for the item.

T

Clear all the potential actions for this document.

T
setAccumulatedDurationMillis(accumulatedDurationMillis: Long)

Sets the total duration in milliseconds accumulated by the Stopwatch.

T
setAlternateNames(alternateNames: (Mutable)List<String!>?)

Sets a list of aliases for the item.

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

Sets the point in time that the Stopwatch counts up from.

T
setBaseTimeMillis(
    context: Context,
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long
)

Sets the point in time that the Stopwatch counts up from.

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
setImage(image: String?)

Sets the URL for an image of the item.

T

Sets all the StopwatchLap instances.

T
setName(name: String?)

Sets the name of the item.

T
setPotentialActions(
    newPotentialActions: (Mutable)List<PotentialAction!>?
)

Sets a list of potential actions for this document.

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-alpha06
Builder(stopwatch: Stopwatch)

Constructor for Stopwatch.Builder with all the existing values.

Builder

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

Constructor for Stopwatch.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-alpha06
fun addAlternateName(alternateName: String): T

Adds an alias for the item.

addPotentialAction

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

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

build

Added in 1.1.0-alpha06
fun build(): Stopwatch

Builds the Stopwatch.

build

Added in 1.1.0-alpha06
fun build(): Thing

Builds a Thing object.

clearAlternateNames

Added in 1.1.0-alpha06
fun clearAlternateNames(): T

Clears the aliases, if any, for the item.

clearPotentialActions

Added in 1.1.0-alpha06
fun clearPotentialActions(): T

Clear all the potential actions for this document.

setAccumulatedDurationMillis

Added in 1.1.0-alpha06
fun setAccumulatedDurationMillis(accumulatedDurationMillis: Long): T

Sets the total duration in milliseconds accumulated by the Stopwatch.

setAlternateNames

Added in 1.1.0-alpha06
fun setAlternateNames(alternateNames: (Mutable)List<String!>?): T

Sets a list of aliases for the item.

setBaseTimeMillis

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

Sets the point in time that the Stopwatch counts up from.

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-alpha06
fun setBaseTimeMillis(
    context: Context,
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long
): T

Sets the point in time that the Stopwatch counts up from.

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-alpha06
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-alpha06
fun setDescription(description: String?): T

Sets the description for the item.

setDocumentScore

Added in 1.1.0-alpha06
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-alpha06
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.

setImage

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

Sets the URL for an image of the item.

setLaps

Added in 1.1.0-alpha06
fun setLaps(laps: (Mutable)List<StopwatchLap!>): T

Sets all the StopwatchLap instances.

setName

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

Sets the name of the item.

setPotentialActions

Added in 1.1.0-alpha06
fun setPotentialActions(
    newPotentialActions: (Mutable)List<PotentialAction!>?
): T

Sets a list of potential actions for this document.

setStatus

Added in 1.1.0-alpha06
fun setStatus(status: Int): T

Sets the current status.

Status can be STATUS_UNKNOWN, STATUS_RESET, STATUS_RUNNING, or STATUS_PAUSED.

setUrl

Added in 1.1.0-alpha06
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

mAccumulatedDurationMillis

protected val mAccumulatedDurationMillisLong

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

mId

protected val mIdString!

mImage

protected val mImageString!

mLaps

protected val mLaps: (Mutable)List<StopwatchLap!>!

mName

protected val mNameString!

mNamespace

protected val mNamespaceString!

mPotentialActions

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

mStatus

protected val mStatusInt

mUrl

protected val mUrlString!