UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder


public final class UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder


A Builder for ColorOption.

Summary

Public constructors

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

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

Public methods

final @NonNull UserStyleSetting.ColorUserStyleSetting.ColorOption

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

final @NonNull UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder

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

Public constructors

Builder

Added in 1.3.0-alpha06
Deprecated in 1.3.0-alpha06
public Builder(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId,
    @ColorInt @NonNull List<@NonNull Integer> colors
)

Constructs a builder for ColorOption.

Parameters
@NonNull UserStyleSetting.Option.Id id

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

@NonNull Resources resources

The Resources from which displayNameResourceId and screenReaderNameResourceId are loaded.

@StringRes int displayNameResourceId

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

@StringRes int screenReaderNameResourceId

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

@ColorInt @NonNull List<@NonNull Integer> colors

: 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 methods

build

Added in 1.3.0-alpha06
Deprecated in 1.3.0-alpha06
public final @NonNull UserStyleSetting.ColorUserStyleSetting.ColorOption build()

Constructs the ColorOption.

setWatchFaceEditorData

Added in 1.3.0-alpha06
Deprecated in 1.3.0-alpha06
public final @NonNull UserStyleSetting.ColorUserStyleSetting.ColorOption.Builder setWatchFaceEditorData(
    @NonNull UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

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.