UserStyleSetting.ListUserStyleSetting.ListOption.Builder


class UserStyleSetting.ListUserStyleSetting.ListOption.Builder


A Builder for ListOption.

Summary

Public constructors

Builder(
    id: UserStyleSetting.Option.Id,
    resources: Resources,
    displayNameResourceId: @StringRes Int,
    screenReaderNameResourceId: @StringRes Int
)

Constructs a builder for ListOption.

Public functions

UserStyleSetting.ListUserStyleSetting.ListOption

Constructs the ListOption.

UserStyleSetting.ListUserStyleSetting.ListOption.Builder

Used to present a hierarchical style in the editor.

UserStyleSetting.ListUserStyleSetting.ListOption.Builder
setIcon(icon: Icon)

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

UserStyleSetting.ListUserStyleSetting.ListOption.Builder
setIcon(iconProvider: () -> Icon?)

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

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
Builder(
    id: UserStyleSetting.Option.Id,
    resources: Resources,
    displayNameResourceId: @StringRes Int,
    screenReaderNameResourceId: @StringRes Int
)

Constructs a builder for ListOption.

Parameters
id: UserStyleSetting.Option.Id

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

screenReaderNameResourceId: @StringRes Int

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 functions

setChildSettings

fun setChildSettings(childSettings: Collection<UserStyleSetting>): UserStyleSetting.ListUserStyleSetting.ListOption.Builder

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
fun setIcon(icon: Icon): UserStyleSetting.ListUserStyleSetting.ListOption.Builder

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
fun setIcon(iconProvider: () -> Icon?): UserStyleSetting.ListUserStyleSetting.ListOption.Builder

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
fun setWatchFaceEditorData(
    watchFaceEditorData: UserStyleSetting.WatchFaceEditorData
): 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.