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

Commit

Permalink
Fixes #2948 Fixed unit testing defect where the space between the vol…
Browse files Browse the repository at this point in the history
…ume button and slider was not hiding sliderFixes #2948
  • Loading branch information
daron-walters committed Apr 22, 2020
1 parent 5a7a1be commit 975f53a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand All @@ -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();

Expand All @@ -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
Expand Down

0 comments on commit 975f53a

Please sign in to comment.