Compose Multiplatform Patterns
monta-app/ocpp-emulator
Compose Multiplatform and Jetpack Compose patterns for KMP projects — state management, navigation, theming, performance, and platform-specific UI.
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).
$ npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install arindamxd/camerax-android leanback-to-compose-tv-migration --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/arindamxd/camerax-android.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/leanback-to-compose-tv-migration .claude/skills/leanback-to-compose-tv-migration && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "leanback-to-compose-tv-migration" agent skill from https://github.com/arindamxd/camerax-android/tree/master/.agents/skills/leanback-to-compose-tv-migration into .claude/skills/leanback-to-compose-tv-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "leanback-to-compose-tv-migration", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/arindamxd/camerax-android/tree/master/.agents/skills/leanback-to-compose-tv-migrationType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install arindamxd/camerax-android leanback-to-compose-tv-migration --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/arindamxd/camerax-android.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/leanback-to-compose-tv-migration .agents/skills/leanback-to-compose-tv-migration && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "leanback-to-compose-tv-migration" agent skill from https://github.com/arindamxd/camerax-android/tree/master/.agents/skills/leanback-to-compose-tv-migration into .agents/skills/leanback-to-compose-tv-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "leanback-to-compose-tv-migration", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install arindamxd/camerax-android leanback-to-compose-tv-migration --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/arindamxd/camerax-android.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/leanback-to-compose-tv-migration .cursor/skills/leanback-to-compose-tv-migration && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "leanback-to-compose-tv-migration" agent skill from https://github.com/arindamxd/camerax-android/tree/master/.agents/skills/leanback-to-compose-tv-migration into .cursor/skills/leanback-to-compose-tv-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "leanback-to-compose-tv-migration", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/arindamxd/camerax-android.git --path .agents/skills/leanback-to-compose-tv-migration--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install arindamxd/camerax-android leanback-to-compose-tv-migration --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/arindamxd/camerax-android.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/leanback-to-compose-tv-migration .gemini/skills/leanback-to-compose-tv-migration && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "leanback-to-compose-tv-migration" agent skill from https://github.com/arindamxd/camerax-android/tree/master/.agents/skills/leanback-to-compose-tv-migration into .gemini/skills/leanback-to-compose-tv-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "leanback-to-compose-tv-migration", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install arindamxd/camerax-android leanback-to-compose-tv-migrationInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/arindamxd/camerax-android.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/leanback-to-compose-tv-migration .github/skills/leanback-to-compose-tv-migration && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "leanback-to-compose-tv-migration" agent skill from https://github.com/arindamxd/camerax-android/tree/master/.agents/skills/leanback-to-compose-tv-migration into .github/skills/leanback-to-compose-tv-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "leanback-to-compose-tv-migration", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install arindamxd/camerax-android leanback-to-compose-tv-migration --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/arindamxd/camerax-android.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/leanback-to-compose-tv-migration .opencode/skills/leanback-to-compose-tv-migration && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "leanback-to-compose-tv-migration" agent skill from https://github.com/arindamxd/camerax-android/tree/master/.agents/skills/leanback-to-compose-tv-migration into .opencode/skills/leanback-to-compose-tv-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "leanback-to-compose-tv-migration", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
leanback-to-compose-tv-migrationProvides 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).
Leanback To Compose Tv Migration is an agent skill from arindamxd/camerax-android. 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…
Its SKILL.md is about 8.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 10 other files, including reference files (for example `references/android/training/tv/get-started/navigation.md`, `references/android/training/tv/playback/compose/browse.md` and `references/android/training/tv/playback/compose/index.md`).
It sits in Mobile, covering Android development. It works with Android and Jetpack Compose. The repository describes itself as: A Play Store camera app showing Jetpack CameraX APIs in Kotlin — install it, use it, copy the patterns. The licence is Apache-2.0.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 7c36352. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are kotlin).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Leanback To Compose Tv Migration loads about 8.7k tokens when it runs, and up to ~17k if it reads all its reference files. Until then it costs about 207 tokens; SKILL.md has 1,865 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from arindamxd/camerax-android at commit 7c36352, republished under its Apache-2.0 licence (© arindamxd). 1,865 words, ~8,710 tokens.
.claude/skills/leanback-to-compose-tv-migration/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.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:
Up, Down, Left, Right) with components organized into clear spatial grids and carousels without focus traps.When migrating an Android TV application to Jetpack Compose, you must use androidx.tv libraries and follow these 10-foot UI patterns:
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.CompactCard, ClassicCard, or WideCardContainer with scale = CardDefaults.scale(focusedScale = 1.1f) to provide standard TV focus animation.AsyncImage(model, contentDescription, ...) without passing an explicit ImageLoader parameter, you must include io.coil-kt:coil-compose in your Gradle dependencies.import androidx.tv.material3.Surface, import androidx.tv.material3.ListItem) instead of using wildcard imports (import androidx.tv.material3.*).BrowseScreen as BrowseScreen.kt, PlaybackScreen as PlaybackScreen.kt, and AuthenticationScreen as AuthenticationScreen.kt). Don't use generic prefixes like Main.horizontal = 48.dp or 32.dp, vertical = 24.dp) to root containers, carousels, and top bars to prevent clipping.Modifier.widthIn(max = 600.dp) on text columns for long-form text.androidx.media3:media3-ui-compose in app/build.gradle when modernizing media playback screens.AndroidView wrappers to embed View-based components into Jetpack Compose screens. All migrated screens must use Compose components or Media3 Compose surfaces (PlayerSurface).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.
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() }:
<br />
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 the state key to LaunchedEffect (for example LaunchedEffect(pagerState.currentPage)) so that focus is re-applied when the page changes.
When interactive elements sit on opposite sides of the display, standard 2D spatial navigation fails to find targets across them. This creates focus traps where users are unable to navigate out of an area using the D-pad.
For symmetrical, bidirectional D-pad navigation without focus traps, you must rely on Compose's 2D spatial focus engine whenever possible. When connecting adjacent UI elements across scrollable containers (like LazyColumn or LazyRow), don't set directional overrides (up = ..., down = ...) targeting individual items inside lazy lists. When an item scrolls off-screen during vertical navigation, its FocusRequester becomes uninitialized, throwing IllegalStateException during focus searches:
<br />
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 48.dp, vertical = 16.dp),
horizontalArrangement = Arrangement.End
) {
Button(
onClick = { /* Search */ },
modifier = Modifier.focusRequester(topBarFocusRequester)
) { Text("Search") }
}
<br />
Modifier.focusRestorer)When navigating vertically between horizontal carousels (LazyRow), Compose's default 2D spatial focus engine searches along the X coordinate of the focused item. If a user scrolls right in Row 1 (for example to Item 4 at X=800dp) and presses DOWN to navigate to Row 2, spatial routing focuses whatever item sits at X=800dp in Row 2.
To make every row maintain its own recollection of card focus (restoring focus to the previously visited item when revisited), you must attach Modifier.focusRestorer (with no arguments) directly to the LazyRow. Don't pass custom fallback FocusRequester lambdas in lazy containers, as calling requestFocus on an unattached or off-screen item during rapid D-pad scrolling throws IllegalStateException.
<br />
LazyRow(
modifier = Modifier.focusRestorer(),
contentPadding = PaddingValues(horizontal = 48.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
itemsIndexed(videos) { vidIndex, video ->
CompactCard(
onClick = { onVideoClick(video) },
image = {
AsyncImage(
model = video.cardImageUrl,
contentDescription = video.title,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize()
)
},
title = { Text(video.title) },
modifier = Modifier
.then(
if (catIndex == 0 && vidIndex == 0) {
Modifier.focusRequester(firstCardFocusRequester)
} else {
Modifier
}
)
.onFocusChanged { focusState ->
if (focusState.isFocused) {
focusedVideo = video
focusedCategoryIndex = catIndex
}
}
)
}
}
<br />
When migrating search bars or login forms from Leanback (SearchSupportFragment, GuidedStepSupportFragment), don't use bare BasicTextField containers or empty Surface(onClick = {}) wrappers, as they prevent D-pad CENTER from attaching the virtual keyboard (IME).
onPreviewKeyEvent) : Wrap standard M3 TextField inside a focusable TV Surface(onClick = { focusRequester.requestFocus() }, scale = ClickableSurfaceDefaults.scale(focusedScale = 1.01f), border = ClickableSurfaceDefaults.border(focusedBorder = Border(BorderStroke(2.dp, Color.White)))) to provide a focused border outline and D-pad focus scaling. You must attach Modifier.onPreviewKeyEvent on the text field or wrapper to intercept Key.Back and Key.Escape so the user's able to remove focus from the input field without exiting the screen.Key.Back and Key.Escape on KeyUp in onPreviewKeyEvent to stop editing (clearing focus), the user's able to return to D-pad form navigation without being trapped in the text field or accidentally exiting the screen.KeyboardActions(onNext = { focusManager.moveFocus(FocusDirection.Down) }) with ImeAction.Next on top fields to route focus down to the next input box, and ImeAction.Done on the bottom field to route focus directly to the submit button:<br />
Surface(
onClick = { focusRequester.requestFocus() },
border = ClickableSurfaceDefaults.border(focusedBorder = Border(border = BorderStroke(2.dp, Color.White))),
modifier = Modifier
.fillMaxWidth()
.focusRequester(focusRequester)
) {
OutlinedTextField(
value = username,
onValueChange = { username = it },
label = { Text("Username") },
singleLine = true,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
keyboardActions = KeyboardActions(onNext = { focusManager.moveFocus(FocusDirection.Down) }),
modifier = Modifier
.fillMaxWidth()
.onPreviewKeyEvent { event ->
if (event.type == KeyEventType.KeyDown && (event.key == Key.Enter || event.key == Key.NumPadEnter)) {
focusManager.moveFocus(FocusDirection.Down)
true
} else false
}
)
}
Surface(
onClick = {},
border = ClickableSurfaceDefaults.border(focusedBorder = Border(border = BorderStroke(2.dp, Color.White))),
modifier = Modifier.fillMaxWidth()
) {
OutlinedTextField(
value = password,
onValueChange = { password = it },
label = { Text("Password") },
singleLine = true,
visualTransformation = PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = { onLoginSuccess() }),
modifier = Modifier
.fillMaxWidth()
.onPreviewKeyEvent { event ->
if (event.type == KeyEventType.KeyDown && (event.key == Key.Enter || event.key == Key.NumPadEnter)) {
onLoginSuccess()
true
} else false
}
)
}
<br />
When implementing scrollable lists or grids in Jetpack Compose for TV, you must use standard LazyColumn, LazyRow, and LazyVerticalGrid from androidx.compose.foundation.lazy and androidx.compose.foundation.lazy.grid. For catalog browsing layouts, follow instructions in Catalog Browser guide.
BringIntoViewSpec : When defining a custom pivot scroll line for catalog rows using BringIntoViewSpec and CompositionLocalProvider(LocalBringIntoViewSpec provides ...), you must ensure your project compiles against Compose Foundation 1.7.0+ by adding implementation platform('androidx.compose:compose-bom:2024.06.00') (or newer) or implementation 'androidx.compose.foundation:foundation:1.7.0' in app/build.gradle. Without Compose Foundation 1.7.0+, import androidx.compose.foundation.gestures.LocalBringIntoViewSpec will fail with Unresolved reference: LocalBringIntoViewSpec.Modifier.focusRestorer) : Annotate your composable with @OptIn(ExperimentalFocusRestorerApi::class, ExperimentalComposeUiApi::class) and attach Modifier.focusRestorer on every category LazyRow to remember and restore the last focused card when navigating vertically across catalog rows.When populated with focusable TV Material 3 components (CompactCard, ListItem, Button), standard Compose lazy containers handle 2D D-Pad focus routing, focus memory, and edge scrolling automatically:
<br />
@Composable
fun CatalogBrowser(
featuredContentList: List<Movie>,
sectionList: List<Section>,
modifier: Modifier = Modifier,
onItemSelected: (Movie) -> Unit = {},
) {
LazyColumn(
modifier = modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
items(sectionList.size) { index ->
val section = sectionList[index]
SectionRow(section, onItemSelected = onItemSelected)
}
}
}
<br />
When migrating legacy Leanback video playback (VideoSupportFragment / PlaybackGlue), use Compose Media3 PlayerSurface (androidx.media3.ui.compose.PlayerSurface) combined with a translucent transport controls overlay:
PlayPauseButton) : Over the PlayerSurface, you must layer a translucent bottom controls bar (Box(modifier = Modifier.align(Alignment.BottomCenter))) containing explicit Media3 UI Compose buttons: at minimum PlayPauseButton, SeekBackButton, and SeekForwardButton. Never leave the transport controls overlay empty. To use these composables, you must add implementation 'androidx.media3:media3-ui-compose-material3:1.6.0' alongside androidx.media3:media3-ui-compose in your app/build.gradle dependencies.onPreviewKeyEvent) : To support seeking backward and forward with the remote control D-pad, attach Modifier.onPreviewKeyEvent on the container or controls overlay and intercept Compose Key.DirectionLeft and Key.DirectionRight (for example, keyEvent.key == Key.DirectionLeft) to seek backward and forward by 10 seconds (exoPlayer.seekTo(exoPlayer.currentPosition - 10000)). Never use legacy Android View keycodes (KeyEvent.KEYCODE_DPAD_LEFT or nativeKeyEvent.keyCode).PlayerView or StyledPlayerView in AndroidView { ... }. You must use PlayerSurface (androidx.media3.ui.compose.PlayerSurface) with ExoPlayer for video rendering in Compose for TV.To migrate an app cleanly without breaking compilation or introducing circular dependencies, execute in five distinct phases:
TvTheme.kt wrapping TvMaterialTheme with custom ColorScheme, Typography, and Shapes.MovieCard, SectionHeader, LoadingIndicator, ErrorState.ErrorDialog, OnboardingScreen, and SettingsScreen.BaseLeanbackPreferenceFragmentCompat, BaseLeanbackPreferenceFragment, or LeanbackSettingsFragment to use Compose, for example by using ListItem + Switch bound directly to SharedPreferences and replacing the findPreference implementation.FocusRequester, for example on the first ListItem.Fragment classes with activities of type ComponentActivity that declaratively use components in Compose.res/values/styles.xml and res/values/themes.xml (such as removing preferenceTheme that points to @style/PreferenceThemeOverlay.v14.Leanback) that aren't supported once leanback dependencies are removed:<br />
@Composable
fun TvSettingsScreen(
modifier: Modifier = Modifier
) {
var autoPlayNext by remember { mutableStateOf(true) }
var highQualityAudio by remember { mutableStateOf(false) }
Column(
modifier = modifier
.fillMaxSize()
.padding(48.dp)
) {
Text(
text = "Settings",
style = MaterialTheme.typography.headlineMedium,
modifier = Modifier.padding(bottom = 24.dp)
)
LazyColumn(
verticalArrangement = Arrangement.spacedBy(12.dp),
contentPadding = PaddingValues(vertical = 8.dp)
) {
item {
ListItem(
selected = false,
onClick = { autoPlayNext = !autoPlayNext },
headlineContent = { Text("Autoplay Next Video") },
supportingContent = { Text("Automatically start playing next item in queue") },
trailingContent = {
Switch(
checked = autoPlayNext,
onCheckedChange = null
)
}
)
}
item {
ListItem(
selected = false,
onClick = { highQualityAudio = !highQualityAudio },
headlineContent = { Text("High Quality Audio") },
supportingContent = { Text("Use spatial audio and multi-channel output when available") },
trailingContent = {
Switch(
checked = highQualityAudio,
onCheckedChange = null
)
}
)
}
}
}
}
<br />
VerticalGridScreen (LazyVerticalGrid), SearchScreen (BasicTextField with live list filtering), and BrowseScreen (LazyColumn of LazyRows).ArrayObjectAdapter, ListRowPresenter, CardPresenter, and HeaderItem classes.VideoDetailsScreen and GuidedStepScreen.PlaybackScreen using Compose Media3 PlayerSurface (androidx.media3.ui.compose.PlayerSurface) paired with a translucent bottom overlay containing Media3 Compose transport controls (such as PlayPauseButton, SeekBackButton, SeekForwardButton)..java activities, fragments, presenters, and XML layout files.ComponentActivity or FragmentActivity calling setContent { ... }.res/values/styles.xml and res/values/themes.xml (for example, any styles inheriting from Theme.Leanback or referencing lb_ styles).| Legacy Leanback / View Class | Modern Jetpack Compose Equivalent |
|---|---|
BrowseSupportFragment / MainFragment | BrowseScreen (LazyColumn containing categorized LazyRows + Hero Banner) |
DetailsSupportFragment | VideoDetailsScreen (Poster image, text column, action buttons, related LazyRow) |
VideoSupportFragment / PlaybackGlue | PlaybackScreen (Media3 ExoPlayer + Compose PlayerSurface) |
GuidedStepSupportFragment | GuidedStepScreen (Split-screen layout: 40% left guidance pane, 60% right actions pane) |
SearchSupportFragment | SearchScreen (BasicTextField + live filtering + LazyVerticalGrid) |
VerticalGridSupportFragment | VerticalGridScreen (LazyVerticalGrid(columns = GridCells.Fixed(5))) |
ArrayObjectAdapter / Presenter | Declarative @Composable functions observing immutable State<List<T>> |
CursorMapper / LoaderManager / CursorLoader | Kotlin Coroutines / withContext(Dispatchers.IO) in a Repository object |
OnboardingSupportFragment | OnboardingScreen (HorizontalPager + D-Pad navigation buttons) |
LeanbackSettingsFragment / PreferenceFragment | SettingsScreen (FocusRequester on first ListItem + trailing Switch bound to SharedPreferences) |
BrowseScreen)When building a 10-foot TV browse screen or Immersive List, don't place a hero banner before or outside a scrolling list, and don't fight Compose's automatic BringIntoView system with programmatic animateScrollToItem calls.
Instead, use BringIntoViewSpec with LocalBringIntoViewSpec from Compose Foundation to define exact TV pivot scrolling (for example, pivoting active rows at 35% from the top edge of the display). Combine this with a reshaping immersive row: when lower rows are focused (focusedCategoryIndex > 0), hide the hero text and display a normal section header on Row 0:
<br />
@Composable
fun ImmersiveBrowseScreen(
categories: Map<String, List<Video>>,
onVideoClick: (Video) -> Unit
) {
var focusedVideo by remember { mutableStateOf<Video?>(null) }
var focusedCategoryIndex by remember { mutableStateOf(0) }
val listState = rememberLazyListState()
val topBarFocusRequester = remember { FocusRequester() }
val firstCardFocusRequester = remember { FocusRequester() }
Box(modifier = Modifier.fillMaxSize()) {
AsyncImage(
model = focusedVideo?.bgImageUrl,
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize()
)
PositionFocusedItemInLazyLayout(parentFraction = 0.35f, childFraction = 0.5f) {
LazyColumn(
state = listState,
contentPadding = PaddingValues(top = 36.dp, bottom = 64.dp),
verticalArrangement = Arrangement.spacedBy(28.dp),
modifier = Modifier.fillMaxSize()
) {
item {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 48.dp, vertical = 16.dp),
horizontalArrangement = Arrangement.End
) {
Button(
onClick = { /* Search */ },
modifier = Modifier.focusRequester(topBarFocusRequester)
) { Text("Search") }
}
}
itemsIndexed(categories.entries.toList()) { catIndex, (categoryName, videos) ->
Column {
if (catIndex == 0 && focusedCategoryIndex == 0) {
Column(
modifier = Modifier
.heightIn(min = 200.dp)
.padding(horizontal = 48.dp)
) {
Text(
text = focusedVideo?.title ?: "",
style = MaterialTheme.typography.displayMedium
)
Text(
text = focusedVideo?.description ?: "",
style = MaterialTheme.typography.bodyLarge
)
}
} else {
Text(
text = categoryName,
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(horizontal = 48.dp, vertical = 8.dp)
)
}
LazyRow(
modifier = Modifier.focusRestorer(),
contentPadding = PaddingValues(horizontal = 48.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
itemsIndexed(videos) { vidIndex, video ->
CompactCard(
onClick = { onVideoClick(video) },
image = {
AsyncImage(
model = video.cardImageUrl,
contentDescription = video.title,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize()
)
},
title = { Text(video.title) },
modifier = Modifier
.then(
if (catIndex == 0 && vidIndex == 0) {
Modifier.focusRequester(firstCardFocusRequester)
} else {
Modifier
}
)
.onFocusChanged { focusState ->
if (focusState.isFocused) {
focusedVideo = video
focusedCategoryIndex = catIndex
}
}
)
}
}
}
}
}
}
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun PositionFocusedItemInLazyLayout(
parentFraction: Float = 0.35f,
childFraction: Float = 0.5f,
content: @Composable () -> Unit,
) {
val bringIntoViewSpec = remember(parentFraction, childFraction) {
object : BringIntoViewSpec {
override fun calculateScrollDistance(
offset: Float,
size: Float,
containerSize: Float
): Float {
if (offset >= 0f && offset <= containerSize * 0.45f) {
return 0f
}
val initialTargetForLeadingEdge = parentFraction * containerSize - (childFraction * size)
val targetForLeadingEdge = if (size <= containerSize && (containerSize - initialTargetForLeadingEdge) < size) {
containerSize - size
} else {
initialTargetForLeadingEdge
}
return offset - targetForLeadingEdge
}
}
}
CompositionLocalProvider(LocalBringIntoViewSpec provides bringIntoViewSpec, content = content)
}
<br />
PlaybackScreen)Implement a custom playback screen using androidx.media3.ui.compose.PlayerSurface as the video rendering canvas. Layer Material3 transport controls (SeekBackButton, PlayPauseButton, SeekForwardButton from androidx.media3:media3-ui-compose-material3) over the surface in a translucent bottom overlay, and handle D-pad remote key events with an auto-hide timeout:
<br />
@OptIn(UnstableApi::class)
@Composable
fun Media3PlaybackScreen(
video: Video,
onFinish: () -> Unit,
modifier: Modifier = Modifier
) {
val context = LocalContext.current
val exoPlayer = remember(context) { ExoPlayer.Builder(context).build() }
var showControls by remember { mutableStateOf(true) }
val focusRequester = remember { FocusRequester() }
val coroutineScope = rememberCoroutineScope()
var autoHideJob by remember { mutableStateOf<Job?>(null) }
fun scheduleAutoHide() {
autoHideJob?.cancel()
autoHideJob = coroutineScope.launch {
delay(5000)
showControls = false
}
}
DisposableEffect(exoPlayer) {
val listener = object : Player.Listener {
override fun onPlaybackStateChanged(playbackState: Int) {
if (playbackState == Player.STATE_ENDED) {
onFinish()
}
}
}
exoPlayer.addListener(listener)
onDispose {
autoHideJob?.cancel()
exoPlayer.removeListener(listener)
exoPlayer.release()
}
}
LaunchedEffect(video) {
focusRequester.requestFocus()
scheduleAutoHide()
val mediaItem = MediaItem.fromUri(video.videoUrl)
exoPlayer.setMediaItem(mediaItem)
exoPlayer.prepare()
exoPlayer.playWhenReady = true
}
Box(
modifier = modifier
.fillMaxSize()
.background(Color.Black)
.focusRequester(focusRequester)
.focusable()
.onPreviewKeyEvent { event ->
if (event.type == KeyEventType.KeyDown) {
when (event.key) {
Key.DirectionCenter, Key.Enter, Key.NumPadEnter, Key.MediaPlayPause, Key.Spacebar -> {
if (exoPlayer.isPlaying) exoPlayer.pause() else exoPlayer.play()
showControls = true
scheduleAutoHide()
true
}
Key.DirectionLeft, Key.MediaRewind -> {
val newPos = (exoPlayer.currentPosition - 10_000L).coerceAtLeast(0L)
exoPlayer.seekTo(newPos)
showControls = true
scheduleAutoHide()
true
}
Key.DirectionRight, Key.MediaFastForward -> {
val duration = exoPlayer.duration.coerceAtLeast(0L)
val newPos = (exoPlayer.currentPosition + 10_000L).coerceAtMost(duration)
exoPlayer.seekTo(newPos)
showControls = true
scheduleAutoHide()
true
}
Key.DirectionUp, Key.DirectionDown -> {
showControls = !showControls
if (showControls) scheduleAutoHide() else autoHideJob?.cancel()
true
}
else -> false
}
} else false
},
contentAlignment = Alignment.Center
) {
PlayerSurface(
player = exoPlayer,
modifier = Modifier.fillMaxSize()
)
if (showControls) {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(0x80000000))
.padding(48.dp),
contentAlignment = Alignment.BottomCenter
) {
Row(
horizontalArrangement = Arrangement.spacedBy(24.dp),
verticalAlignment = Alignment.CenterVertically
) {
SeekBackButton(player = exoPlayer)
PlayPauseButton(player = exoPlayer)
SeekForwardButton(player = exoPlayer)
}
}
}
}
}
<br />
Replace legacy LoaderManager.LoaderCallbacks<Cursor> and CursorObjectAdapter with a repository returning a Flow that observes database changes and triggers asynchronous fetching when empty:
<br />
object VideoFlowRepository {
fun getVideosFlow(context: Context, contentUri: Uri): Flow<List<Video>> = callbackFlow {
val contentObserver = object : ContentObserver(Handler(Looper.getMainLooper())) {
override fun onChange(selfChange: Boolean) {
trySend(queryVideos(context, contentUri))
}
}
context.contentResolver.registerContentObserver(
contentUri,
true,
contentObserver
)
val initialVideos = queryVideos(context, contentUri)
trySend(initialVideos)
awaitClose {
context.contentResolver.unregisterContentObserver(contentObserver)
}
}.flowOn(Dispatchers.IO)
private fun queryVideos(context: Context, uri: Uri): List<Video> {
// Query database or ContentProvider
return emptyList()
}
}
<br />
© arindamxd, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 3 other files (references) in .agents/skills/leanback-to-compose-tv-migration of arindamxd/camerax-android.
Open the folder on GitHubat commit 7c36352
We found 4 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in arindamxd/camerax-android, which our catalogue first saw on October 7, 2026.
Leanback To Compose Tv Migration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Leanback To Compose Tv Migration this skillarindamxd/camerax-android | 132 | 2 repos | ~8.7k | Automated safety check: Pass | Apache-2.0 | |
| Compose Multiplatform Patternsmonta-app/ocpp-emulator | 179 | 5 repos | ~2k | Automated safety check: Pass | Apache-2.0 | |
| Android Developmentdpconde/claude-android-skill | 336 | — | ~1.7k | Automated safety check: Pass | MIT | |
| Benchmarkandroidx/androidx | 6.1k | — | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| Mobile Android Designopenvetta/open-vetta | 290 | 3 repos | ~950 | Automated safety check: Pass | Apache-2.0 | |
| Generating Baseline ProfilesrosuH/EasyWatermark | 1.9k | 1 repos | ~5k | Automated safety check: Pass | Apache-2.0 |
monta-app/ocpp-emulator
Compose Multiplatform and Jetpack Compose patterns for KMP projects — state management, navigation, theming, performance, and platform-specific UI.
dpconde/claude-android-skill
Create production-quality Android applications following Google's official architecture guidance and NowInAndroid best practices.
androidx/androidx
Benchmarking and improving the performance of Jetpack Compose.
openvetta/open-vetta
Master Material Design 3 and Jetpack Compose patterns for building native Android apps.
rosuH/EasyWatermark
A skill your agent uses to generate and measure Jetpack Compose Baseline Profiles end-to-end with the AGP 8.2+ Baseline Profile Generator module and the Macrobenchmark harness.
hamen/compose_skill
Audit Android Jetpack Compose repositories for performance, animation phase correctness, state management, side effects, composable API quality, and adjacent Android launch UX resource risks such as…
arindamxd/camerax-android
A skill your agent uses to integrate the Jetpack Compose Styles API into an Android project.
arindamxd/camerax-android
Provides a complete workflow for implementing verified email retrieval on Android Credential Manager API.
arindamxd/camerax-android
A skill your agent uses to migrate your Jetpack Compose app to add adaptive edge-to-edge support and troubleshoot common issues.
arindamxd/camerax-android
Provide technical guidance for Android camera development with CameraX.
arindamxd/camerax-android
Provides a structured workflow for migrating an Android XML View to Jetpack Compose.
arindamxd/camerax-android
A skill your agent uses when upgrading or migrating an Android project from any legacy Google Play Billing Library (PBL) version to the latest stable version of PBL.
Works with
Categories
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). Leanback To Compose Tv Migration is an agent skill from arindamxd/camerax-android.tv).
Leanback To Compose Tv Migration fits situations like: leanback to Compose migrations; including browse screen; settings screen; authentication screen.
Run `npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a claude-code`. Or copy the skill folder (.agents/skills/leanback-to-compose-tv-migration in arindamxd/camerax-android) into .claude/skills/leanback-to-compose-tv-migration in your project. Claude Code loads it when a task matches its description.
Run `npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a codex`. Or copy the skill folder (.agents/skills/leanback-to-compose-tv-migration in arindamxd/camerax-android) into .agents/skills/leanback-to-compose-tv-migration in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add arindamxd/camerax-android --skill leanback-to-compose-tv-migration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/leanback-to-compose-tv-migration, .gemini/skills/leanback-to-compose-tv-migration, .github/skills/leanback-to-compose-tv-migration and .opencode/skills/leanback-to-compose-tv-migration in your project.
SKILL.md names no scripts, command-line tools or credentials: Leanback To Compose Tv Migration is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Leanback To Compose Tv Migration is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 8.7k tokens (SKILL.md is roughly 35k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.6k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Leanback To Compose Tv Migration: Compose Multiplatform Patterns (monta-app/ocpp-emulator, 179 stars), Android Development (dpconde/claude-android-skill, 336 stars), Benchmark (androidx/androidx, 6.1k stars) and Mobile Android Design (openvetta/open-vetta, 290 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
arindamxd (a GitHub user) maintains it in arindamxd/camerax-android, which has 132 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on October 2, 2026.
Source: arindamxd/camerax-android on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.