PreviewParameterProvider

Known direct subclasses
BaseWidgetPreviewParams

A base PreviewParameterProvider for WearWidgetParams that provides standardized metadata for Glance Wear widget previews in Android Studio.

CollectionPreviewParameterProvider
LoremIpsum

PreviewParameterProvider with 1 value containing Lorem Ipsum.

Known indirect subclasses
RectangularAllWidgetPreviewParams

A PreviewParameterProvider that provides standard widget configurations to be used for preview image assets that are displayed as part of the system, such as a catalog, that are not cut to shape as it will be done by the system.

RectangularLargeWidgetPreviewParams

A PreviewParameterProvider that provides Large-type widget configurations from the rectangular specification with safe padding buffers.

RectangularSmallWidgetPreviewParams

A PreviewParameterProvider that provides Small-type widget configurations from the rectangular specification with safe padding buffers.

RoundAllWidgetPreviewParams

A PreviewParameterProvider that provides standard configurations based on the custom fully rounded specification.

RoundLargeWidgetPreviewParams

Provides Large-type widget configurations from the default round specification for both small and large screens.

RoundSmallWidgetPreviewParams

Provides Small-type widget configurations from the default round specification for both small and large screens.

SquircleAllWidgetPreviewParams

A PreviewParameterProvider that provides standard configurations based on the default squircle specifications from the wear widget host.

SquircleLargeWidgetPreviewParams

Provides Large-type widget configurations from the default squircle specification for both small and large screens.

SquircleSmallWidgetPreviewParams

Provides Small-type widget configurations from the default squircle specification for both small and large screens.


Interface to be implemented by any provider of values that you want to be injected as @Preview parameters. This allows providing sample information for previews.

Summary

Public functions

open String?

Returns a descriptive display name for the value at a given index from the values.

Cmn

Public properties

open Int

Returns the number of elements in the values.

Cmn
Sequence<T>

Sequence of values of type T to be passed as @Preview parameter.

Cmn

Public functions

getDisplayName

open fun getDisplayName(index: Int): String?

Returns a descriptive display name for the value at a given index from the values.

This name is used in the preview UI to help identify individual preview cases generated by this provider. This allows for position-based naming schemes (e.g., "Step 1", "Step 2"). To create a name based on the value's content, the value would need to be retrieved from the values sequence within this method's implementation.

For example, for a PreviewParameterProvider representing steps in a flow, you might return "Step ${index + 1}".

If null or an empty string is returned, the preview UI will fall back to a default name determined by Android Studio.

Parameters
index: Int

The position of the value in the values.

Returns
String?

A custom name for the preview for the value at the given index, or null or an empty string to use the default.

Public properties

count

open val count: Int

Returns the number of elements in the values.

values

val values: Sequence<T>

Sequence of values of type T to be passed as @Preview parameter.