Use the Point class from the framework

Replace our custom Point class by android.graphics.Point.
This commit is contained in:
Romain Vimont 2018-01-31 19:42:08 +01:00
parent b67907e24e
commit 73831a0837
4 changed files with 8 additions and 47 deletions

View file

@ -1,5 +1,6 @@
package com.genymobile.scrcpy;
import android.graphics.Point;
import android.os.Build;
import android.os.RemoteException;
import android.view.IRotationWatcher;
@ -86,8 +87,8 @@ public final class Device {
int contentWidth = videoSize.getWidth() - xPadding;
int contentHeight = videoSize.getHeight() - yPadding;
Point point = position.getPoint();
int x = point.getX() - xPadding / 2;
int y = point.getY() - yPadding / 2;
int x = point.x - xPadding / 2;
int y = point.y - yPadding / 2;
if (x < 0 || x >= contentWidth || y < 0 || y >= contentHeight) {
// out of screen
return null;

View file

@ -1,5 +1,6 @@
package com.genymobile.scrcpy;
import android.graphics.Point;
import android.os.SystemClock;
import android.view.InputDevice;
import android.view.InputEvent;
@ -47,8 +48,8 @@ public class EventController {
private void setPointerCoords(Point point) {
MotionEvent.PointerCoords coords = pointerCoords[0];
coords.x = point.getX();
coords.y = point.getY();
coords.x = point.x;
coords.y = point.y;
}
private void setScroll(int hScroll, int vScroll) {

View file

@ -1,43 +0,0 @@
package com.genymobile.scrcpy;
import java.util.Objects;
public class Point {
private int x;
private int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Point point = (Point) o;
return x == point.x &&
y == point.y;
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
@Override
public String toString() {
return "Point{" +
"x=" + x +
", y=" + y +
'}';
}
}

View file

@ -1,5 +1,7 @@
package com.genymobile.scrcpy;
import android.graphics.Point;
import java.util.Objects;
public class Position {