UserStyleSetting.CustomValueUserStyleSetting

class UserStyleSetting.CustomValueUserStyleSetting : UserStyleSetting


An application specific style setting. This style is ignored by the system editor. This is expected to be used in conjunction with an on watch face editor. Only a single ComplicationSlotsUserStyleSetting or LargeCustomValueUserStyleSetting is permitted in the UserStyleSchema.

The CustomValueOption can store at most Option.Id.MAX_LENGTH bytes. If you need more storage, consider using LargeCustomValueUserStyleSetting.

Summary

Nested types

An application specific custom value.

Public constructors

CustomValueUserStyleSetting(
    affectsWatchFaceLayers: Collection<WatchFaceLayer>,
    defaultValue: ByteArray
)

Constructs a CustomValueUserStyleSetting.

Public functions

open UserStyleSetting.Option

Translates an option name into an option.

Inherited functions

From androidx.wear.watchface.style.UserStyleSetting
open operator Boolean
equals(other: Any?)
open Int
open String

Inherited properties

From androidx.wear.watchface.style.UserStyleSetting
Collection<WatchFaceLayer>

Used by the style configuration UI.

UserStyleSetting.Option

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

Int

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

CharSequence

Localized description string displayed under the displayName.

CharSequence

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

Icon?

Icon for use in the companion editor style selection UI.

UserStyleSetting.Id

Identifier for the element, must be unique.

List<UserStyleSetting.Option>

List of options for this UserStyleSetting.

UserStyleSetting.WatchFaceEditorData?

Optional data for an on watch face editor, this will not be sent to the companion and its contents may be used in preference to other fields by an on watch face editor.

Public constructors

CustomValueUserStyleSetting

CustomValueUserStyleSetting(
    affectsWatchFaceLayers: Collection<WatchFaceLayer>,
    defaultValue: ByteArray
)

Constructs a CustomValueUserStyleSetting.

Parameters
affectsWatchFaceLayers: Collection<WatchFaceLayer>

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

defaultValue: ByteArray

The default value ByteArray.

Public functions

getOptionForId

open fun getOptionForId(optionId: UserStyleSetting.Option.Id): UserStyleSetting.Option

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
optionId: UserStyleSetting.Option.Id

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.