class UserStyle : Map


An immutable representation of user style choices that maps each UserStyleSetting to UserStyleSetting.Option.

This is intended for use by the WatchFace and entries are the same as the ones specified in the UserStyleSchema. This means you can't serialize a UserStyle directly, instead you need to use a UserStyleData (see toUserStyleData).

To modify the user style, you should call toMutableUserStyle and construct a new UserStyle instance with MutableUserStyle.toUserStyle.

Summary

Public constructors

Constructs a UserStyle with the given selected options for each setting.

UserStyle(userStyle: UserStyle)

Constructs a copy of the UserStyle.

UserStyle(userStyle: UserStyleData, styleSchema: UserStyleSchema)

Constructs a UserStyle from a UserStyleData and the UserStyleSchema.

Public functions

open Boolean
open Boolean
open operator Boolean
equals(other: Any?)
open operator UserStyleSetting.Option?

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

operator UserStyleSetting.Option?

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

open Int
open Boolean
MutableUserStyle

Returns a mutable instance initialized with the same mapping.

open String
UserStyleData

Returns the style as a UserStyleData.

Public properties

open Set<Map.Entry<UserStyleSettingUserStyleSetting.Option>>
open Set<UserStyleSetting>
open Int

The number of entries in the style.

open Collection<UserStyleSetting.Option>

Public constructors

UserStyle

UserStyle(
    selectedOptions: Map<UserStyleSettingUserStyleSetting.Option>
)

Constructs a UserStyle with the given selected options for each setting.

A copy of the selectedOptions map will be created, so that changed to the map will not be reflected by this object.

Parameters
selectedOptions: Map<UserStyleSettingUserStyleSetting.Option>

The UserStyleSetting.Option selected for each UserStyleSetting

UserStyle

Added in 1.0.0
UserStyle(userStyle: UserStyle)

Constructs a copy of the UserStyle. It is backed by the same map.

UserStyle

Added in 1.0.0
UserStyle(userStyle: UserStyleData, styleSchema: UserStyleSchema)

Constructs a UserStyle from a UserStyleData and the UserStyleSchema. Unrecognized style settings will be ignored. Unlisted style settings will be initialized with that setting's default option.

Parameters
userStyle: UserStyleData

The UserStyle represented as a UserStyleData.

styleSchema: UserStyleSchema

The UserStyleSchema for this UserStyle, describes how we interpret userStyle.

Public functions

containsKey

Added in 1.0.0
open fun containsKey(key: UserStyleSetting): Boolean

containsValue

Added in 1.0.0
open fun containsValue(value: UserStyleSetting.Option): Boolean

equals

open operator fun equals(other: Any?): Boolean

get

Added in 1.0.0
open operator fun get(key: UserStyleSetting): UserStyleSetting.Option?

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

get

Added in 1.0.0
operator fun get(settingId: UserStyleSetting.Id): UserStyleSetting.Option?

Returns the UserStyleSetting.Option for settingId if there is one or null otherwise. Note this is an O(n) operation.

hashCode

open fun hashCode(): Int

isEmpty

Added in 1.0.0
open fun isEmpty(): Boolean

toMutableUserStyle

Added in 1.0.0
fun toMutableUserStyle(): MutableUserStyle

Returns a mutable instance initialized with the same mapping.

toString

open fun toString(): String

toUserStyleData

Added in 1.0.0
fun toUserStyleData(): UserStyleData

Returns the style as a UserStyleData.

Public properties

keys

Added in 1.0.0
open val keysSet<UserStyleSetting>

size

Added in 1.0.0
open val sizeInt

The number of entries in the style.

values

Added in 1.0.0
open val valuesCollection<UserStyleSetting.Option>