Merge "Ignore additional pointers in dispatchTouchEvent." into rvc-dev am: fe71adaa65 am: 2087199828 am: d9a55fb91b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12049282 Change-Id: I4badcb2394fd65bbb3c258949cc959b68e5e23d0
This commit is contained in:
@@ -290,6 +290,12 @@ public class BubbleStackView extends FrameLayout
|
|||||||
/** Whether we're in the middle of dragging the stack around by touch. */
|
/** Whether we're in the middle of dragging the stack around by touch. */
|
||||||
private boolean mIsDraggingStack = false;
|
private boolean mIsDraggingStack = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pointer index of the ACTION_DOWN event we received prior to an ACTION_UP. We'll ignore
|
||||||
|
* touches from other pointer indices.
|
||||||
|
*/
|
||||||
|
private int mPointerIndexDown = -1;
|
||||||
|
|
||||||
/** Description of current animation controller state. */
|
/** Description of current animation controller state. */
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
pw.println("Stack view state:");
|
pw.println("Stack view state:");
|
||||||
@@ -2220,6 +2226,18 @@ public class BubbleStackView extends FrameLayout
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||||
|
if (ev.getAction() != MotionEvent.ACTION_DOWN && ev.getActionIndex() != mPointerIndexDown) {
|
||||||
|
// Ignore touches from additional pointer indices.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
mPointerIndexDown = ev.getActionIndex();
|
||||||
|
} else if (ev.getAction() == MotionEvent.ACTION_UP
|
||||||
|
|| ev.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||||
|
mPointerIndexDown = -1;
|
||||||
|
}
|
||||||
|
|
||||||
boolean dispatched = super.dispatchTouchEvent(ev);
|
boolean dispatched = super.dispatchTouchEvent(ev);
|
||||||
|
|
||||||
// If a new bubble arrives while the collapsed stack is being dragged, it will be positioned
|
// If a new bubble arrives while the collapsed stack is being dragged, it will be positioned
|
||||||
|
|||||||
Reference in New Issue
Block a user