Skip to content

[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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 54 additions & 42 deletions LeanbackShowcase/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@
* limitations under the License.
*/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
}

android {
compileSdkVersion 28
buildToolsVersion rootProject.buildToolsVersion

namespace 'androidx.leanback.leanbackshowcase'
compileSdkVersion 35

defaultConfig {
applicationId 'com.example.android.persistence'
applicationId 'androidx.leanback.leanbackshowcase'
minSdkVersion 21
targetSdkVersion 28
compileSdkVersion 28
versionCode 1
versionName "1.0"
targetSdkVersion 35
compileSdkVersion 35
versionCode 2
versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -50,55 +54,63 @@ android {
lintOptions {
abortOnError false
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation libs.material
implementation libs.cardview
implementation libs.recyclerview
implementation libs.room.runtime
implementation libs.androidx.lifecycle.extensions

implementation 'com.google.android.material:material:' + rootProject.materialVersion
implementation 'androidx.cardview:cardview:' + rootProject.supportLibVersion
implementation 'androidx.recyclerview:recyclerview:' + rootProject.supportLibVersion
implementation 'androidx.lifecycle:lifecycle-extensions:' + rootProject.archLifecycleVersion
implementation 'androidx.room:room-runtime:' + rootProject.archRoomVersion
kapt "androidx.lifecycle:lifecycle-compiler:" + rootProject.archLifecycleVersion
kapt "androidx.room:room-compiler:" + rootProject.archRoomVersion
kapt libs.androidx.lifecycle.compiler
kapt libs.androidx.room.compiler

testImplementation 'junit:junit:4.12'
testImplementation libs.junit

// Testing-only dependencies
androidTestImplementation 'androidx.test:runner:' + rootProject.testVersion
androidTestImplementation 'androidx.test:rules:' + rootProject.testVersion
androidTestImplementation 'androidx.test.espresso:espresso-core:' + rootProject.espressoVersion
androidTestImplementation libs.androidx.runner
androidTestImplementation libs.androidx.rules
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.espresso.core

androidTestImplementation 'androidx.test.espresso:espresso-contrib:' + rootProject.espressoVersion
androidTestImplementation libs.androidx.espresso.contrib

// Force usage of dependencies in the test app, since it is internally used by the runner module.
androidTestImplementation 'com.google.android.material:material:' + rootProject.materialVersion
androidTestImplementation 'androidx.recyclerview:recyclerview:' + rootProject.supportLibVersion
androidTestImplementation libs.material
androidTestImplementation libs.recyclerview

implementation 'androidx.leanback:leanback:' + rootProject.supportLibVersion
implementation 'androidx.appcompat:appcompat:' + rootProject.supportLibVersion
implementation libs.leanback
implementation libs.appcompat

implementation 'androidx.preference:preference:' + rootProject.supportLibVersion
implementation 'androidx.leanback:leanback-preference:' + rootProject.supportLibVersion
implementation 'androidx.legacy:legacy-preference-v14:' + rootProject.supportLibVersion
implementation libs.preference.ktx
implementation libs.leanback.preference
implementation libs.legacy.preference.v14

implementation "com.google.code.gson:gson:2.8.2"
implementation "androidx.palette:palette:" + rootProject.supportLibVersion
implementation 'com.google.android.exoplayer:exoplayer:r2.2.0'
implementation libs.gson
implementation libs.androidx.palette.ktx
implementation libs.androidx.media3.exoplayer

implementation 'com.github.bumptech.glide:glide:4.0.0-RC1'
implementation 'androidx.tvprovider:tvprovider:' + rootProject.supportLibVersion
implementation libs.glide
implementation libs.androidx.tvprovider

implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation libs.converter.gson
implementation libs.retrofit

implementation "com.google.dagger:dagger:" + rootProject.daggerVersion
implementation "com.google.dagger:dagger-android:" + rootProject.daggerVersion
implementation "com.google.dagger:dagger-android-support:" + rootProject.daggerVersion
implementation libs.dagger
implementation libs.dagger.android
implementation libs.dagger.android.support

kapt "com.google.dagger:dagger-android-processor:" + rootProject.daggerVersion
kapt "com.google.dagger:dagger-compiler:" + rootProject.daggerVersion
kapt libs.dagger.android.processor
kapt libs.dagger.compiler
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,25 @@

package androidx.leanback.leanbackshowcase;

import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertNotNull;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
@RunWith(AndroidJUnit4.class)
public class ApplicationTest {

@Test
public void testApplicationContext() {
Application app = ApplicationProvider.getApplicationContext();
assertNotNull(app);
}
}
5 changes: 4 additions & 1 deletion LeanbackShowcase/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" />
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

<uses-feature
android:name="android.hardware.touchscreen"
Expand Down Expand Up @@ -100,6 +101,7 @@
android:theme="@style/Theme.Example.LeanbackMusic"/>
<activity
android:theme="@style/Theme.Example.LeanbackBrowse"
android:exported="true"
android:name=".app.rows.DynamicVideoRowsActivity"
android:label="@string/app_name">
<intent-filter>
Expand All @@ -113,7 +115,8 @@
</intent-filter>
</activity>
<activity
android:name=".app.rows.VideoPlaybackActivity">
android:name=".app.rows.VideoPlaybackActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
RowPresenter.ViewHolder viewHolder = super.createRowViewHolder(parent);

View actionsView = viewHolder.view.
findViewById(R.id.details_overview_actions_background);
findViewById(androidx.leanback.R.id.details_overview_actions_background);
actionsView.setBackgroundColor(getActivity().getResources().
getColor(R.color.detail_view_actionbar_background));

View detailsView = viewHolder.view.findViewById(R.id.details_frame);
View detailsView = viewHolder.view.findViewById(androidx.leanback.R.id.details_frame);
detailsView.setBackgroundColor(
getResources().getColor(R.color.detail_view_background));
return viewHolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
RowPresenter.ViewHolder viewHolder = super.createRowViewHolder(parent);

View actionsView = viewHolder.view.
findViewById(R.id.details_overview_actions_background);
findViewById(androidx.leanback.R.id.details_overview_actions_background);
actionsView.setBackgroundColor(getActivity().getResources().
getColor(R.color.detail_view_actionbar_background));

View detailsView = viewHolder.view.findViewById(R.id.details_frame);
View detailsView = viewHolder.view.findViewById(androidx.leanback.R.id.details_frame);
detailsView.setBackgroundColor(
getResources().getColor(R.color.detail_view_background));
return viewHolder;
Expand Down
Loading