UserStyleSchema
public final class UserStyleSchema
Describes the list of UserStyleSettings the user can configure. Note style schemas can be hierarchical (see UserStyleSetting.Option.childSettings), editors should use rootUserStyleSettings rather than userStyleSettings for populating the top level UI.
use Watch Face Format instead
Summary
Public constructors |
|---|
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public methods |
|
|---|---|
final UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final UserStyleSetting |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull byte[] |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull List<@NonNull UserStyleSetting> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull List<@NonNull UserStyleSetting> |
This method is deprecated. use rootUserStyleSettings instead |
@NonNull String |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors
UserStyleSchema
publicUserStyleSchema(
@NonNull List<@NonNull UserStyleSetting> userStyleSettings
)
| Parameters | |
|---|---|
@NonNull List<@NonNull UserStyleSetting> userStyleSettings |
The user configurable style categories associated with this watch face. Empty if the watch face doesn't support user styling. Note we allow at most one |
Public methods
findComplicationSlotsOptionForUserStyle
public final UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOptionfindComplicationSlotsOptionForUserStyle(@NonNull UserStyle userStyle)
When a UserStyleSchema contains hierarchical styles, only part of it is deemed to be active based on the user’s options in userStyle. Conversely if the UserStyleSchema doesn’t contain any hierarchical styles then all of it is considered to be active all the time.
From the active portion of the UserStyleSchema we only allow there to be at most one UserStyleSetting.ComplicationSlotsUserStyleSetting. This function searches the active portion of the UserStyleSchema for the UserStyleSetting.ComplicationSlotsUserStyleSetting, if one is found then it returns the selected ComplicationSlotsOption from that, based on the userStyle. If a UserStyleSetting.ComplicationSlotsUserStyleSetting is not found in the active portion of the UserStyleSchema it returns null.
| Parameters | |
|---|---|
@NonNull UserStyle userStyle |
The |
| Returns | |
|---|---|
UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption |
The selected |
get
public final UserStyleSettingget(@NonNull UserStyleSetting.Id settingId)
Returns the UserStyleSetting whose UserStyleSetting.Id matches settingId or null if none match.
getDigestHash
public final @NonNull byte[]getDigestHash()
Computes a SHA-1 MessageDigest hash of the UserStyleSchema. Note that for performance reasons where possible the resource id or url for Icons in the schema are used rather than the image bytes. This means that this hash should be considered insensitive to changes to the contents of icons between APK versions, which the developer should account for accordingly.
getRootUserStyleSettings
public final @NonNull List<@NonNull UserStyleSetting>getRootUserStyleSettings()
For use with hierarchical schemas, lists all the settings with no parent Option.