UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder


class UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder


A Builder for ColorOption.

Summary

Public constructors

Builder(
    id: UserStyleSetting.Option.Id,
    resources: Resources,
    displayNameResourceId: @StringRes Int,
    screenReaderNameResourceId: @StringRes Int,
    colors: @ColorInt List<Int>
)

Constructs a builder for ColorOption.

Public functions

UserStyleSetting.ColorUserStyleSetting.ColorOption

Constructs the ColorOption.

UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder

Sets 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

Builder

Added in 1.3.0-alpha05
Builder(
    id: UserStyleSetting.Option.Id,
    resources: Resources,
    displayNameResourceId: @StringRes Int,
    screenReaderNameResourceId: @StringRes Int,
    colors: @ColorInt List<Int>
)

Constructs a builder for ColorOption.

Parameters
id: UserStyleSetting.Option.Id

Id for the ColorOption, must be unique within the parent ListUserStyleSetting.

resources: Resources

The Resources from which displayNameResourceId and screenReaderNameResourceId are loaded.

displayNameResourceId: @StringRes Int

String resource id for a human readable name for the ColorOption, used in the userStyle selection UI.

screenReaderNameResourceId: @StringRes Int

String resource id for a human readable name for the ColorOption, used by screen readers. This should be more descriptive than displayName.

colors: @ColorInt List<Int>

: Array The colors for this option. The colors should be listed in order of decreasing importance. The number of provided colors must be the same for all ColorOptions in the list. The number of colors specified is up to the user, but 1 or 3 are comon choices.

Public functions

setWatchFaceEditorData

Added in 1.3.0-alpha05
fun setWatchFaceEditorData(
    watchFaceEditorData: UserStyleSetting.WatchFaceEditorData
): UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder

Sets 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.