# 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)

*** ** * ** ***


```
public final 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/androidx/wear/watchface/style/UserStyleSetting`s the user can configure. Note style schemas can be hierarchical (see `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option#childSettings()`), editors should use `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#rootUserStyleSettings()` rather than `https://developer.android.com/reference/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/androidx/wear/watchface/style/UserStyleSchema#UserStyleSchema(kotlin.collections.List))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting> userStyleSettings )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `final https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption` | `[findComplicationSlotsOptionForUserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.UserStyle))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle userStyle)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting` | `[get](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#get(androidx.wear.watchface.style.UserStyleSetting.Id))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Id settingId)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull byte[]` | `[getDigestHash](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#getDigestHash())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting>` | `[getRootUserStyleSettings](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#getRootUserStyleSettings())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting>` | `[getUserStyleSettings](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#getUserStyleSettings())()` **This method is deprecated.** use rootUserStyleSettings instead |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `[toString](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#toString())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Public constructors

### UserStyleSchema

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

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/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 `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.CustomValueUserStyleSetting` in the list. Prior to android T at most one `https://developer.android.com/reference/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 methods

### 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)

```
public final UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption [findComplicationSlotsOptionForUserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.UserStyle))(@NonNull UserStyle userStyle)
```

> [!CAUTION]
> **This method 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/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/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting`. This function searches the active portion of the UserStyleSchema for the `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting`, if one is found then it returns the selected `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption` from that, based on the `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#findComplicationSlotsOptionForUserStyle(androidx.wear.watchface.style.UserStyle)`. If a `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting` is not found in the active portion of the UserStyleSchema it returns `null`.

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

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption` | The selected `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption` based on the `https://developer.android.com/reference/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)

```
public final UserStyleSetting [get](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#get(androidx.wear.watchface.style.UserStyleSetting.Id))(@NonNull UserStyleSetting.Id settingId)
```

> [!CAUTION]
> **This method 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/androidx/wear/watchface/style/UserStyleSetting` whose `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Id` matches `https://developer.android.com/reference/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)

```
public final @NonNull byte[] [getDigestHash](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#getDigestHash())()
```

> [!CAUTION]
> **This method 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/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.

### getRootUserStyleSettings

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)

```
public final @NonNull List<@NonNull UserStyleSetting> [getRootUserStyleSettings](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#getRootUserStyleSettings())()
```

> [!CAUTION]
> **This method 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/androidx/wear/watchface/style/UserStyleSetting.Option`.

### getUserStyleSettings

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)

```
public final @NonNull List<@NonNull UserStyleSetting> [getUserStyleSettings](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#getUserStyleSettings())()
```

> [!CAUTION]
> **This method is deprecated.**   
> use rootUserStyleSettings instead

### toString

```
public @NonNull String [toString](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema#toString())()
```

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