Android 12 Developer Preview is here! Try it out, and give us your feedback!

UserStyleRepository

class UserStyleRepository
kotlin.Any
   ↳ androidx.wear.watchface.style.UserStyleRepository

An in memory storage for user style choices represented as UserStyle, listeners can be registered to observe style changes. The UserStyleRepository is initialized with a UserStyleSchema.

Summary

Nested classes
abstract

A listener for observing UserStyle changes.

Public constructors

An in memory storage for user style choices represented as UserStyle, listeners can be registered to observe style changes.

Public methods
Unit

Adds a UserStyleListener which is called immediately and whenever the style changes.

Unit

Removes a UserStyleListener previously added by addUserStyleListener.

Properties
UserStyleSchema

The UserStyleSchema for this UserStyleRepository which describes the available style categories.

UserStyle

The current UserStyle.

Public constructors

<init>

UserStyleRepository(schema: UserStyleSchema)

An in memory storage for user style choices represented as UserStyle, listeners can be registered to observe style changes. The UserStyleRepository is initialized with a UserStyleSchema.

Public methods

addUserStyleListener

@UiThread fun addUserStyleListener(userStyleListener: UserStyleRepository.UserStyleListener): Unit

Adds a UserStyleListener which is called immediately and whenever the style changes.

removeUserStyleListener

@UiThread fun removeUserStyleListener(userStyleListener: UserStyleRepository.UserStyleListener): Unit

Removes a UserStyleListener previously added by addUserStyleListener.

Properties

schema

val schema: UserStyleSchema

The UserStyleSchema for this UserStyleRepository which describes the available style categories.

userStyle

var userStyle: UserStyle

The current UserStyle. Assigning to this property triggers immediate UserStyleListener callbacks if if any options have changed.