# UserStyle

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.UserStyle) 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 UserStyle implements Map<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option>
```

<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

An immutable representation of user style choices that maps each `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting` to `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option`.

This is intended for use by the WatchFace and entries are the same as the ones specified in the `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema`. This means you can't serialize a UserStyle directly, instead you need to use a `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleData` (see `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#toUserStyleData()`).

To modify the user style, you should call `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#toMutableUserStyle()` and construct a new `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle` instance with `https://developer.android.com/reference/androidx/wear/watchface/style/MutableUserStyle#toUserStyle()`.

use Watch Face Format instead

## Summary

| ### Public constructors |
|---|
| `[UserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#UserStyle(kotlin.collections.Map))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option> selectedOptions )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `[UserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#UserStyle(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. |
| `[UserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#UserStyle(androidx.wear.watchface.style.UserStyleData,androidx.wear.watchface.style.UserStyleSchema))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleData userStyle, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema styleSchema )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `boolean` | `[containsKey](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#containsKey(androidx.wear.watchface.style.UserStyleSetting))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting key)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `boolean` | `[containsValue](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#containsValue(androidx.wear.watchface.style.UserStyleSetting.Option))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option value)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `boolean` | `[equals](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#equals(kotlin.Any))(https://developer.android.com/reference/java/lang/Object.html other)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option` | `[get](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#get(androidx.wear.watchface.style.UserStyleSetting))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting key)` **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.Option` | `[get](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#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. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.Entry.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option>>` | `[getEntries](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getEntries())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting>` | `[getKeys](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getKeys())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `int` | `[getSize](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getSize())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option>` | `[getValues](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getValues())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `int` | `[hashCode](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#hashCode())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `boolean` | `[isEmpty](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#isEmpty())()` **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/androidx/wear/watchface/style/MutableUserStyle` | `[toMutableUserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#toMutableUserStyle())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format 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/UserStyle#toString())()` **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/androidx/wear/watchface/style/UserStyleData` | `[toUserStyleData](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#toUserStyleData())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

### Inherited methods

From [kotlin.collections.Map](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html) `void` `[forEach](https://developer.android.com/reference/java/util/Map.html#forEach(java.util.function.BiConsumer&lt;? super K,? super V&gt;))(
@https://developer.android.com/reference/androidx/annotation/RecentlyNonNull @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/function/BiConsumer.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option> action
)`

**This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option` `@https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-since-kotlin/index.html(version = "1.1")
@kotlin.internal.PlatformDependent
[getOrDefault](https://developer.android.com/reference/java/util/Map.html#getOrDefault(K, V))(
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting key,
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option defaultValue
)`

**This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.

## Public constructors

### UserStyle

```
public [UserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#UserStyle(kotlin.collections.Map))(
    @NonNull Map<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option> selectedOptions
)
```

> [!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

Constructs a `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle` with the given selected options for each setting.

A copy of the `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#(kotlin.collections.Map)` map will be created, so that changed to the map will not be reflected by this object.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option> selectedOptions` | The `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.Option` selected for each `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting` |

### UserStyle

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 [UserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#UserStyle(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

Constructs a copy of the `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle`. It is backed by the same map.

### UserStyle

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 [UserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#UserStyle(androidx.wear.watchface.style.UserStyleData,androidx.wear.watchface.style.UserStyleSchema))(
    @NonNull UserStyleData userStyle,
    @NonNull UserStyleSchema styleSchema
)
```

> [!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

Constructs a `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle` from a `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleData` and the `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema`. Unrecognized style settings will be ignored. Unlisted style settings will be initialized with that setting's default option.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleData userStyle` | The `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle` represented as a `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleData`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema styleSchema` | The `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema` for this UserStyle, describes how we interpret `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#(androidx.wear.watchface.style.UserStyleData,androidx.wear.watchface.style.UserStyleSchema)`. |

## Public methods

### containsKey

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 boolean [containsKey](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#containsKey(androidx.wear.watchface.style.UserStyleSetting))(@NonNull UserStyleSetting key)
```

> [!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

### containsValue

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 boolean [containsValue](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#containsValue(androidx.wear.watchface.style.UserStyleSetting.Option))(@NonNull UserStyleSetting.Option value)
```

> [!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

### equals

```
public boolean [equals](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#equals(kotlin.Any))(Object other)
```

> [!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

### get

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 UserStyleSetting.Option [get](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#get(androidx.wear.watchface.style.UserStyleSetting))(@NonNull UserStyleSetting key)
```

> [!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.Option` for `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#get(androidx.wear.watchface.style.UserStyleSetting)` if there is one or `null` otherwise.

### get

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 UserStyleSetting.Option [get](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#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.Option` for `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#get(androidx.wear.watchface.style.UserStyleSetting.Id)` if there is one or `null` otherwise. Note this is an O(n) operation.

### getEntries

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 @NonNull Set<@NonNull Map.Entry<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option>> [getEntries](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getEntries())()
```

> [!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

### getKeys

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 @NonNull Set<@NonNull UserStyleSetting> [getKeys](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getKeys())()
```

> [!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

### getSize

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 int [getSize](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getSize())()
```

> [!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

The number of entries in the style.

### getValues

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 @NonNull Collection<@NonNull UserStyleSetting.Option> [getValues](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#getValues())()
```

> [!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

### hashCode

```
public int [hashCode](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#hashCode())()
```

> [!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

### isEmpty

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 boolean [isEmpty](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#isEmpty())()
```

> [!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

### toMutableUserStyle

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 @NonNull MutableUserStyle [toMutableUserStyle](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#toMutableUserStyle())()
```

> [!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 a mutable instance initialized with the same mapping.

### toString

```
public @NonNull String [toString](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#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

### toUserStyleData

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 @NonNull UserStyleData [toUserStyleData](https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle#toUserStyleData())()
```

> [!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 style as a `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleData`.