Use dispatchTouchEvent for widget drag and prioritize widgets in layout
This commit is contained in:
1 parent
3cf65af790
commit
f4e4cd3884
3 files changed
+31
-32
No files matched your search
@@ -545,7 +545,7 @@ public class LauncherActivity extends NativeActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
switch (ev.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
lifted = false;
|
||||
@@ -553,36 +553,20 @@ public class LauncherActivity extends NativeActivity {
|
||||
downRawY = lastRawY = ev.getRawY();
|
||||
main.removeCallbacks(longPress);
|
||||
main.postDelayed(longPress, 450);
|
||||
break;
|
||||
super.dispatchTouchEvent(ev);
|
||||
return true;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
handleMove(ev);
|
||||
if (lifted) return true;
|
||||
break;
|
||||
return super.dispatchTouchEvent(ev);
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
boolean wasLifted = lifted;
|
||||
handleEnd(ev);
|
||||
if (wasLifted) return true;
|
||||
break;
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
switch (ev.getActionMasked()) {
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
handleMove(ev);
|
||||
if (lifted) return true;
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
boolean wasLifted = lifted;
|
||||
handleEnd(ev);
|
||||
if (wasLifted) return true;
|
||||
break;
|
||||
}
|
||||
return super.onTouchEvent(ev);
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user