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
commit af6baaed90

View File

@ -196,7 +196,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;
@ -248,7 +247,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.
@ -798,10 +796,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;
} }