UserStyleSetting.DoubleRangeUserStyleSetting

public final class UserStyleSetting.DoubleRangeUserStyleSetting extends UserStyleSetting


A DoubleRangeUserStyleSetting represents a setting with a Double value in the range [minimumValue .. maximumValue].

Summary

Nested types

UserStyleSetting.DoubleRangeUserStyleSetting.DoubleRangeOption

Represents an option as a Double in the range minimumValue ..

Public fields

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 double

Returns the default value.

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 @Nullable Icon

Icon for use in the style selection UI.

final @NonNull UserStyleSetting.Id

Identifier for the element, must be unique.

final double

Returns the maximum value.

final double

Returns the minimum value.

final @NonNull List<@NonNull UserStyleSetting.Option>

List of options for this UserStyleSetting.

Public constructors

DoubleRangeUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    @Nullable Icon icon,
    double minimumValue,
    double maximumValue,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    double defaultValue
)

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

Public methods

@NonNull UserStyleSetting.Option

We support all values in the range min ...

Inherited methods

From class UserStyleSetting
boolean
int
@NonNull String

Public fields

affectedWatchFaceLayers

@NonNull
public final @NonNull Collection<@NonNull WatchFaceLayeraffectedWatchFaceLayers

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

defaultOption

@NonNull
public final @NonNull UserStyleSetting.Option defaultOption

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

defaultOptionIndex

@NonNull
public final int defaultOptionIndex

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

defaultValue

@NonNull
public final double defaultValue

Returns the default value.

description

@NonNull
public final @NonNull CharSequence description

Localized description string displayed under the displayName.

displayName

@NonNull
public final @NonNull CharSequence displayName

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

icon

@Nullable
public final @Nullable Icon icon

Icon for use in the style selection UI.

id

@NonNull
public final @NonNull UserStyleSetting.Id id

Identifier for the element, must be unique. Styling data gets shared with the companion (typically via bluetooth) so size is a consideration and short ids are encouraged. There is a maximum length see UserStyleSetting.Id.MAX_LENGTH.

maximumValue

@NonNull
public final double maximumValue

Returns the maximum value.

minimumValue

@NonNull
public final double minimumValue

Returns the minimum value.

options

@NonNull
public final @NonNull List<@NonNull UserStyleSetting.Optionoptions

List of options for this UserStyleSetting. Depending on the type of UserStyleSetting this may be an exhaustive list, or just examples to populate a ListView in case the UserStyleSetting isn't supported by the UI (e.g. a new WatchFace with an old Companion).

Public constructors

DoubleRangeUserStyleSetting

public final DoubleRangeUserStyleSetting(
    @NonNull UserStyleSetting.Id id,
    @NonNull Resources resources,
    @StringRes int displayNameResourceId,
    @StringRes int descriptionResourceId,
    @Nullable Icon icon,
    double minimumValue,
    double maximumValue,
    @NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers,
    double defaultValue
)

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

@Nullable Icon icon

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

double minimumValue

Minimum value (inclusive).

double maximumValue

Maximum value (inclusive).

@NonNull Collection<@NonNull WatchFaceLayer> affectsWatchFaceLayers

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

double defaultValue

The default value for this DoubleRangeUserStyleSetting.

Public methods

getOptionForId

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

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