UserStyle

public final class UserStyle


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

UserStyle(UserStyle userStyle)

Constructs a copy of the UserStyle.

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

UserStyle(UserStyleData userStyle, UserStyleSchema styleSchema)

Constructs a UserStyle from a UserStyleData and the UserStyleSchema.

Public methods

boolean
boolean
boolean
equals(Object other)
UserStyleSetting.Option

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

final UserStyleSetting.Option

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

int
boolean
final @NonNull MutableUserStyle

Returns a mutable instance initialized with the same mapping.

@NonNull String
final @NonNull UserStyleData

Returns the style as a UserStyleData.

Inherited methods

From class Map

Public fields

size

public int size

The number of entries in the style.

Public constructors

UserStyle

public final UserStyle(UserStyle userStyle)

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

UserStyle

public final UserStyle(
    Map<UserStyleSettingUserStyleSetting.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

public final UserStyle(UserStyleData userStyle, 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
UserStyleData userStyle

The UserStyle represented as a UserStyleData.