glance-canonical-layouts
Installation
SKILL.md
To implement a widget Canonical Layout that follows the recommended design patterns:
- The project MUST use Jetpack Glance.
- You MUST locate the requested layout from the list under Canonical Layout Reference Files.
- Copy the layout reference files into your project's target app module (e.g.,
src/main/java/andsrc/main/res/) in one step to implement the exact design and reduce the number of tool calls. - You MUST set override val
sizeMode: SizeMode = SizeMode.Exactin the widget provider class. - Validate that your project compiles, updating sample package declarations, import paths, and class names to match the target app's package name.
- Clean your project's widget code, removing unused classes (for example, unused buttons).
- You MUST register the widget receiver in
AndroidManifest.xmlinside<application>after<activity>, ensuringandroid:resource="@xml/..."matches the filename of the copied Widget Info XML. Otherwise, the widget won't appear in the widget picker: