-
Notifications
You must be signed in to change notification settings - Fork 364
[Showcase] update LeanbackShowcase sample #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Showcase] update LeanbackShowcase sample #202
Conversation
MolchanovDmitry
commented
Apr 18, 2025
- Added TOML file
- Updated dependencies
- Migrated ExoPlayer to Media3
- Updated the music playback service
- Added androidx.leanback prefixes for Leanback resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @MolchanovDmitry, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request updates the LeanbackShowcase sample application. The key changes include migrating ExoPlayer to Media3, updating dependencies, adding a TOML file for dependency management, updating the music playback service, and adding androidx.leanback
prefixes for Leanback resources. The target SDK and compile SDK versions are also updated to 35, and the namespace is updated to androidx.leanback.leanbackshowcase
.
Highlights
- Dependency Updates: Dependencies are updated using a
libs.versions.toml
file and thealias
syntax in thebuild.gradle
file. This includes updates to Material Components, CardView, RecyclerView, Room, Lifecycle extensions, Dagger, Glide, Gson, and Media3 ExoPlayer. - ExoPlayer Migration to Media3: The ExoPlayer library is migrated to Media3. This involves changes in the
ExoPlayerAdapter
class, including updating imports, usingMediaItem
for media sources, and adapting to the new Media3 API for player control and event handling. TheSimpleExoPlayer
is replaced withExoPlayer
builder. - Leanback Resource Prefixes: Leanback resources are updated to use the
androidx.leanback
prefix. This change is reflected in theDetailViewExampleFragment
,DetailViewExampleWithVideoBackgroundFragment
,MusicConsumptionExampleFragment
,VideoContentCardPresenter
, andFullWidthDetailsPresenter
classes. - MusicPlaybackService Updates: The
MusicPlaybackService
is updated to includePendingIntent.FLAG_IMMUTABLE
when creatingPendingIntent
objects. Also,onUnbind
is overridden to stop the service when it is unbound. - Target and Compile SDK Update: The
targetSdkVersion
andcompileSdkVersion
are updated to 35 inapp/build.gradle
. - Namespace Update: The namespace is updated to
androidx.leanback.leanbackshowcase
inapp/build.gradle
. - Activity Exported Attribute: The
exported
attribute is added to theDynamicVideoRowsActivity
andVideoPlaybackActivity
activities inAndroidManifest.xml
.
Changelog
Click here to see the changelog
- LeanbackShowcase/app/build.gradle
- Updated plugins block to use alias syntax.
- Updated targetSdkVersion and compileSdkVersion to 35.
- Updated applicationId to 'androidx.leanback.leanbackshowcase'.
- Added compileOptions for Java 17.
- Updated dependencies to use versions defined in libs.versions.toml.
- LeanbackShowcase/app/src/androidTest/java/androidx/leanback/leanbackshowcase/ApplicationTest.java
- Migrated from
ApplicationTestCase
toAndroidJUnit4
. - Added a test to verify the application context.
- Migrated from
- LeanbackShowcase/app/src/main/AndroidManifest.xml
- Added permission
android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK
. - Added
android:exported="true"
toDynamicVideoRowsActivity
andVideoPlaybackActivity
.
- Added permission
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/details/DetailViewExampleFragment.java
- Updated resource IDs to use
androidx.leanback.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/details/DetailViewExampleWithVideoBackgroundFragment.java
- Updated resource IDs to use
androidx.leanback.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/media/ExoPlayerAdapter.java
- Migrated from ExoPlayer to Media3.
- Updated imports and class usages to reflect Media3 API.
- Replaced
SimpleExoPlayer
withExoPlayer
builder. - Updated
setDataSource
to useMediaItem
. - Updated listener methods to align with Media3's
Player.Listener
. - Removed
setAudioStreamType
and replaced it withsetAudioAttributes
.
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/media/MusicConsumptionExampleFragment.java
- Updated resource IDs to use
androidx.leanback.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/media/MusicPlaybackService.java
- Added
PendingIntent.FLAG_IMMUTABLE
toPendingIntent
flags. - Overrode
onUnbind
to stop the service. - Removed unused imports.
- Added
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/media/VideoConsumptionExampleWithExoPlayerFragment.java
- Removed
setAudioStreamType
call.
- Removed
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/ui/FullWidthDetailsPresenter.java
- Updated resource IDs to use
androidx.leanback.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/ui/VideoCardPresenter.java
- Updated resource IDs to use
androidx.leanback.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/viewmodel/VideosViewModel.java
- Removed unused imports and simplified Transformations.
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/rows/PublishChannelFragment.java
- Updated resource IDs to use
androidx.leanback.preference.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/rows/VideoContentCardPresenter.java
- Updated resource IDs to use
androidx.leanback.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/cards/presenters/SingleLineCardPresenter.java
- Updated resource IDs to use
androidx.leanback.R
prefix.
- Updated resource IDs to use
- LeanbackShowcase/build.gradle
- Replaced buildscript block with plugins block.
- Removed ext block.
- Applied false to the plugins
- LeanbackShowcase/gradle.properties
- Added
android.nonFinalResIds=false
.
- Added
- LeanbackShowcase/gradle/libs.versions.toml
- Added TOML file to manage library versions.
- LeanbackShowcase/gradle/wrapper/gradle-wrapper.properties
- Updated Gradle version to 8.11.1.
- LeanbackShowcase/settings.gradle
- Added pluginManagement and dependencyResolutionManagement blocks.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A showcase reborn,
Media3 streams, dependencies torn,
Leanback's new prefix.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request updates the LeanbackShowcase sample, migrating ExoPlayer to Media3, updating dependencies, and adding Leanback resource prefixes. The changes generally improve the project's maintainability and modernize its dependencies. However, some areas require closer attention to ensure correctness and best practices.
Summary of Findings
- ExoPlayerAdapter Migration: The migration from ExoPlayer to Media3 in
ExoPlayerAdapter.java
involves significant API changes. Ensure all event listeners and methods are correctly adapted to the new Media3 API to avoid unexpected behavior. - PendingIntent Flags: The addition of
PendingIntent.FLAG_IMMUTABLE
inMusicPlaybackService.java
is crucial for security, but verify that it doesn't introduce any compatibility issues with older Android versions. - Resource IDs: The update of resource IDs to use
androidx.leanback.R
is necessary for compatibility with Leanback, but ensure that all resource references are correctly updated throughout the project.
Merge Readiness
The pull request is almost ready for merging. However, the high severity issues regarding the ExoPlayerAdapter migration must be addressed before merging. After addressing these issues, ensure thorough testing to confirm the changes' stability and compatibility. I am unable to approve this pull request, and users should have others review and approve this code before merging.