UserStyleSetting.ComplicationSlotsUserStyleSetting

public final class UserStyleSetting.ComplicationSlotsUserStyleSetting extends UserStyleSetting


ComplicationSlotsUserStyleSetting is the recommended UserStyleSetting for representing complication slot configuration, options such as the number of active complication slots, their location, etc... The ComplicationSlotsOption class allows you to apply a list of ComplicationSlotOverlays on top of the base config as specified by the androidx.wear.watchface.ComplicationSlot constructor.

The ComplicationsManager listens for style changes with this setting and when a ComplicationSlotsOption is selected the overrides are automatically applied. Note its suggested that the default ComplicationSlotOverlay (the first entry in the list) does not apply any overrides.

From android T multiple ComplicationSlotsUserStyleSetting are allowed in a style hierarchy as long as at most one is active for any permutation of UserStyle. Prior to android T only a single ComplicationSlotsUserStyleSetting was allowed.

Not to be confused with complication data source selection.

Summary

Nested types

Overrides to be applied to the corresponding androidx.wear.watchface.ComplicationSlot's initial config (as specified in it's constructor) when the setting is selected.

Constructs a ComplicationSlotOverlay.Builder.

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

Public constructors

ComplicationSlotsUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    Icon icon,
    @NonNull List<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption> complicationConfig,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    @NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption defaultOption,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ComplicationSlotsUserStyleSetting where ComplicationSlotsUserStyleSetting.displayName and ComplicationSlotsUserStyleSetting.description are specified as resources.

Inherited methods

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

Used by the style configuration UI.

final @NonNull UserStyleSetting.Option

Returns the default for when the user hasn't selected an option.

final int

The default option index, used if nothing has been selected within the options list.

final @NonNull CharSequence

Localized description string displayed under the displayName.

final @NonNull CharSequence

Localized human readable name for the element, used in the userStyle selection UI.

final Icon

Icon for use in the companion editor style selection UI.

final @NonNull UserStyleSetting.Id

Identifier for the element, must be unique.

@NonNull UserStyleSetting.Option

Translates an option name into an option.

final @NonNull List<@NonNull UserStyleSetting.Option>

List of options for this UserStyleSetting.

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.

int
@NonNull String

Public constructors

ComplicationSlotsUserStyleSetting

public ComplicationSlotsUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    Icon icon,
    @NonNull List<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption> complicationConfig,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    @NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption defaultOption,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a ComplicationSlotsUserStyleSetting where ComplicationSlotsUserStyleSetting.displayName and ComplicationSlotsUserStyleSetting.description are specified as resources.

Parameters
@NonNull UserStyleSetting.Id id

Id for the element, must be unique.

@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 element, used in the userStyle selection UI.

@StringRes int descriptionResourceId

String resource id for a human readable description string displayed under the displayName.

Icon icon

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

@NonNull List<@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption> complicationConfig

The configuration for affected complications.

@NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers

Used by the style configuration UI. Describes which watch face rendering layers this style affects, must include WatchFaceLayer.COMPLICATIONS.

@NonNull UserStyleSetting.ComplicationSlotsUserStyleSetting.ComplicationSlotsOption defaultOption

The default option, used when data isn't persisted. Optional parameter which defaults to the first element of complicationConfig.

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.