UserStyleSetting.LongRangeUserStyleSetting


public final class UserStyleSetting.LongRangeUserStyleSetting extends UserStyleSetting


A LongRangeUserStyleSetting represents a setting with a Long value in the range minimumValue .. maximumValue.

Summary

Nested types

Represents an option a Long in the range minimumValue .. maximumValue.

Public constructors

LongRangeUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    Icon icon,
    long minimumValue,
    long maximumValue,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    long defaultValue,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

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

LongRangeUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    @NonNull Function0<Icon> iconProvider,
    long minimumValue,
    long maximumValue,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    long defaultValue,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a LongRangeUserStyleSetting where LongRangeUserStyleSetting.displayName and LongRangeUserStyleSetting.description are specified as resources, with a lazily constructed icon.

Public methods

final long

The default value.

final long

The maximum value.

final long

The minimum value.

@NonNull UserStyleSetting.Option

We support all values in the range min ... max not just min & max.

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.

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

LongRangeUserStyleSetting

public LongRangeUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    Icon icon,
    long minimumValue,
    long maximumValue,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    long defaultValue,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a LongRangeUserStyleSetting where LongRangeUserStyleSetting.displayName and LongRangeUserStyleSetting.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).

long minimumValue

Minimum value (inclusive).

long maximumValue

Maximum value (inclusive).

@NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers

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

long defaultValue

The default value for this LongRangeUserStyleSetting.

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.

LongRangeUserStyleSetting

public LongRangeUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    @NonNull Function0<Icon> iconProvider,
    long minimumValue,
    long maximumValue,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    long defaultValue,
    UserStyleSetting.WatchFaceEditorData watchFaceEditorData
)

Constructs a LongRangeUserStyleSetting where LongRangeUserStyleSetting.displayName and LongRangeUserStyleSetting.description are specified as resources, with a lazily constructed icon.

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.

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

long minimumValue

Minimum value (inclusive).

long maximumValue

Maximum value (inclusive).

@NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers

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

long defaultValue

The default value for this LongRangeUserStyleSetting.

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

getDefaultValue

Added in 1.0.0
public final long getDefaultValue()

The default value.

getMaximumValue

Added in 1.0.0
public final long getMaximumValue()

The maximum value.

getMinimumValue

Added in 1.0.0
public final long getMinimumValue()

The minimum value.

getOptionForId

public @NonNull UserStyleSetting.Option getOptionForId(@NonNull UserStyleSetting.Option.Id optionId)

We support all values in the range min ... max not just min & max.