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. |
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 |
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 |
||||
|---|---|---|---|---|
|
Public constructors
UserStyle
publicUserStyle(
@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.
| Parameters | |
|---|---|
@NonNull Map<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option> selectedOptions |
The |
UserStyle
publicUserStyle(@NonNull UserStyle userStyle)
Constructs a copy of the UserStyle. It is backed by the same map.
UserStyle
publicUserStyle(
@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 |
@NonNull UserStyleSchema styleSchema |
The |
Public methods
containsKey
public booleancontainsKey(@NonNull UserStyleSetting key)
containsValue
public booleancontainsValue(@NonNull UserStyleSetting.Option value)
get
public UserStyleSetting.Optionget(@NonNull UserStyleSetting key)
Returns the UserStyleSetting.Option for key if there is one or null otherwise.
get
public final UserStyleSetting.Optionget(@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
public @NonNull Set<@NonNull Map.Entry<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option>>getEntries()
getKeys
public @NonNull Set<@NonNull UserStyleSetting>getKeys()
getSize
public int getSize()The number of entries in the style.
getValues
public @NonNull Collection<@NonNull UserStyleSetting.Option>getValues()
toMutableUserStyle
public final @NonNull MutableUserStyletoMutableUserStyle()
Returns a mutable instance initialized with the same mapping.
toUserStyleData
public final @NonNull UserStyleDatatoUserStyleData()
Returns the style as a UserStyleData.