From 975f53ac74ad1f7df95dbb265fd77edfa33d0473 Mon Sep 17 00:00:00 2001 From: daron-walters Date: Tue, 21 Apr 2020 21:36:06 -0400 Subject: [PATCH] Fixes #2948 Fixed unit testing defect where the space between the volume button and slider was not hiding sliderFixes #2948 --- .../vrbrowser/ui/widgets/MediaControlsWidget.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 1c6280af0..aa342d2b6 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 @@ -192,8 +192,8 @@ public void onSeekPreview(String aText, double aRatio) { childView.getDrawingRect(mOffsetViewBounds); MediaControlsWidget.this.offsetDescendantRectToMyCoords(childView, mOffsetViewBounds); - FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)mMediaSeekLabel.getLayoutParams(); - params.setMarginStart(mOffsetViewBounds.left + (int)(aRatio * mOffsetViewBounds.width()) - mMediaSeekLabel.getMeasuredWidth() / 2); + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mMediaSeekLabel.getLayoutParams(); + params.setMarginStart(mOffsetViewBounds.left + (int) (aRatio * mOffsetViewBounds.width()) - mMediaSeekLabel.getMeasuredWidth() / 2); mMediaSeekLabel.setLayoutParams(params); } }); @@ -205,12 +205,11 @@ public void onSeekPreview(String aText, double aRatio) { } mVolumeControl.requestFocusFromTouch(); }); - mMediaVolumeButton.setOnHoverListener((v, event) -> { float startY = v.getY(); float maxY = startY + v.getHeight(); //for this we only hide on the left side of volume button or outside y area of button - if ((event.getX() <= 0) || (!(event.getY() > startY && event.getY() < maxY))) { + if ((event.getX() <= 0) || (event.getX() >= v.getWidth()) || (!(event.getY() > startY && event.getY() < maxY))) { mHideVolumeSlider = true; startVolumeCtrlHandler(); @@ -230,13 +229,14 @@ public void onSeekPreview(String aText, double aRatio) { stopVolumeCtrlHandler(); } //for this we only hide on the right side of volume button or outside y area of button - else if ((event.getX() < 0) || (event.getX() >= v.getWidth()) || (!(event.getY() > startY && event.getY() < maxY))) { + else if ((event.getX() <= 0) || (event.getX() >= v.getWidth()) || (!(event.getY() > startY && event.getY() < maxY))) { mHideVolumeSlider = true; startVolumeCtrlHandler(); } return false; }); + } @Override