glance-canonical-layouts
Use this skill to create home screen widgets using Jetpack Glance Canonical Layouts from the Android Platform Samples project, or when asked to implement…
от android★ 10 827 звёзд на GitHub
Установить glance-canonical-layouts в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
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:
<receiver android:name=".glance.MyReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/my_app_widget_info" />
</receiver>
Dependencies
Add Jetpack Glance dependencies to the app module's build.gradle.kts
(dependencies block):
androidx.glance:glance-appwidget:1.2.0or higherandroidx.glance:glance-material3:1.2.0or higherandroidx.glance:glance-appwidget-preview:1.2.0or higherandroidx.glance:glance-preview:1.2.0or higher
Use version 1.3.0-alpha02 or higher with compileSdk = 37 and Android Gradle
Plugin (AGP) 9.1.0 or higher (for example, agp = "9.1.0" in
gradle/libs.versions.toml) when implementing Snap Scrolling.
If copying sample data repositories that load bitmaps with Coil (such as
FakeImageGridDataRepository.kt, FakeImageTextListDataRepository.kt, or
FakeTextWithImageRepository.kt), also add an image loading library dependency
such as io.coil-kt:coil (e.g., implementation("io.coil-kt:coil:2.7.0")) if
one doesn't already exist.
If copying FontUtils.kt (for long text, full-bleed image, or text with image
layouts), also add androidx.appcompat:appcompat. For example, add
implementation("androidx.appcompat:appcompat:1.8.0") if it
doesn't already exist. FontUtils.kt uses AppCompatTextView so text
auto-sizing also works below API level 27.
Canonical layout reference files
Action list layout (action_list)
- Widget Provider : ActionListAppWidget.kt
- Layout Composable : ActionListLayout.kt
- Widget Info XML : sample_action_list_widget_info.xml
- Data Repository : FakeActionListDataRepository.kt
- Dimensions : dimens.xml
- Strings : strings.xml
- Drawables : sample_action_list_preview.png, sample_home_icon.xml, sample_power_settings_icon.xml, sample_bulb_icon.xml, sample_thermostat_icon.xml, sample_ac_icon.xml, sample_door_icon.xml, sample_arrow_right_icon.xml, sample_no_data_icon.xml, sample_add_icon.xml
- Components : RoundedScrollingLazyVerticalGrid.kt, ListItem.kt, VerticalListItem.kt, RoundedScrollingLazyColumn.kt, EmptyListContent.kt, NoDataContent.kt
- Utilities : CollectionsKtx.kt, ActionUtils.kt, PreviewAnnotations.kt
- Theme : Color.kt, Theme.kt, Type.kt
- Additional References : CanonicalLayoutActivity.kt,
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/ActionDemonstrationActivity.kt
- references/CanonicalLayoutActivity.kt
- references/CollectionsKtx.kt
- references/collections/ActionListAppWidget.kt
- references/collections/CheckListAppWidget.kt
- references/collections/ImageGridAppWidget.kt
- references/collections/ImageTextListAppWidget.kt
- references/collections/data/FakeActionListDataRepository.kt
- references/collections/data/FakeCheckListDataRepository.kt
- references/collections/data/FakeImageGridDataRepository.kt
- references/collections/data/FakeImageTextListDataRepository.kt
- references/collections/layout/ActionListLayout.kt
- references/collections/layout/CheckListLayout.kt
- references/collections/layout/EmptyListContent.kt
- references/collections/layout/ImageGridLayout.kt
- references/collections/layout/ImageTextListLayout.kt
- references/collections/layout/ListItem.kt
- references/collections/layout/NoDataContent.kt
- references/collections/layout/RoundedScrollingLazyColumn.kt
- references/collections/layout/RoundedScrollingLazyVerticalGrid.kt
- references/collections/layout/VerticalListItem.kt
- references/res/drawable/four_side_cookie_background.xml
- references/res/drawable/sample_ac_icon.xml
- references/res/drawable/sample_add_icon.xml
- references/res/drawable/sample_app_logo.xml
- references/res/drawable/sample_arrow_right_icon.xml
- references/res/drawable/sample_bulb_icon.xml
- references/res/drawable/sample_camera_icon.xml
- references/res/drawable/sample_checked_circle_icon.xml
- references/res/drawable/sample_circle_icon.xml
- references/res/drawable/sample_delete_icon.xml
- references/res/drawable/sample_door_icon.xml
- references/res/drawable/sample_edit_icon.xml
- references/res/drawable/sample_file_upload_icon.xml
- references/res/drawable/sample_grid_icon.xml
- references/res/drawable/sample_heart_icon.xml
- references/res/drawable/sample_home_icon.xml
- references/res/drawable/sample_image_icon.xml
- references/res/drawable/sample_info_icon.xml
- references/res/drawable/sample_mic_icon.xml
FAQ
Что делает скилл glance-canonical-layouts?
Use this skill to create home screen widgets using Jetpack Glance Canonical Layouts from the Android Platform Samples project, or when asked to implement standard widget layout patterns (including Check List, Image Grid, Snap Scrolling, and Standard Toolbar).
Как установить скилл glance-canonical-layouts?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл glance-canonical-layouts запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…