Skip to content

[TV] Add Leanback-to-Compose TV migration snippets#994

Open
pflammertsma wants to merge 5 commits into
android:mainfrom
pflammertsma:pflammertsma/tv-leanback-to-compose-snippets
Open

[TV] Add Leanback-to-Compose TV migration snippets#994
pflammertsma wants to merge 5 commits into
android:mainfrom
pflammertsma:pflammertsma/tv-leanback-to-compose-snippets

Conversation

@pflammertsma

Copy link
Copy Markdown
Member

No description provided.

@pflammertsma
pflammertsma requested a review from a team as a code owner July 23, 2026 20:39
@snippet-bot

snippet-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@chikoski chikoski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quickly reviewed the snippets and left some comments. Please take a look.

Overall, the snippets seems slightly long, which might make it difficult for developers to digest. To make it easier to read, I'd suggest to focus on the essential part, such as how to coordinate list item selection and background image update for the immersive list snippet.

Key event handling and updating the visibility of playback controls in the video player screen might be a bit out of scope here, or could be omitted to keep the focus clear.

}
}

categories.entries.forEachIndexed { catIndex, (categoryName, videos) ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itemsIndexed could simplify the code as follows;

itemsIndex(categories) { index, (categoryName, videos) ->
// snip
}

modifier: Modifier = Modifier
) {
val context = LocalContext.current
val exoPlayer = remember { ExoPlayer.Builder(context).build() }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposing to update the exoPlayer value when active context is updated:

val exoPlayer = remember(context) { 
// snip;
}

focusRequester.requestFocus()
scheduleAutoHide()

val listener = object : Player.Listener {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if the ExoPlayer object adds new listener every time the user chooses new video to play. I'd suggest to add DisposableEffect and move the code creating and setting lister object outside of the LaunchedEffect to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants