Fixing missed events during motion interaction

am: b0e80bcee7

Change-Id: Ifd4f5eab7c44db890c3fa1f224b5fd124fd3f406
This commit is contained in:
Sunny Goyal
2016-07-25 21:01:27 +00:00
committed by android-build-merger
2 changed files with 14 additions and 5 deletions
@@ -388,6 +388,8 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
break;
}
}
} else if (action == MotionEvent.ACTION_CANCEL) {
cleanupDeferredDrag();
}
return true;
}
@@ -56,6 +56,9 @@ public class ShortcutsContainerListener implements View.OnTouchListener,
private final int[] mTouchDown;
private boolean mHasMappedTouchDownToContainerCoord;
/** If true, the gesture is not handled. The value is reset when next gesture starts. */
private boolean mIgnoreCurrentGesture;
public ShortcutsContainerListener(BubbleTextView icon) {
mSrcIcon = icon;
mScaledTouchSlop = ViewConfiguration.get(icon.getContext()).getScaledTouchSlop();
@@ -72,18 +75,22 @@ public class ShortcutsContainerListener implements View.OnTouchListener,
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mLauncher.getShortcutIdsForItem((ItemInfo) v.getTag()).isEmpty()) {
// There are no shortcuts associated with this item, so return to normal touch handling.
return false;
}
if (event.getAction() == MotionEvent.ACTION_DOWN) {
// There are no shortcuts associated with this item,
// so return to normal touch handling.
mIgnoreCurrentGesture =
(mLauncher.getShortcutIdsForItem((ItemInfo) v.getTag())).isEmpty();
mTouchDown[0] = (int) event.getX();
mTouchDown[1] = (int) event.getY();
mDragLayer.getDescendantCoordRelativeToSelf(mSrcIcon, mTouchDown);
mHasMappedTouchDownToContainerCoord = false;
}
if (mIgnoreCurrentGesture) {
return false;
}
final boolean wasForwarding = mForwarding;
final boolean forwarding;
if (wasForwarding) {