leanback-to-compose-tv-migration
БесплатноБез исполняемых скриптовНе проверенMigrate Android TV apps from legacy Leanback UI Toolkit, Android Views, or Support Fragments to Jetpack Compose for TV (androidx.tv). Use when migrating…
от android★ 10 827 звёзд на GitHubОб этом скилле
The 10-foot UI
A "10-foot UI" is a design paradigm for televisions that tailors an interface for viewing from approximately 3 meters (10 feet) away. When designing for this experience, account for these key characteristics:
- Viewing distance: Viewers are sitting far from the screen, "leaning back". Screen layouts are uncluttered, with text and UI elements that are large enough to be comfortably readable from a distance, without dense blocks of text.
- Color contrast: To avoid washed out colors on TV displays with low contrast ratios, the design uses high-contrast palettes and distinct visual indicators so focused states remain visible across different TV panels.
- D-pad navigation : Interaction relies on a directional remote control with limited 4-way navigation (
Up,Down,Left,Right) with components organized into clear spatial grids and carousels without focus traps.
Core architecture and library selection
When migrating an Android TV application to Jetpack Compose, you must use
androidx.tv libraries and follow these 10-foot UI patterns:
- UI modernization: Focus on custom, cinematic layouts over legacy direct 1:1 templates. You must use Jetpack Compose for TV features like dynamic gradient hero backdrops, custom focus animations, custom navigation drawers, and custom layouts.
- Primary design system : You must always use
androidx.tv.material3.*(androidx.tv:tv-material:1.1.0) over mobileandroidx.compose.material3.*. TV Material 3 provides built-in D-pad focus handling, focus zoom scaling, and TV-optimized typography and shapes. To set up Compose for TV dependencies, follow Compose for TV setup (on legacy projects upgrading to AGP 8.6.1+ and Kotlin 2.0.21+ with Gradle wrappergradle-8.7-bin.zip,compileSdk 35, andminSdk 23, apply theorg.jetbrains.kotlin.plugin.composeplugin usingorg.jetbrains.kotlin:compose-compiler-gradle-plugin:2.0.21instead ofkotlinCompilerExtensionVersion, and useandroidx.compose:compose-bom:2024.09.00,androidx.tv:tv-material:1.1.0, andandroidx.activity:activity-compose:1.9.2, withandroid.useAndroidX=trueandandroid.enableJetifier=trueingradle.properties, plusandroidx.preference:preference:1.2.1so untouchedLeanbackSettingsFragmentclasses compile cleanly; verify incremental migrations with./gradlew assembleDebugrather thanassembleReleaseor legacy Robolectric unit tests). - Focus zoom animation : For interactive cards, you must use
CompactCard,ClassicCard, orWideCardContainerwithscale = CardDefaults.scale(focusedScale = 1.1f)to provide standard TV focus animation. - Coil image loading : To use declarative
AsyncImage(model, contentDescription, ...)without passing an explicitImageLoaderparameter, you must includeio.coil-kt:coil-compose:2.6.0in your Gradle dependencies. - Explicit imports : You must always import TV Material 3 classes explicitly (for example,
import androidx.tv.material3.Surface,import androidx.tv.material3.ListItem) instead of using wildcard imports (import androidx.tv.material3.*). - File naming conventions : You must name Composable screen files after the screen (for example, name
BrowseScreenasBrowseScreen.kt,PlaybackScreenasPlaybackScreen.kt, andAuthenticationScreenasAuthenticationScreen.kt). Don't use generic prefixes likeMain. - Overscan and bezels : You must apply horizontal padding (for example,
horizontal = 48.dpor32.dp,vertical = 24.dp) to root containers, carousels, and top bars to prevent clipping. - Reading width constrainment : You must constrain reading width using
Modifier.widthIn(max = 600.dp)on text columns for long-form text. - Media3 Compose dependencies : Include
androidx.media3:media3-ui-compose:1.9.0andandroidx.media3:media3-ui-compose-material3:1.9.0(withcompileSdk 35) inapp/build.gradlewhen modernizing media playback screens. - Prohibition of legacy AndroidView wrappers : Don't use legacy
AndroidViewwrappers to embed View-based components into Jetpack Compose screens. All migrated screens must use Compose components or Media3 Compose surfaces (PlayerSurface).
D-pad focus handling and navigation
Jetpack Compose for TV (androidx.tv.material3) requires explicit focus
management, as components don't receive initial focus automatically and
navigation uses 2D spatial coordinates. To configure TV D-pad navigation, follow
instructions in TV Navigation guide.
Initial focus
You must assign initial focus to the primary interactive element on every screen
(such as the first action button, card, or ListItem) using FocusRequester
when entering a screen. Define val focusRequester = remember { FocusRequester() }, attach Modifier.focusRequester(focusRequester) to the primary element, and
request focus
Установить leanback-to-compose-tv-migration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл leanback-to-compose-tv-migration?
Migrate Android TV apps from legacy Leanback UI Toolkit, Android Views, or Support Fragments to Jetpack Compose for TV (androidx.tv). Use when migrating browse, settings, authentication, login, or video playback screens, replacing BrowseSupportFragment, LeanbackSettingsFragment, PreferenceFragment, BaseLeanbackPreferenceFragmentCompat, VideoSupportFragment, GuidedStepSupportFragment, SearchSupportFragment, VerticalGridSupportFragment, Presenter, ArrayObjectAdapter, or CursorMapper with Compose, or building carousels with focus memory, Media3 PlayerSurface playback, or 10-foot hero layouts. Don't use for mobile, tablet, foldable, Wear OS, or XR apps on standard Material 3 (`androidx.compose.material3`), or non-Compose Leanback maintenance.
Как установить скилл leanback-to-compose-tv-migration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл leanback-to-compose-tv-migration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies 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…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic