UserStyleSetting.ListUserStyleSetting.Builder


public final class UserStyleSetting.ListUserStyleSetting.Builder


A Builder for ListUserStyleSetting.

Summary

Public constructors

Builder(
    @NonNull UserStyleSetting.Id id,
    @NonNull List<@NonNull UserStyleSetting.ListUserStyleSetting.ListOption> options,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId
)

Constructs a builder for ListUserStyleSetting.

Public methods

final @NonNull UserStyleSetting.ListUserStyleSetting

Constructs the ListUserStyleSetting.

final @NonNull UserStyleSetting.ListUserStyleSetting.Builder

Sets the default option.

final @NonNull UserStyleSetting.ListUserStyleSetting.Builder

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

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

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

final @NonNull UserStyleSetting.ListUserStyleSetting.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

public Builder(
    @NonNull UserStyleSetting.Id id,
    @NonNull List<@NonNull UserStyleSetting.ListUserStyleSetting.ListOption> options,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId
)

Constructs a builder for ListUserStyleSetting.

Parameters
@NonNull UserStyleSetting.Id id

Id for the ListUserStyleSetting, must be unique.

@NonNull List<@NonNull UserStyleSetting.ListUserStyleSetting.ListOption> options

: List,

@NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers

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

@NonNull Resources resources

The Resources from which displayNameResourceId and descriptionResourceId are loaded.

@StringRes int displayNameResourceId

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

@StringRes int descriptionResourceId

String resource id for a human readable description string displayed under the displayName in the userStyle selection UI.

Public methods

build

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

Constructs the ListUserStyleSetting.

setDefaultOption

Added in 1.3.0-alpha05
public final @NonNull UserStyleSetting.ListUserStyleSetting.Builder setDefaultOption(
    @NonNull UserStyleSetting.ListUserStyleSetting.ListOption defaultOption
)

Sets the default option. If not specified, the default will be the first element of options.

Parameters
@NonNull UserStyleSetting.ListUserStyleSetting.ListOption defaultOption

The default option, used when data isn't persisted.

setIcon

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