UserStyleSetting

public class UserStyleSetting

Known direct subclasses
UserStyleSetting.BooleanUserStyleSetting

A BooleanUserStyleSetting represents a setting with a true and a false setting.

UserStyleSetting.ComplicationSlotsUserStyleSetting

ComplicationSlotsUserStyleSetting is the recommended UserStyleSetting for representing complication slot configuration, options such as the number of active complication slots, their location, etc...

UserStyleSetting.CustomValueUserStyleSetting

An application specific style setting.

UserStyleSetting.DoubleRangeUserStyleSetting

A DoubleRangeUserStyleSetting represents a setting with a Double value in the range [minimumValue ..

UserStyleSetting.ListUserStyleSetting

A ListStyleCategory represents a setting with options selected from a List.

UserStyleSetting.LongRangeUserStyleSetting

A LongRangeUserStyleSetting represents a setting with a Long value in the range minimumValue ..


Watch faces often have user configurable styles, the definition of what is a style is left up to the watch face but it typically incorporates a variety of settings such as: color, visual theme for watch hands, font, tick shape, complication slots, audio elements, etc...

A UserStyleSetting represents one of these dimensions. See also UserStyleSchema which defines the list of UserStyleSettings provided by the watch face.

Styling data gets shared with the companion phone to support editors (typically over bluetooth), as a result the size of serialized UserStyleSettings could become an issue if large.

Summary

Nested types

UserStyleSetting.BooleanUserStyleSetting

A BooleanUserStyleSetting represents a setting with a true and a false setting.

UserStyleSetting.BooleanUserStyleSetting.BooleanOption

Represents a true or false option in the BooleanUserStyleSetting.

UserStyleSetting.BooleanUserStyleSetting.BooleanOption.Companion
UserStyleSetting.Companion
UserStyleSetting.ComplicationSlotsUserStyleSetting

ComplicationSlotsUserStyleSetting is the recommended UserStyleSetting for representing complication slot configuration, options such as the number of active complication slots, their location, etc...

UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay

Overrides to be applied to the corresponding androidx.wear.watchface.ComplicationSlot]'s initial config (as specified in it's constructor) when the setting is selected.

UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay.Builder

Constructs a ComplicationSlotOverlay.Builder.

UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption

Represents an override to the initial androidx.wear.watchface.ComplicationSlotsManager configuration.

UserStyleSetting.CustomValueUserStyleSetting

An application specific style setting.

UserStyleSetting.CustomValueUserStyleSetting.CustomValueOption

An application specific custom value.

UserStyleSetting.DoubleRangeUserStyleSetting

A DoubleRangeUserStyleSetting represents a setting with a Double value in the range [minimumValue ..

UserStyleSetting.DoubleRangeUserStyleSetting.DoubleRangeOption

Represents an option as a Double in the range minimumValue ..

UserStyleSetting.Id

Machine readable identifier for UserStyleSettings.

UserStyleSetting.Id.Companion
UserStyleSetting.ListUserStyleSetting

A ListStyleCategory represents a setting with options selected from a List.

UserStyleSetting.ListUserStyleSetting.ListOption

Represents choice within a ListUserStyleSetting, these must be enumerated up front.

UserStyleSetting.LongRangeUserStyleSetting

A LongRangeUserStyleSetting represents a setting with a Long value in the range minimumValue ..

UserStyleSetting.LongRangeUserStyleSetting.LongRangeOption

Represents an option a Long in the range minimumValue ..

UserStyleSetting.Option

Represents a choice within a style setting which can either be an option from the list or a an arbitrary value depending on the nature of the style setting.

UserStyleSetting.Option.Companion
UserStyleSetting.Option.Id

Machine readable identifier for Options.

UserStyleSetting.Option.Id.Companion

Public fields

final @NonNull Collection<@NonNull WatchFaceLayer>

Used by the style configuration UI.

final @NonNull UserStyleSetting.Option

Returns the default for when the user hasn't selected an option.

final int

The default option index, used if nothing has been selected within the options list.

final @NonNull CharSequence

Localized description string displayed under the displayName.

final @NonNull CharSequence

Localized human readable name for the element, used in the userStyle selection UI.

final @Nullable Icon

Icon for use in the style selection UI.

final @NonNull UserStyleSetting.Id

Identifier for the element, must be unique.

final @NonNull List<@NonNull UserStyleSetting.Option>

List of options for this UserStyleSetting.

Public methods

boolean
@NonNull UserStyleSetting.Option

Translates an option name into an option.

int
@NonNull String

Public fields

affectedWatchFaceLayers

@NonNull
public final @NonNull Collection<@NonNull WatchFaceLayeraffectedWatchFaceLayers

Used by the style configuration UI. Describes which rendering layers this style affects.

defaultOption

@NonNull
public final @NonNull UserStyleSetting.Option defaultOption

Returns the default for when the user hasn't selected an option.

defaultOptionIndex

@NonNull
public final int defaultOptionIndex

The default option index, used if nothing has been selected within the options list.

description

@NonNull
public final @NonNull CharSequence description

Localized description string displayed under the displayName.

displayName

@NonNull
public final @NonNull CharSequence displayName

Localized human readable name for the element, used in the userStyle selection UI.

icon

@Nullable
public final @Nullable Icon icon

Icon for use in the style selection UI.

id

@NonNull
public final @NonNull UserStyleSetting.Id id

Identifier for the element, must be unique. Styling data gets shared with the companion (typically via bluetooth) so size is a consideration and short ids are encouraged. There is a maximum length see UserStyleSetting.Id.MAX_LENGTH.

options

@NonNull
public final @NonNull List<@NonNull UserStyleSetting.Optionoptions

List of options for this UserStyleSetting. Depending on the type of UserStyleSetting this may be an exhaustive list, or just examples to populate a ListView in case the UserStyleSetting isn't supported by the UI (e.g. a new WatchFace with an old Companion).

Public methods

equals

@NonNull
public boolean equals(@Nullable Object other)

getOptionForId

@NonNull
public UserStyleSetting.Option getOptionForId(@NonNull UserStyleSetting.Option.Id optionId)

Translates an option name into an option. This will need to be overridden for userStyle categories that can't sensibly be fully enumerated (e.g. a full 24-bit color picker).

Parameters
@NonNull UserStyleSetting.Option.Id optionId

The Option.Id of the option

Returns
UserStyleSetting.Option

An Option corresponding to the name. This could either be one of the options from UserStyleSettings or a newly constructed Option depending on the nature of the UserStyleSetting. If optionName is unrecognized then the default value for the setting should be returned.

hashCode

@NonNull
public int hashCode()

toString

@NonNull
public String toString()