UserStyleSetting.CustomValueUserStyleSetting

public final class UserStyleSetting.CustomValueUserStyleSetting extends 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 is permitted in the UserStyleSchema.

Summary

Nested types

UserStyleSetting.CustomValueUserStyleSetting.CustomValueOption

An application specific custom value.

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 constructors

CustomValueUserStyleSetting(
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    @NonNull byte[] defaultValue
)

Constructs a CustomValueUserStyleSetting.

Public methods

@NonNull UserStyleSetting.Option

Translates an option name into an option.

Inherited methods

From class UserStyleSetting
boolean
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 constructors

CustomValueUserStyleSetting

public final CustomValueUserStyleSetting(
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    @NonNull byte[] defaultValue
)

Constructs a CustomValueUserStyleSetting.

Parameters
@NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers

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

@NonNull byte[] defaultValue

The default value ByteArray.

Public methods

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.