Enum WidgetSize

java.lang.Object
java.lang.Enum<WidgetSize>
com.codename1.surfaces.WidgetSize
All Implemented Interfaces:
Comparable<WidgetSize>

public enum WidgetSize extends Enum<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 Details

    • SMALL

      public static final WidgetSize SMALL
      Small square home-screen widget. iOS systemSmall.
    • MEDIUM

      public static final WidgetSize MEDIUM
      Medium home-screen widget. iOS systemMedium.
    • LARGE

      public static final WidgetSize LARGE
      Large home-screen widget. iOS systemLarge.
    • LOCKSCREEN

      public static final WidgetSize LOCKSCREEN
      Lock-screen widget. iOS accessoryRectangular.
    • WATCH_CIRCULAR

      public static final WidgetSize WATCH_CIRCULAR
      Round complication -- the corner or centre slots of a watch face. iOS accessoryCircular; Wear OS RANGED_VALUE or MONOCHROMATIC_IMAGE. Room for a gauge or one glyph.
    • WATCH_RECTANGULAR

      public static final WidgetSize WATCH_RECTANGULAR
      Wide complication, a band across the watch face. iOS accessoryRectangular; Wear OS LONG_TEXT, or a Tile when the layout is richer than text. The roomiest family.
    • WATCH_INLINE

      public static final WidgetSize WATCH_INLINE
      One line of text alongside the time. iOS accessoryInline; Wear OS SHORT_TEXT. Text only -- anything else is dropped.
    • WATCH_CORNER

      public static final WidgetSize WATCH_CORNER
      Curved complication hugging the bezel of a round face. iOS accessoryCorner; renders as the circular family on Wear OS, which has no corner slot.
  • Method Details

    • values

      public static WidgetSize[] 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

      public static WidgetSize valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getJsonName

      public String 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

      public static WidgetSize fromJsonName(String jsonName)

      Resolves a wire-format name back to its family.

      Parameters
      Returns

      the matching family, or null when the name is unknown