UserStyleSetting.ListUserStyleSetting.ListOption.Builder


public final class UserStyleSetting.ListUserStyleSetting.ListOption.Builder


A Builder for ListOption.

Summary

Public constructors

Builder(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId
)

Constructs a builder for ListOption.

Public methods

final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption

Constructs the ListOption.

final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.Builder

Used to present a hierarchical style in the editor.

final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.Builder

Sets an Icon for use in the companion userStyle selection UI.

final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.Builder
setIcon(@NonNull Function0<Icon> iconProvider)

Sets a provider of an Icon for use in the companion userStyle selection UI.

final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.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
public Builder(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId
)

Constructs a builder for ListOption.

Parameters
@NonNull UserStyleSetting.Option.Id id

Id for the ListOption, 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 ListOption, used in the userStyle selection UI.

@StringRes int screenReaderNameResourceId

String resource id for a human readable name for the ListOption, used by screen readers. This should be more descriptive than displayName. Note prior to android T this is ignored by companion editors.

Public methods

build

Added in 1.3.0-alpha05
public final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption build()

Constructs the ListOption.

setChildSettings

public final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.Builder setChildSettings(
    @NonNull Collection<@NonNull UserStyleSetting> childSettings
)

Used to present a hierarchical style in the editor. Sets the list of child UserStyleSettings, which may be empty. Any child settings must be listed in UserStyleSchema.userStyleSettings.

setIcon

Added in 1.3.0-alpha05
public final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.Builder setIcon(@NonNull Icon icon)

Sets an Icon for use in the companion userStyle selection UI. This gets sent to the companion over bluetooth and should be small (ideally a few kb in size).

setIcon

Added in 1.3.0-alpha05
public final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.Builder setIcon(@NonNull Function0<Icon> iconProvider)

Sets a provider of an Icon for use in the companion userStyle selection UI. This gets lazily evaluated and is sent to the companion over bluetooth and should be small (ideally a few kb in size). Note this is not guaranteed to be called on the calling thread. Note it will be called shortly after watch face initialization completes.

setWatchFaceEditorData

Added in 1.3.0-alpha05
public final @NonNull UserStyleSetting.ListUserStyleSetting.ListOption.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.