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

UserStyle

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

The users style choices represented as a map of UserStyleSetting to UserStyleSetting.Option.

Summary

Public constructors
<init>(userStyle: UserStyle)

Constructs a UserStyle with a deep copy of the selectedOptions.

<init>(userStyle: Map<String, String>, styleSchema: UserStyleSchema)

Constructs a UserStyle from a Map<String, String> and the UserStyleSchema.

<init>(userStyle: UserStyleWireFormat, styleSchema: UserStyleSchema)

The users style choices represented as a map of UserStyleSetting to UserStyleSetting.Option.

Public methods
operator UserStyleSetting.Option?

Returns the UserStyleSetting.Option for setting if there is one or null otherwise.

Map<String, String>

Returns the style as a Map<String, String>.

String

UserStyleWireFormat

Properties
Map<UserStyleSetting, UserStyleSetting.Option>

Public constructors

<init>

UserStyle(userStyle: UserStyle)

Constructs a UserStyle with a deep copy of the selectedOptions.

<init>

UserStyle(
    userStyle: Map<String, String>,
    styleSchema: UserStyleSchema)

Constructs a UserStyle from a Map<String, String> and the UserStyleSchema. Unrecognized style settings will be ignored. Unlisted style settings will be initialized with that settings default option.

<init>

UserStyle(
    userStyle: UserStyleWireFormat,
    styleSchema: UserStyleSchema)

<init>

UserStyle(selectedOptions: Map<UserStyleSetting, UserStyleSetting.Option>)

The users style choices represented as a map of UserStyleSetting to UserStyleSetting.Option.

Public methods

get

operator fun get(setting: UserStyleSetting): UserStyleSetting.Option?

Returns the UserStyleSetting.Option for setting if there is one or null otherwise.

toMap

fun toMap(): Map<String, String>

Returns the style as a Map<String, String>.

toString

fun toString(): String

toWireFormat

fun toWireFormat(): UserStyleWireFormat

Properties

selectedOptions

val selectedOptions: Map<UserStyleSetting, UserStyleSetting.Option>