Skip to content
Merged
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
22 changes: 21 additions & 1 deletion Leanback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,27 @@ Need more information about getting started with Android TV? Check the [official

## Screenshots

[![Screenshot](screenshots/atv-leanback-all.png)](https://raw.githubusercontent.com/googlesamples/androidtv-Leanback/master/screenshots/atv-leanback-all.png)
| Browse Fragment | Row Fragment | Details Fragment |
|:---:|:---:|:---:|
| ![Browse Fragment](screenshots/browse.png) | ![Row Fragment](screenshots/row.png) | ![Details Fragment](screenshots/details.png) |

| Row Fragment in Details | Vertical Grid Fragment | Card Views |
|:---:|:---:|:---:|
| ![Row Fragment in Details](screenshots/details_row.png) | ![Vertical Grid Fragment](screenshots/vertical_grid.png) | ![Card Views](screenshots/row.png) |

| Search Fragment | Guided Step Fragment | Error Fragment |
|:---:|:---:|:---:|
| ![Search Fragment](screenshots/search.png) | ![Guided Step Fragment](screenshots/guided_step.png) | ![Error Fragment](screenshots/error.png) |

| Onboarding Fragment | Settings Fragment | |
|:---:|:---:|:---:|
| ![Onboarding Fragment](screenshots/onboarding.png) | ![Settings Fragment](screenshots/settings.png) | |

### Generating Screenshots
To automatically navigate through the sample application and regenerate all 10 screenshot assets from a connected Android TV emulator or device, execute the included script:
```sh
./screenshots/capture_screenshots.sh [-s <serial>]
```

## Support

Expand Down
43 changes: 26 additions & 17 deletions Leanback/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,44 +1,53 @@
apply plugin: 'com.android.application'
plugins {
alias(libs.plugins.android.application)
}

android {
compileSdkVersion 28
namespace = "com.example.android.tvleanback"
compileSdk = 35

buildFeatures {
buildConfig = true
}

defaultConfig {
applicationId "com.example.android.tvleanback"
minSdkVersion 21
targetSdkVersion 28
minSdk = 23
targetSdk = 35
versionCode 2
versionName "1.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.leanback:leanback:1.0.0'
implementation 'androidx.recommendation:recommendation:1.0.0'
implementation 'androidx.leanback:leanback-preference:1.0.0'
implementation 'androidx.annotation:annotation:1.0.1'
implementation libs.androidx.recyclerview
implementation libs.androidx.leanback
implementation libs.androidx.leanback.preference
implementation libs.androidx.annotation

implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation libs.glide

implementation 'com.google.android.exoplayer:exoplayer:2.6.1'
implementation 'com.google.android.exoplayer:extension-leanback:2.6.1'
implementation libs.androidx.media3.exoplayer
implementation libs.androidx.media3.ui.leanback

testImplementation 'junit:junit:4.12'
testImplementation libs.junit
testImplementation 'org.robolectric:robolectric:3.8'
androidTestImplementation "androidx.test.ext:junit:1.1.0"
androidTestImplementation "androidx.test.ext:truth:1.1.0"
androidTestImplementation libs.androidx.junit
androidTestImplementation 'androidx.test.ext:truth:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
}
21 changes: 5 additions & 16 deletions Leanback/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.android.tvleanback">
xmlns:tools="http://schemas.android.com/tools">

<permission
android:name="${applicationId}.ACCESS_VIDEO_DATA"
android:protectionLevel="signature" />

<uses-permission android:name="${applicationId}.ACCESS_VIDEO_DATA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-feature
Expand All @@ -46,6 +44,7 @@
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".ui.MainActivity"
android:exported="true"
android:icon="@drawable/videos_by_google_banner"
android:label="@string/app_name"
android:logo="@drawable/videos_by_google_banner"
Expand All @@ -58,7 +57,9 @@
</intent-filter>
</activity>

<activity android:name=".mobile.MobileWelcomeActivity">
<activity
android:name=".mobile.MobileWelcomeActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down Expand Up @@ -110,21 +111,9 @@
android:readPermission="android.permission.GLOBAL_SEARCH" />
</provider>

<receiver
android:name=".recommendation.RecommendationReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<service
android:name=".data.FetchVideoService"
android:exported="false" />
<service
android:name=".recommendation.UpdateRecommendationsService"
android:enabled="true" />

<activity android:name=".ui.OnboardingActivity"
android:enabled="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static UriMatcher buildUriMatcher() {
}

private Cursor getSuggestions(String query) {
query = query.toLowerCase();
query = query.toLowerCase(java.util.Locale.ROOT);
return sVideosContainingQueryBuilder.query(
mOpenHelper.getReadableDatabase(),
sVideosContainingQueryColumns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public boolean equals(Object m) {
return m instanceof Video && id == ((Video) m).id;
}

@Override
public int hashCode() {
return Long.hashCode(id);
}

public int describeContents() {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import androidx.leanback.widget.ArrayObjectAdapter;
import androidx.leanback.widget.PlaybackControlsRow;

import com.google.android.exoplayer2.ext.leanback.LeanbackPlayerAdapter;
import androidx.media3.ui.leanback.LeanbackPlayerAdapter;

import java.util.concurrent.TimeUnit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
LayoutInflater inflater = (LayoutInflater) viewGroup.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View view = inflater.inflate(R.layout.icon_header_item, null);
View view = inflater.inflate(R.layout.icon_header_item, viewGroup, false);
view.setAlpha(mUnselectedAlpha); // Initialize icons to be at half-opacity.

return new ViewHolder(view);
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading