Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
be85684d
authored
Apr 11, 2023
by
tonihei
Committed by
Rohit Singh
Apr 12, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Replace deprecated onBackPressed call
PiperOrigin-RevId: 523361561
parent
e4bb1045
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
demos/session/src/main/java/androidx/media3/demo/session/MainActivity.kt
demos/session/src/main/java/androidx/media3/demo/session/MainActivity.kt
View file @
be85684d
...
@@ -26,6 +26,7 @@ import android.view.ViewGroup
...
@@ -26,6 +26,7 @@ import android.view.ViewGroup
import
android.widget.ArrayAdapter
import
android.widget.ArrayAdapter
import
android.widget.ListView
import
android.widget.ListView
import
android.widget.TextView
import
android.widget.TextView
import
androidx.activity.OnBackPressedCallback
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.media3.common.MediaItem
import
androidx.media3.common.MediaItem
...
@@ -73,21 +74,24 @@ class MainActivity : AppCompatActivity() {
...
@@ -73,21 +74,24 @@ class MainActivity : AppCompatActivity() {
val
intent
=
Intent
(
this
,
PlayerActivity
::
class
.
java
)
val
intent
=
Intent
(
this
,
PlayerActivity
::
class
.
java
)
startActivity
(
intent
)
startActivity
(
intent
)
}
}
onBackPressedDispatcher
.
addCallback
(
object
:
OnBackPressedCallback
(
/* enabled= */
true
)
{
override
fun
handleOnBackPressed
()
{
popPathStack
()
}
}
)
}
}
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
if
(
item
.
itemId
==
android
.
R
.
id
.
home
)
{
if
(
item
.
itemId
==
android
.
R
.
id
.
home
)
{
onBackPressed
()
onBackPressed
Dispatcher
.
onBackPressed
()
return
true
return
true
}
}
return
super
.
onOptionsItemSelected
(
item
)
return
super
.
onOptionsItemSelected
(
item
)
}
}
@SuppressWarnings
(
"MissingSuperCall"
)
override
fun
onBackPressed
()
{
popPathStack
()
}
override
fun
onStart
()
{
override
fun
onStart
()
{
super
.
onStart
()
super
.
onStart
()
initializeBrowser
()
initializeBrowser
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment