UserStyleSchema
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 function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public functions |
|
|---|---|
UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption? |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
operator UserStyleSetting? |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
ByteArray |
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. |
Public properties |
|
|---|---|
List<UserStyleSetting> |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
List<UserStyleSetting> |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors
UserStyleSchema
UserStyleSchema(userStyleSettings: List<UserStyleSetting>)
| Parameters | |
|---|---|
userStyleSettings: List<UserStyleSetting> |
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 functions
findComplicationSlotsOptionForUserStyle
funfindComplicationSlotsOptionForUserStyle(userStyle: UserStyle): UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption?
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 | |
|---|---|
userStyle: UserStyle |
The |
| Returns | |
|---|---|
UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption? |
The selected |
get
operator funget(settingId: UserStyleSetting.Id): UserStyleSetting?
Returns the UserStyleSetting whose UserStyleSetting.Id matches settingId or null if none match.
getDigestHash
fungetDigestHash(): ByteArray
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.
Public properties
rootUserStyleSettings
val rootUserStyleSettings: List<UserStyleSetting>
For use with hierarchical schemas, lists all the settings with no parent Option.