mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Rollback of aa22bc2dbe
*** Original commit *** Fix PlayerView touch handling Overriding onTouchEvent was causing multiple issues, and appears to be unnecessary. Removing the override fixes: 1. StyledPlayerView accessibility issue where "hide player controls" actually toggled play/pause. 2. Delivery of events to a registered OnClickListener when useController is false. 3. Delivery of events to a registered OnLongClickListener in all configurations. 4. Incorrectly treating a sequence of touch events that exit the bounds of the vi... *** PiperOrigin-RevId: 433262414
This commit is contained in:
parent
3ef4f6ff24
commit
98e039d872
1 changed files with 27 additions and 5 deletions
|
|
@ -311,7 +311,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
||||||
|
|
||||||
LayoutInflater.from(context).inflate(playerLayoutId, this);
|
LayoutInflater.from(context).inflate(playerLayoutId, this);
|
||||||
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
||||||
setClickable(true);
|
|
||||||
|
|
||||||
// Content frame.
|
// Content frame.
|
||||||
contentFrame = findViewById(R.id.exo_content_frame);
|
contentFrame = findViewById(R.id.exo_content_frame);
|
||||||
|
|
@ -1016,10 +1015,30 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
||||||
return subtitleView;
|
return subtitleView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
if (!useController() || player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (event.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
isTouching = true;
|
||||||
|
return true;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
if (isTouching) {
|
||||||
|
isTouching = false;
|
||||||
|
return performClick();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean performClick() {
|
public boolean performClick() {
|
||||||
toggleControllerVisibility();
|
super.performClick();
|
||||||
return super.performClick();
|
return toggleControllerVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1115,15 +1134,18 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleControllerVisibility() {
|
private boolean toggleControllerVisibility() {
|
||||||
if (!useController() || player == null) {
|
if (!useController() || player == null) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (!controller.isFullyVisible()) {
|
if (!controller.isFullyVisible()) {
|
||||||
maybeShowController(true);
|
maybeShowController(true);
|
||||||
|
return true;
|
||||||
} else if (controllerHideOnTouch) {
|
} else if (controllerHideOnTouch) {
|
||||||
controller.hide();
|
controller.hide();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Shows the playback controls, but only if forced or shown indefinitely. */
|
/** Shows the playback controls, but only if forced or shown indefinitely. */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue