BaseWidgetPreviewParams

abstract class BaseWidgetPreviewParams : PreviewParameterProvider

Known direct 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.


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

This class consolidates the logic for generating human-readable display names for preview variants. It is intended to be subclassed by specific parameter providers that define the sequence of configurations to preview.

The implementation of getDisplayName ensures that each preview tab in the IDE clearly identifies the widget type and its dimensions.

Summary

Public constructors

BaseWidgetPreviewParams(
    values: Sequence<WearWidgetParams>,
    previewPrefix: String
)

Public functions

open String

Returns a descriptive name for the preview configuration at the specified index.

Public properties

String

The prefix to use for the display name of the preview parameters.

open Sequence<WearWidgetParams>

The sequence of WearWidgetParams configurations to be supplied to the preview.

Public constructors

BaseWidgetPreviewParams

Added in 1.0.0-alpha14
BaseWidgetPreviewParams(
    values: Sequence<WearWidgetParams>,
    previewPrefix: String
)

Public functions

getDisplayName

open fun getDisplayName(index: Int): String

Returns a descriptive name for the preview configuration at the specified index.

The returned string includes the widget's container type (Small or Large) and its specific dimensions in DP, following the format: "{previewPrefix} {Type} {Width}x{Height}dp". For example: "Squircle Small 166x72dp".

Parameters
index: Int

The index of the parameter in the values sequence.

Returns
String

A human-readable label for the Android Studio preview tool.

Public properties

previewPrefix

Added in 1.0.0-alpha14
val previewPrefixString

The prefix to use for the display name of the preview parameters.

values

Added in 1.0.0-alpha14
open val valuesSequence<WearWidgetParams>

The sequence of WearWidgetParams configurations to be supplied to the preview.