mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-01 14:45:08 +00:00
Trying to fix a "jumpy mouse" issue when scrolling
CCMAIL: ahmedibrahimkhali@gmail.com
This commit is contained in:
@@ -15,6 +15,8 @@ public class MousePadActivity extends Activity implements GestureDetector.OnGest
|
|||||||
private float mCurrentX;
|
private float mCurrentX;
|
||||||
private float mCurrentY;
|
private float mCurrentY;
|
||||||
|
|
||||||
|
boolean isScrolling = false;
|
||||||
|
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
private GestureDetector mDetector;
|
private GestureDetector mDetector;
|
||||||
@@ -36,6 +38,14 @@ public class MousePadActivity extends Activity implements GestureDetector.OnGest
|
|||||||
int actionType = event.getAction();
|
int actionType = event.getAction();
|
||||||
final float x = event.getX();
|
final float x = event.getX();
|
||||||
final float y = event.getY();
|
final float y = event.getY();
|
||||||
|
if (isScrolling) {
|
||||||
|
if (actionType == MotionEvent.ACTION_UP) {
|
||||||
|
isScrolling = false;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
switch (actionType) {
|
switch (actionType) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
mPrevX = x;
|
mPrevX = x;
|
||||||
@@ -81,6 +91,7 @@ public class MousePadActivity extends Activity implements GestureDetector.OnGest
|
|||||||
if (e2.getPointerCount() <= 1) {
|
if (e2.getPointerCount() <= 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
isScrolling = true;
|
||||||
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStart(BackgroundService service) {
|
public void onServiceStart(BackgroundService service) {
|
||||||
|
Reference in New Issue
Block a user