UserStyle


public final class UserStyle implements 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 method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

UserStyle(
    @NonNull UserStyleData userStyle,
    @NonNull UserStyleSchema styleSchema
)

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public methods

boolean

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

boolean

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

boolean
equals(Object other)

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

UserStyleSetting.Option

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final UserStyleSetting.Option

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

@NonNull Set<@NonNull Map.Entry<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option>>

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

@NonNull Set<@NonNull UserStyleSetting>

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

int

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

@NonNull Collection<@NonNull UserStyleSetting.Option>

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

int

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

boolean

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final @NonNull MutableUserStyle

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

@NonNull String

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final @NonNull UserStyleData

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Inherited methods

From kotlin.collections.Map
void

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

@NonNull UserStyleSetting.Option
@SinceKotlin(version = "1.1")
@PlatformDependent
getOrDefault(
    @NonNull UserStyleSetting key,
    @NonNull UserStyleSetting.Option defaultValue
)

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public constructors

UserStyle

public UserStyle(
    @NonNull Map<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option> selectedOptions
)

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.

UserStyle

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public UserStyle(@NonNull UserStyle userStyle)

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

UserStyle

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public UserStyle(
    @NonNull UserStyleData userStyle,
    @NonNull UserStyleSchema styleSchema
)

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
@NonNull UserStyleData userStyle

The UserStyle represented as a UserStyleData.

@NonNull UserStyleSchema styleSchema

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

Public methods

containsKey

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public boolean containsKey(@NonNull UserStyleSetting key)

containsValue

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public boolean containsValue(@NonNull UserStyleSetting.Option value)

equals

public boolean equals(Object other)

get

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public UserStyleSetting.Option get(@NonNull UserStyleSetting key)

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

get

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final UserStyleSetting.Option get(@NonNull UserStyleSetting.Id settingId)

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

getEntries

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public @NonNull Set<@NonNull Map.Entry<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option>> getEntries()

getKeys

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public @NonNull Set<@NonNull UserStyleSettinggetKeys()

getSize

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public int getSize()

The number of entries in the style.

getValues

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public @NonNull Collection<@NonNull UserStyleSetting.OptiongetValues()

hashCode

public int hashCode()

isEmpty

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public boolean isEmpty()

toMutableUserStyle

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull MutableUserStyle toMutableUserStyle()

Returns a mutable instance initialized with the same mapping.

toString

public @NonNull String toString()

toUserStyleData

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull UserStyleData toUserStyleData()

Returns the style as a UserStyleData.