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
9860c486
authored
May 30, 2019
by
olly
Committed by
Oliver Woodman
May 31, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Keep controller visible on d-pad key events
PiperOrigin-RevId: 250661977
parent
9da9941e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
RELEASENOTES.md
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
RELEASENOTES.md
View file @
9860c486
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
*
UI:
*
UI:
*
Allow setting
`DefaultTimeBar`
attributes on
`PlayerView`
and
*
Allow setting
`DefaultTimeBar`
attributes on
`PlayerView`
and
`PlayerControlView`
.
`PlayerControlView`
.
*
Fix issue where playback controls were not kept visible on key presses
(
[
#5963
](
https://github.com/google/ExoPlayer/issues/5963
)
).
*
Add a playWhenReady flag to MediaSessionConnector.PlaybackPreparer methods
*
Add a playWhenReady flag to MediaSessionConnector.PlaybackPreparer methods
to indicate whether a controller sent a play or only a prepare command. This
to indicate whether a controller sent a play or only a prepare command. This
allows to take advantage of decoder reuse with the MediaSessionConnector
allows to take advantage of decoder reuse with the MediaSessionConnector
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
View file @
9860c486
...
@@ -771,11 +771,20 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
...
@@ -771,11 +771,20 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
if
(
player
!=
null
&&
player
.
isPlayingAd
())
{
if
(
player
!=
null
&&
player
.
isPlayingAd
())
{
return
super
.
dispatchKeyEvent
(
event
);
return
super
.
dispatchKeyEvent
(
event
);
}
}
boolean
isDpadWhenControlHidden
=
isDpadKey
(
event
.
getKeyCode
())
&&
useController
&&
!
controller
.
isVisible
();
boolean
isDpadAndUseController
=
isDpadKey
(
event
.
getKeyCode
())
&&
useController
;
boolean
handled
=
boolean
handled
=
false
;
isDpadWhenControlHidden
||
dispatchMediaKeyEvent
(
event
)
||
super
.
dispatchKeyEvent
(
event
);
if
(
isDpadAndUseController
&&
!
controller
.
isVisible
())
{
if
(
handled
)
{
// Handle the key event by showing the controller.
maybeShowController
(
true
);
handled
=
true
;
}
else
if
(
dispatchMediaKeyEvent
(
event
)
||
super
.
dispatchKeyEvent
(
event
))
{
// The key event was handled as a media key or by the super class. We should also show the
// controller, or extend its show timeout if already visible.
maybeShowController
(
true
);
handled
=
true
;
}
else
if
(
isDpadAndUseController
)
{
// The key event wasn't handled, but we should extend the controller's show timeout.
maybeShowController
(
true
);
maybeShowController
(
true
);
}
}
return
handled
;
return
handled
;
...
...
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