UserStyle
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.
use Watch Face Format instead
Summary
Public constructors |
|---|
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
|
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public functions |
|
|---|---|
open Boolean |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open Boolean |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open operator Boolean |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open operator UserStyleSetting.Option? |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
operator UserStyleSetting.Option? |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open Int |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open Boolean |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
MutableUserStyle |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open String |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
UserStyleData |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public properties |
|
|---|---|
open Set<Map.Entry<UserStyleSetting, UserStyleSetting.Option>> |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open Set<UserStyleSetting> |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open Int |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open Collection<UserStyleSetting.Option> |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Inherited functions |
||||
|---|---|---|---|---|
|
Public constructors
UserStyle
UserStyle(
selectedOptions: Map<UserStyleSetting, UserStyleSetting.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<UserStyleSetting, UserStyleSetting.Option> |
The |
UserStyle
UserStyle(userStyle: UserStyle)
Constructs a copy of the UserStyle. It is backed by the same map.
UserStyle
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 |
styleSchema: UserStyleSchema |
The |
Public functions
containsKey
open funcontainsKey(key: UserStyleSetting): Boolean
containsValue
open funcontainsValue(value: UserStyleSetting.Option): Boolean
get
open operator funget(key: UserStyleSetting): UserStyleSetting.Option?
Returns the UserStyleSetting.Option for key if there is one or null otherwise.
get
operator funget(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.
toMutableUserStyle
funtoMutableUserStyle(): MutableUserStyle
Returns a mutable instance initialized with the same mapping.
toUserStyleData
funtoUserStyleData(): UserStyleData
Returns the style as a UserStyleData.
Public properties
entries
open val entries: Set<Map.Entry<UserStyleSetting, UserStyleSetting.Option>>
size
open val size: Int
The number of entries in the style.
values
open val values: Collection<UserStyleSetting.Option>