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

Commit

Permalink
Fixes #2948 - Added hover listener for the full media control to hand…
Browse files Browse the repository at this point in the history
…le case when over exits outside of controls (#3386)
  • Loading branch information
daron-walters authored May 28, 2020
1 parent 05537c3 commit 13d3362
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,32 @@ 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();
//for this we only hide on the left side of volume button or outside y area of button
if ((event.getX() <= 0) || (event.getX() >= v.getWidth()) || (!(event.getY() > startY && event.getY() < maxY))) {
mHideVolumeSlider = true;
startVolumeCtrlHandler();

} else {
mVolumeControl.setVisibility(View.VISIBLE);
mHideVolumeSlider = false;
Expand Down

0 comments on commit 13d3362

Please sign in to comment.