UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption


public final class UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption extends UserStyleSetting.Option


Represents an override to the initial androidx.wear.watchface.ComplicationSlotsManager configuration.

Summary

Public constructors

ComplicationSlotsOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

This method is deprecated. Use a constructor that sets the screenReaderNameResourceId

ComplicationSlotsOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ComplicationSlotsUserStyleSetting with displayName constructed from Resources.

ComplicationSlotsOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId,
    @NonNull Function0<Icon> iconProvider,
    @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ComplicationSlotsUserStyleSetting with a lazily evaluated icon, where displayName is constructed from Resources.

Public methods

final @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay>

Overlays to be applied when this ComplicationSlotsOption is selected.

final @NonNull CharSequence

Localized human readable name for the setting, used in the editor style selection UI.

final Icon

Icon for use in the companion style selection UI.

final CharSequence

Optional localized human readable name for the setting, used by screen readers.

final UserStyleSetting.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.

final void
setScreenReaderNameInternal(DisplayText screenReaderNameInternal)

Backing field for screenReaderName.

Inherited methods

From androidx.wear.watchface.style.UserStyleSetting.Option
boolean
equals(Object other)
final @NonNull Collection<@NonNull UserStyleSetting>

The list of child UserStyleSettings, if any, forming a hierarchy of UserStyleSettings.

final @NonNull UserStyleSetting.Option.Id

Machine readable Id for the style setting.

int
@NonNull String

Public constructors

ComplicationSlotsOption

Added in 1.1.0
Deprecated in 1.2.0
public ComplicationSlotsOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ComplicationSlotsUserStyleSetting with displayName constructed from Resources.

Parameters
@NonNull UserStyleSetting.Option.Id id

Id for the element, must be unique.

@NonNull Resources resources

The Resources from which displayNameResourceId is load.

@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 ComplicationSlotsOption in the list of ComplicationSlotsOptions.

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).

@NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays

Overlays to be applied when this ComplicationSlotsOption is selected. If this is empty then the net result is the initial complication configuration.

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.

ComplicationSlotsOption

Added in 1.2.0
public ComplicationSlotsOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId,
    Icon icon,
    @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ComplicationSlotsUserStyleSetting with displayName constructed from Resources.

Parameters
@NonNull UserStyleSetting.Option.Id id

Id for the element, must be unique.

@NonNull Resources resources

The Resources from which displayNameResourceId is load.

@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 ComplicationSlotsOption in the list of ComplicationSlotsOptions.

@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 ComplicationSlotsOption in the list of ComplicationSlotsOptions. Note prior to android T this is ignored by companion editors.

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).

@NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays

Overlays to be applied when this ComplicationSlotsOption is selected. If this is empty then the net result is the initial complication configuration.

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.

ComplicationSlotsOption

Added in 1.3.0-alpha04
public ComplicationSlotsOption(
    @NonNull UserStyleSetting.Option.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int screenReaderNameResourceId,
    @NonNull Function0<Icon> iconProvider,
    @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ComplicationSlotsUserStyleSetting with a lazily evaluated icon, where displayName is constructed from Resources.

Parameters
@NonNull UserStyleSetting.Option.Id id

Id for the element, must be unique.

@NonNull Resources resources

The Resources from which displayNameResourceId is load.

@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 ComplicationSlotsOption in the list of ComplicationSlotsOptions.

@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 ComplicationSlotsOption in the list of ComplicationSlotsOptions. Note prior to android T this is ignored by companion editors.

@NonNull Function0<Icon> iconProvider

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.

@NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlay> complicationSlotOverlays

Overlays to be applied when this ComplicationSlotsOption is selected. If this is empty then the net result is the initial complication configuration.

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

getComplicationSlotOverlays

Added in 1.0.0
public final @NonNull Collection<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotOverlaygetComplicationSlotOverlays()

Overlays to be applied when this ComplicationSlotsOption is selected. If this is empty then the net result is the initial complication configuration.

getDisplayName

Added in 1.0.0
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
public final Icon getIcon()

Icon for use in the companion style selection UI.

getScreenReaderName

Added in 1.2.0
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
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.