Merge pull request #7304 from AChep:patch-1

PiperOrigin-RevId: 309395364
This commit is contained in:
Oliver Woodman 2020-05-01 19:50:46 +01:00 committed by Andrew Lewis
parent 2fa2fb73b7
commit 01ff17f3e7

View File

@ -195,7 +195,6 @@ public class DefaultTimeBar extends View implements TimeBar {
private final Formatter formatter; private final Formatter formatter;
private final Runnable stopScrubbingRunnable; private final Runnable stopScrubbingRunnable;
private final CopyOnWriteArraySet<OnScrubListener> listeners; private final CopyOnWriteArraySet<OnScrubListener> listeners;
private final int[] locationOnScreen;
private final Point touchPosition; private final Point touchPosition;
private final float density; private final float density;
@ -249,7 +248,6 @@ public class DefaultTimeBar extends View implements TimeBar {
scrubberPaint = new Paint(); scrubberPaint = new Paint();
scrubberPaint.setAntiAlias(true); scrubberPaint.setAntiAlias(true);
listeners = new CopyOnWriteArraySet<>(); listeners = new CopyOnWriteArraySet<>();
locationOnScreen = new int[2];
touchPosition = new Point(); touchPosition = new Point();
// Calculate the dimensions and paints for drawn elements. // Calculate the dimensions and paints for drawn elements.
@ -755,10 +753,7 @@ public class DefaultTimeBar extends View implements TimeBar {
} }
private Point resolveRelativeTouchPosition(MotionEvent motionEvent) { private Point resolveRelativeTouchPosition(MotionEvent motionEvent) {
getLocationOnScreen(locationOnScreen); touchPosition.set((int) motionEvent.getX(), (int) motionEvent.getY());
touchPosition.set(
((int) motionEvent.getRawX()) - locationOnScreen[0],
((int) motionEvent.getRawY()) - locationOnScreen[1]);
return touchPosition; return touchPosition;
} }