Skip to content
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
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
invalidate itself automatically. Apps don't need to call
`invalidate()` explicitly anymore after updating the current playing
index.
* Make short-form demo work on TV with D-pad
([#2720](https://github.com/androidx/media/pull/2720)).
* Transformer:
* Track Selection:
* Add `TrackSelectionParameters.selectTextByDefault` to prefer the
Expand Down
5 changes: 5 additions & 0 deletions demos/shortform/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="androidx.media3.demo.shortform">

<uses-feature android:name="android.software.leanback" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:banner="@drawable/ic_banner"
android:label="@string/app_name"
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"
android:taskAffinity="">
Expand All @@ -28,6 +32,7 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>
</activity>
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package androidx.media3.demo.shortform.viewpager

import android.os.Bundle
import android.util.Log
import android.view.KeyEvent
import androidx.appcompat.app.AppCompatActivity
import androidx.media3.demo.shortform.MainActivity
import androidx.media3.demo.shortform.MediaItemDatabase
Expand Down Expand Up @@ -60,4 +61,16 @@ class ViewPagerActivity : AppCompatActivity() {
viewPagerView.adapter = null
super.onStop()
}

override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_DPAD_DOWN,
KeyEvent.KEYCODE_CHANNEL_UP ->
viewPagerView.setCurrentItem(viewPagerView.currentItem + 1, false)
KeyEvent.KEYCODE_DPAD_UP,
KeyEvent.KEYCODE_CHANNEL_DOWN ->
viewPagerView.setCurrentItem(viewPagerView.currentItem - 1, false)
}
return super.onKeyUp(keyCode, event)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.