# UserStyleSchema

Artifact: [androidx.wear.watchface:watchface-style](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/style/CurrentUserStyleRepository.kt+class:androidx.wear.watchface.style.UserStyleSchema) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema "View this page in Java")


```
class UserStyleSchema
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Describes the list of `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting`s the user can configure. Note style schemas can be hierarchical (see `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.Option#childSettings()`), editors should use `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#rootUserStyleSettings()` rather than `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#(kotlin.collections.List)` for populating the top level UI.

use Watch Face Format instead

## Summary

| ### Public constructors |
|---|
| `[UserStyleSchema](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#UserStyleSchema(kotlin.collections.List))(userStyleSettings: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting>)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption?` | `[findComplicationSlotsOptionForUserStyle](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.UserStyle))(userStyle: https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyle)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `operator https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting?` | `[get](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#get(androidx.wear.watchface.style.UserStyleSetting.Id))(settingId: https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.Id)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` | `[getDigestHash](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#getDigestHash())()` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `[toString](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#toString())()` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting>` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#rootUserStyleSettings()` **This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting>` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#userStyleSettings()` **This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Public constructors

### UserStyleSchema

```
[UserStyleSchema](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#UserStyleSchema(kotlin.collections.List))(userStyleSettings: List<UserStyleSetting>)
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

| Parameters |
|---|---|
| `userStyleSettings: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/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 `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.CustomValueUserStyleSetting` in the list. Prior to android T at most one `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting` is allowed, however from android T it's possible with hierarchical styles for there to be more than one, but at most one can be active at any given time. |

## Public functions

### findComplicationSlotsOptionForUserStyle

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
fun [findComplicationSlotsOptionForUserStyle](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.UserStyle))(userStyle: UserStyle): UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption?
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

When a UserStyleSchema contains hierarchical styles, only part of it is deemed to be active based on the user's options in `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.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 `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting`. This function searches the active portion of the UserStyleSchema for the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting`, if one is found then it returns the selected `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption` from that, based on the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.UserStyle)`. If a `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting` is not found in the active portion of the UserStyleSchema it returns `null`.

| Parameters |
|---|---|
| `userStyle: https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyle` | The `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyle` for which the function will search for the selected `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption`, if any. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption?` | The selected `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption` based on the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.UserStyle)` if any, or `null` otherwise. |

### get

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
operator fun [get](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#get(androidx.wear.watchface.style.UserStyleSetting.Id))(settingId: UserStyleSetting.Id): UserStyleSetting?
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Returns the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting` whose `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.Id` matches `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#get(androidx.wear.watchface.style.UserStyleSetting.Id)` or `null` if none match.

### getDigestHash

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
fun [getDigestHash](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#getDigestHash())(): ByteArray
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Computes a SHA-1 `https://developer.android.com/reference/java/security/MessageDigest.html` hash of the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema`. Note that for performance reasons where possible the resource id or url for `https://developer.android.com/reference/android/graphics/drawable/Icon.html`s 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.

### toString

```
open fun [toString](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSchema#toString())(): String
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

## Public properties

### rootUserStyleSettings

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
val rootUserStyleSettings: List<UserStyleSetting>
```

> [!CAUTION]
> **This property is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

For use with hierarchical schemas, lists all the settings with no parent `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.Option`.

### userStyleSettings

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
val userStyleSettings: List<UserStyleSetting>
```

> [!CAUTION]
> **This property is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff