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
b28f5ca4
authored
Dec 28, 2021
by
Paul Woitaschek
Committed by
GitHub
Dec 28, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Refactor unintuitive lateinit usage
parent
6cc7d058
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
demos/session/src/main/java/androidx/media3/demo/session/PlaybackService.kt
demos/session/src/main/java/androidx/media3/demo/session/PlaybackService.kt
View file @
b28f5ca4
...
@@ -87,11 +87,10 @@ class PlaybackService : MediaLibraryService() {
...
@@ -87,11 +87,10 @@ class PlaybackService : MediaLibraryService() {
// Only accept query with pattern "play [Title]" or "[Title]"
// Only accept query with pattern "play [Title]" or "[Title]"
// Where [Title]: must be exactly matched
// Where [Title]: must be exactly matched
// If no media with exact name found, play a random media instead
// If no media with exact name found, play a random media instead
lateinit
var
mediaTitle
:
String
val
mediaTitle
=
if
(
query
.
startsWith
(
"play "
,
ignoreCase
=
true
))
{
if
(
query
.
lowercase
().
startsWith
(
"play "
))
{
query
.
drop
(
5
)
mediaTitle
=
query
.
subSequence
(
5
,
query
.
length
).
toString
()
}
else
{
}
else
{
mediaTitle
=
query
query
}
}
val
item
=
MediaItemTree
.
getItemFromTitle
(
mediaTitle
)
?:
MediaItemTree
.
getRandomItem
()
val
item
=
MediaItemTree
.
getItemFromTitle
(
mediaTitle
)
?:
MediaItemTree
.
getRandomItem
()
...
...
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