Enum WidgetSize
- All Implemented Interfaces:
Comparable<WidgetSize>
The size families a widget kind supports.
The first four are the phone families: iOS maps them to the WidgetKit families
(systemSmall / systemMedium / systemLarge, and accessoryRectangular for LOCKSCREEN);
Android and desktop treat them as size hints, and LOCKSCREEN is ignored on Android.
The WATCH_* families are complications -- the small live readouts on a watch face. They
live here rather than in an API of their own because they are the same concept as a widget:
content-driven, rendered while your app is not running, and fed by the same WidgetTimeline. On
Apple a complication is literally a WidgetKit widget in an accessory family; on Wear OS the
simple families become complication data and the richer ones become a Tile.
Design them for a glance. A complication is a few dozen pixels someone reads in under a second,
so a SurfaceVector gauge or a single number beats any layout that has to be read.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionLarge home-screen widget.Lock-screen widget.Medium home-screen widget.Small square home-screen widget.Round complication -- the corner or centre slots of a watch face.Curved complication hugging the bezel of a round face.One line of text alongside the time.Wide complication, a band across the watch face. -
Method Summary
Modifier and TypeMethodDescriptionstatic WidgetSizefromJsonName(String jsonName) Resolves a wire-format name back to its family.Returns the wire-format name used in the serialized descriptor.booleanTrue for the watch complication families, which are published to a watch face rather than to a home or lock screen.static WidgetSizeReturns the enum constant of this type with the specified name.static WidgetSize[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf
-
Enum Constant Details
-
SMALL
Small square home-screen widget. iOSsystemSmall. -
MEDIUM
Medium home-screen widget. iOSsystemMedium. -
LARGE
Large home-screen widget. iOSsystemLarge. -
LOCKSCREEN
Lock-screen widget. iOSaccessoryRectangular. -
WATCH_CIRCULAR
Round complication -- the corner or centre slots of a watch face. iOSaccessoryCircular; Wear OSRANGED_VALUEorMONOCHROMATIC_IMAGE. Room for a gauge or one glyph. -
WATCH_RECTANGULAR
Wide complication, a band across the watch face. iOSaccessoryRectangular; Wear OSLONG_TEXT, or a Tile when the layout is richer than text. The roomiest family. -
WATCH_INLINE
One line of text alongside the time. iOSaccessoryInline; Wear OSSHORT_TEXT. Text only -- anything else is dropped. -
WATCH_CORNER
Curved complication hugging the bezel of a round face. iOSaccessoryCorner; renders as the circular family on Wear OS, which has no corner slot.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getJsonName
Returns the wire-format name used in the serialized descriptor. -
isWatchFamily
public boolean isWatchFamily()True for the watch complication families, which are published to a watch face rather than to a home or lock screen.
Returns
true if this is a complication family
-
fromJsonName
Resolves a wire-format name back to its family.
Parameters
jsonName: the name produced bygetJsonName()
Returns
the matching family, or null when the name is unknown
-