From ba9d45bfe9f5ca30ce72140752b63c6180a49b73 Mon Sep 17 00:00:00 2001 From: daron-walters Date: Sun, 17 May 2020 15:41:18 -0400 Subject: [PATCH] Fixes #2948 - Added hover listener for the full media control to handle case when over exits outside of controls --- .../ui/widgets/MediaControlsWidget.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java index cdb78f8c9..af0e78c31 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java @@ -207,6 +207,25 @@ public void onSeekPreview(String aText, double aRatio) { } mVolumeControl.requestFocusFromTouch(); }); + + + this.setOnHoverListener((v, event) -> { + if (mMedia == null) { + return false; + } + /*this handles the case where the user + holds the volume slider up/down past the volume control + control then hovers, which wont be picked up by the + volume control hover listener. in this case the widget itself + needs to handle this case + */ + if ((event.getX() < 0) || (event.getY() < 0)) { + mHideVolumeSlider = true; + startVolumeCtrlHandler(); + } + + return false; + }); mMediaVolumeButton.setOnHoverListener((v, event) -> { float startY = v.getY(); float maxY = startY + v.getHeight(); @@ -214,7 +233,6 @@ public void onSeekPreview(String aText, double aRatio) { if ((event.getX() <= 0) || (event.getX() >= v.getWidth()) || (!(event.getY() > startY && event.getY() < maxY))) { mHideVolumeSlider = true; startVolumeCtrlHandler(); - } else { mVolumeControl.setVisibility(View.VISIBLE); mHideVolumeSlider = false;