Class WidgetKind
Declares one kind of home-screen widget the app offers (an app may offer several). The kind id
must match an entry in the surfaces.json file kept in the project's resources: widget kinds
are compiled into the native app (the widget gallery entries, the iOS widget bundle and the
Android receivers are all static), so the build needs them at build time while this runtime
declaration drives publishing and validation. A mismatch logs a prominent warning.
Ids are restricted to [a-z][a-z0-9_]* because they are used to derive native type and
resource names.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSupportedSize(WidgetSize size) Adds a supported size family.Returns the gallery description, or null.Returns the gallery title, or null.getId()Returns the stable kind identifier.Returns the supported size families;SMALLandMEDIUMwhen none were added explicitly.setDescription(String description) Sets the description shown in the platform widget gallery.setDisplayName(String displayName) Sets the title shown in the platform widget gallery.
-
Constructor Details
-
WidgetKind
Creates a widget kind declaration.
Parameters
id: the stable kind identifier,[a-z][a-z0-9_]*
-
-
Method Details
-
setDisplayName
Sets the title shown in the platform widget gallery.
Parameters
displayName: the gallery title
Returns
this kind, for chaining
-
setDescription
Sets the description shown in the platform widget gallery.
Parameters
description: the gallery description
Returns
this kind, for chaining
-
addSupportedSize
Adds a supported size family. When no size is added the kind defaults to
SMALLandMEDIUM.Parameters
size: the size family to support
Returns
this kind, for chaining
-
getId
Returns the stable kind identifier. -
getDisplayName
Returns the gallery title, or null. -
getDescription
Returns the gallery description, or null. -
getSupportedSizes
Returns the supported size families;SMALLandMEDIUMwhen none were added explicitly.
-