feat: SystemInputUtils不再处理swipe动作
This commit is contained in:
@@ -79,6 +79,7 @@ public class InputCommandHandler {
|
||||
float relY = (float) command.getY();
|
||||
int x = (int) (relX * screenWidth);
|
||||
int y = (int) (relY * screenHeight);
|
||||
Log.d(TAG, "Motion event: " + action + " at: " + x + ", " + y);
|
||||
inputExecutor.injectMotionEvent(action, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,18 +54,18 @@ public class SystemInputUtils implements InputExecutor {
|
||||
|
||||
@Override
|
||||
public void injectSwipe(int x1, int y1, int x2, int y2, long duration) {
|
||||
long downTime = SystemClock.uptimeMillis();
|
||||
injectMotionEvent(downTime, downTime, MotionEvent.ACTION_DOWN, x1, y1);
|
||||
|
||||
int steps = 10;
|
||||
for (int i = 1; i <= steps; i++) {
|
||||
SystemClock.sleep(duration / steps);
|
||||
int x = x1 + (x2 - x1) * i / steps;
|
||||
int y = y1 + (y2 - y1) * i / steps;
|
||||
injectMotionEvent(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_MOVE, x, y);
|
||||
}
|
||||
|
||||
injectMotionEvent(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, x2, y2);
|
||||
// long downTime = SystemClock.uptimeMillis();
|
||||
// injectMotionEvent(downTime, downTime, MotionEvent.ACTION_DOWN, x1, y1);
|
||||
//
|
||||
// int steps = 10;
|
||||
// for (int i = 1; i <= steps; i++) {
|
||||
// SystemClock.sleep(duration / steps);
|
||||
// int x = x1 + (x2 - x1) * i / steps;
|
||||
// int y = y1 + (y2 - y1) * i / steps;
|
||||
// injectMotionEvent(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_MOVE, x, y);
|
||||
// }
|
||||
//
|
||||
// injectMotionEvent(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, x2, y2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user