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
88d7587c
authored
Aug 26, 2020
by
Yoni Obadia
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
dev: add setting theme for TrackSelectionDialogBuilder
parent
99d245f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
library/ui/src/main/java/com/google/android/exoplayer2/ui/TrackSelectionDialogBuilder.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/TrackSelectionDialogBuilder.java
View file @
88d7587c
...
@@ -24,6 +24,7 @@ import android.content.DialogInterface;
...
@@ -24,6 +24,7 @@ import android.content.DialogInterface;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.StyleRes
;
import
com.google.android.exoplayer2.source.TrackGroupArray
;
import
com.google.android.exoplayer2.source.TrackGroupArray
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector.SelectionOverride
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector.SelectionOverride
;
...
@@ -49,6 +50,7 @@ public final class TrackSelectionDialogBuilder {
...
@@ -49,6 +50,7 @@ public final class TrackSelectionDialogBuilder {
}
}
private
final
Context
context
;
private
final
Context
context
;
@StyleRes
private
int
themeResId
;
private
final
CharSequence
title
;
private
final
CharSequence
title
;
private
final
MappedTrackInfo
mappedTrackInfo
;
private
final
MappedTrackInfo
mappedTrackInfo
;
private
final
int
rendererIndex
;
private
final
int
rendererIndex
;
...
@@ -121,6 +123,11 @@ public final class TrackSelectionDialogBuilder {
...
@@ -121,6 +123,11 @@ public final class TrackSelectionDialogBuilder {
newOverrides
.
isEmpty
()
?
null
:
newOverrides
.
get
(
0
)));
newOverrides
.
isEmpty
()
?
null
:
newOverrides
.
get
(
0
)));
}
}
public
TrackSelectionDialogBuilder
setTheme
(
int
themeResId
)
{
this
.
themeResId
=
themeResId
;
return
this
;
}
/**
/**
* Sets whether the selection is initially shown as disabled.
* Sets whether the selection is initially shown as disabled.
*
*
...
@@ -214,7 +221,7 @@ public final class TrackSelectionDialogBuilder {
...
@@ -214,7 +221,7 @@ public final class TrackSelectionDialogBuilder {
}
}
private
Dialog
buildForPlatform
()
{
private
Dialog
buildForPlatform
()
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
,
themeResId
);
// Inflate with the builder's context to ensure the correct style is used.
// Inflate with the builder's context to ensure the correct style is used.
LayoutInflater
dialogInflater
=
LayoutInflater
.
from
(
builder
.
getContext
());
LayoutInflater
dialogInflater
=
LayoutInflater
.
from
(
builder
.
getContext
());
...
@@ -238,8 +245,8 @@ public final class TrackSelectionDialogBuilder {
...
@@ -238,8 +245,8 @@ public final class TrackSelectionDialogBuilder {
// the APK size even with shrinking. See https://issuetracker.google.com/161514204.
// the APK size even with shrinking. See https://issuetracker.google.com/161514204.
// LINT.IfChange
// LINT.IfChange
Class
<?>
builderClazz
=
Class
.
forName
(
"androidx.appcompat.app.AlertDialog$Builder"
);
Class
<?>
builderClazz
=
Class
.
forName
(
"androidx.appcompat.app.AlertDialog$Builder"
);
Constructor
<?>
builderConstructor
=
builderClazz
.
getConstructor
(
Context
.
class
);
Constructor
<?>
builderConstructor
=
builderClazz
.
getConstructor
(
Context
.
class
,
int
.
class
);
Object
builder
=
builderConstructor
.
newInstance
(
context
);
Object
builder
=
builderConstructor
.
newInstance
(
context
,
themeResId
);
// Inflate with the builder's context to ensure the correct style is used.
// Inflate with the builder's context to ensure the correct style is used.
Context
builderContext
=
(
Context
)
builderClazz
.
getMethod
(
"getContext"
).
invoke
(
builder
);
Context
builderContext
=
(
Context
)
builderClazz
.
getMethod
(
"getContext"
).
invoke
(
builder
);
...
...
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