Перейти к содержанию
Skillpedia
Мобильные приложения10k · #11938

leanback-to-compose-tv-migration

Что он делает

Этот скилл направляет перенос Android TV-приложений с набора UI Leanback, Views или support fragments на Jetpack Compose for TV. Он охватывает такие экраны, как просмотр, настройки, вход и воспроизведение видео. Он нужен разработчикам Android TV, которые модернизируют свои приложения.

Когда использовать

  • ✓Когда ваше Android TV-приложение использует Leanback и вы хотите перенести его на Jetpack Compose for TV.
  • ✓Когда нужно перенести экран просмотра, настроек или входа для ТВ на Compose.
  • ✓Когда вы хотите экраны для ТВ, рассчитанные на просмотр из другой комнаты и навигацию пультом.

Ссылка на скилл

https://github.com/android/skills/blob/main/tv/leanback-to-compose-tv-migration/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/android/skills/blob/main/tv/leanback-to-compose-tv-migration/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Перенеси экран просмотра моего Android TV-приложения с Leanback на Jetpack Compose for TV.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Скилл следует архитектурным шаблонам библиотек androidx.tv, уделяя внимание крупному читаемому тексту, высокому контрасту и навигации с D-pad. Затем он строит собственные макеты, например героические фоны и боковые панели навигации.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с 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) over mobile androidx.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.
  • Focus zoom animation : For interactive cards, you must use CompactCard, ClassicCard, or WideCardContainer with scale = CardDefaults.scale(focusedScale = 1.1f) to provide standard TV focus animation.
  • Coil image loading : To use declarative AsyncImage(model, contentDescription, ...) without passing an explicit ImageLoader parameter, you must include io.coil-kt:coil-compose in 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 BrowseScreen as BrowseScreen.kt, PlaybackScreen as PlaybackScreen.kt, and AuthenticationScreen as AuthenticationScreen.kt). Don't use generic prefixes like Main.
  • Overscan and bezels : You must apply horizontal padding (for example, horizontal = 48.dp or 32.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 in app/build.gradle when modernizing media playback screens.
  • Prohibition of legacy AndroidView wrappers : Don't use legacy AndroidView wrappers 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 inside LaunchedEffect(Unit) { focusRequester.requestFocus() }:

val focusRequester = remember { FocusRequester() }
val focusManager = LocalFocusManager.current

LaunchedEffect(Unit) {
    focusRequester.requestFocus()
}
<br />

*Note: For screens with dynamic state or pagers (like OnboardingScreen using HorizontalPager), you must pass

Частые вопросы

Копирует ли он старые макеты Leanback точно?

Нет. Он предпочитает собственные кинематографичные макеты прямому копированию старых шаблонов один к одному.

Что означает UI на 10 футов?

Это подход к дизайну для телевизоров, которые смотрят примерно с трех метров, с крупным текстом и простой навигацией.

Какие библиотеки он использует?

Он использует библиотеки androidx.tv из Jetpack Compose for TV.

Подробности

Оригинальное описание автора

Provides instructions and architectural patterns for migrating Android TV applications from legacy Leanback UI Toolkit, Android Views, or Support Fragments to Jetpack Compose for TV (androidx.tv). Use this skill for Leanback to Compose migrations, including browse screen, settings screen, authentication screen, login screen, or video playback screen migrations, or when replacing BrowseSupportFragment, LeanbackSettingsFragment, PreferenceFragment, BaseLeanbackPreferenceFragmentCompat, VideoSupportFragment, GuidedStepSupportFragment, SearchSupportFragment, VerticalGridSupportFragment, Presenter,

repo: android/skills

Популярность

Звёзды на GitHub
10k
Место в рейтинге
#11938
Лицензия
Apache-2.0
Обновлён
29.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы