BaseWidgetPreviewParams

abstract class BaseWidgetPreviewParams : PreviewParameterProvider

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

Public functions

open String

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

Public properties

open Sequence<WearWidgetParams>

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

Public constructors

BaseWidgetPreviewParams

Added in 1.0.0-alpha11
BaseWidgetPreviewParams(values: Sequence<WearWidgetParams>)

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: "{Type} Widget {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

values

Added in 1.0.0-alpha11
open val valuesSequence<WearWidgetParams>

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