Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 13d3362

Browse files
Fixes #2948 - Added hover listener for the full media control to handle case when over exits outside of controls (#3386)
1 parent 05537c3 commit 13d3362

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,32 @@ public void onSeekPreview(String aText, double aRatio) {
207207
}
208208
mVolumeControl.requestFocusFromTouch();
209209
});
210+
211+
212+
this.setOnHoverListener((v, event) -> {
213+
if (mMedia == null) {
214+
return false;
215+
}
216+
/*this handles the case where the user
217+
holds the volume slider up/down past the volume control
218+
control then hovers, which wont be picked up by the
219+
volume control hover listener. in this case the widget itself
220+
needs to handle this case
221+
*/
222+
if ((event.getX() < 0) || (event.getY() < 0)) {
223+
mHideVolumeSlider = true;
224+
startVolumeCtrlHandler();
225+
}
226+
227+
return false;
228+
});
210229
mMediaVolumeButton.setOnHoverListener((v, event) -> {
211230
float startY = v.getY();
212231
float maxY = startY + v.getHeight();
213232
//for this we only hide on the left side of volume button or outside y area of button
214233
if ((event.getX() <= 0) || (event.getX() >= v.getWidth()) || (!(event.getY() > startY && event.getY() < maxY))) {
215234
mHideVolumeSlider = true;
216235
startVolumeCtrlHandler();
217-
218236
} else {
219237
mVolumeControl.setVisibility(View.VISIBLE);
220238
mHideVolumeSlider = false;

0 commit comments

Comments
 (0)