Skip to content

Commit

Permalink
Merge pull request #2 from aquirozc/revert-1-adb-scroll-hotfix
Browse files Browse the repository at this point in the history
Revert "Synced latest changes"
  • Loading branch information
aquirozc authored May 2, 2023
2 parents 40c60d4 + 47fac6e commit d9a8609
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ android {
minSdkVersion 24
targetSdkVersion 29
versionCode 106
versionName '1.0.7-rs_adbserver_testbranch-main_lab-test25'
versionName '1.0.7-rs_adbserver_testbranch-tinydisplay_lab-test08'

}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,20 @@ private static GestureDescription createClick (PointF clickPoint, long duration)
return clickBuilder.build();
}

private void createSwipe (PointF originPoint, int direction, int momentum) {

final int DURATION = 300 - scrollSpeed*10;
private GestureDescription createSwipe (PointF originPoint, int direction, int momentum) {
final int DURATION = scrollSpeed + 20;
Path clickPath = new Path();
PointF lineDirection = new PointF(originPoint.x + (75 + momentum) * PointerControl.dirX[direction], originPoint.y + (75+momentum) * PointerControl.dirY[direction]);
mService.shellSwipe((int) originPoint.x, (int) originPoint.y, (int) lineDirection.x, (int) lineDirection.y, DURATION);
PointF lineDirection = new PointF(originPoint.x + (momentum + 75) * PointerControl.dirX[direction], originPoint.y + (momentum + 75) * PointerControl.dirY[direction]);

try {
Thread.sleep(DURATION + 200);
} catch (InterruptedException e) {
Log.e(LOG_TAG, "Thread interrupted: ",e);
}
mService.shellSwipe((int) originPoint.x, (int) originPoint.y, (int) lineDirection.x, (int) lineDirection.y, DURATION);

clickPath.moveTo(originPoint.x, originPoint.y);
clickPath.lineTo(lineDirection.x, lineDirection.y);
GestureDescription.StrokeDescription clickStroke =
new GestureDescription.StrokeDescription(clickPath, 0, DURATION);
GestureDescription.Builder clickBuilder = new GestureDescription.Builder();
clickBuilder.addStroke(clickStroke);
return clickBuilder.build();
}

public boolean perform (KeyEvent keyEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void shellSwipe(Integer x1, Integer y1, Integer x2, Integer y2, Integer d
// Log.i(TAG_NAME, "Succeeded ? ===> " + response.isSuccessful());
// }
// });
sendShellInput("swipe " + x1.toString() + " " + y1.toString() + " " + x2.toString() + " " + y2.toString() + " " + duration.toString());
sendShellInput("swipe " + x1.toString() + " " + y1.toString() + " " + x2.toString() + " " + y2.toString());
}

public void shellTap(Integer x, Integer y) {
Expand Down

0 comments on commit d9a8609

Please sign in to comment.