UserStyleSetting.ListUserStyleSetting.ListOption


public final class UserStyleSetting.ListUserStyleSetting.ListOption extends UserStyleSetting.Option


Represents choice within a ListUserStyleSetting, these must be enumerated up front.

If childSettings is not empty, then an editor needs to treat this as a node in a hierarchy of editor widgets.

Summary

Nested types

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

Public constructors

ListOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    Icon icon,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

This method is deprecated. Use the Builder instead

ListOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting> childSettings,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

This method is deprecated. Use the Builder instead

ListOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting> childSettings,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

This method is deprecated. Use the Builder instead

Public methods

final @NonNull CharSequence

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

final Icon

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

final CharSequence

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

final UserStyleSetting.WatchFaceEditorData

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

final void
setScreenReaderNameInternal(DisplayText screenReaderNameInternal)

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

Inherited methods

From androidx.wear.watchface.style.UserStyleSetting.Option
boolean
equals(Object other)

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

final @NonNull Collection<@NonNull UserStyleSetting>

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

final @NonNull UserStyleSetting.Option.Id

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

int

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

@NonNull String

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

Public constructors

ListOption

Added in 1.1.0
Deprecated in 1.2.0
public ListOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    Icon icon,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ListOption.

Parameters
@NonNull UserStyleSetting.Option.Id id

The Id of this ListOption, must be unique within the ListUserStyleSetting.

@NonNull Resources resources

The Resources used to load displayNameResourceId.

@StringRes int displayNameResourceId

String resource id for a human readable name for the element, used in the userStyle selection UI. This should be short, ideally < 20 characters. Note if the resource string contains %1$s that will get replaced with the 1-based ordinal (1st, 2nd, 3rd etc...) of the ListOption in the list of ListOptions.

Icon icon

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

UserStyleSetting.WatchFaceEditorData watchFaceEditorData

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.

ListOption

public ListOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting> childSettings,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ListOption.

Parameters
@NonNull UserStyleSetting.Option.Id id

The Id of this ListOption, must be unique within the ListUserStyleSetting.

@NonNull Resources resources

The Resources used to load displayNameResourceId.

@StringRes int displayNameResourceId

String resource id for a human readable name for the element, used in the userStyle selection UI. This should be short, ideally < 20 characters.

Icon icon

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

@NonNull Collection<@NonNull UserStyleSetting> childSettings

The list of child UserStyleSettings, which may be empty. Any child settings must be listed in UserStyleSchema.userStyleSettings.

UserStyleSetting.WatchFaceEditorData watchFaceEditorData

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.

ListOption

public ListOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting> childSettings,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ListOption.

Parameters
@NonNull UserStyleSetting.Option.Id id

The Id of this ListOption, must be unique within the ListUserStyleSetting.

@NonNull Resources resources

The Resources used to load displayNameResourceId.

@StringRes int displayNameResourceId

String resource id for a human readable name for the element, used in the userStyle selection UI. This should be short, ideally < 20 characters. Note if the resource string contains %1$s that will get replaced with the 1-based ordinal (1st, 2nd, 3rd etc...) of the ListOption in the list of ListOptions.

@StringRes int screenReaderNameResourceId

String resource id for a human readable name for the element, used by screen readers. This should be more descriptive than displayNameResourceId. Note if the resource string contains %1$s that will get replaced with the 1-based ordinal (1st, 2nd, 3rd etc...) of the ListOption in the list of ListOptions. Note prior to android T this is ignored by companion editors.

Icon icon

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

@NonNull Collection<@NonNull UserStyleSetting> childSettings

The list of child UserStyleSettings, which may be empty. Any child settings must be listed in UserStyleSchema.userStyleSettings.

UserStyleSetting.WatchFaceEditorData watchFaceEditorData

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 methods

getDisplayName

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull CharSequence getDisplayName()

Localized human readable name for the setting, used in the editor style selection UI. This should be short (ideally < 20 characters).

getIcon

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final Icon getIcon()

Icon for use in the companion style selection UI.

getScreenReaderName

Added in 1.2.0
Deprecated in 1.3.0-alpha06
public final CharSequence getScreenReaderName()

Optional localized human readable name for the setting, used by screen readers. This should be more descriptive than displayName. Note prior to android T this is ignored by companion editors.

getWatchFaceEditorData

Added in 1.1.0
Deprecated in 1.3.0-alpha06
public final UserStyleSetting.WatchFaceEditorData getWatchFaceEditorData()

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.

setScreenReaderNameInternal

public final void setScreenReaderNameInternal(DisplayText screenReaderNameInternal)

Backing field for screenReaderName.