diff --git a/src/com/android/launcher3/AppsContainerRecyclerView.java b/src/com/android/launcher3/AppsContainerRecyclerView.java index 5b1da4b0c9..9584aa283f 100644 --- a/src/com/android/launcher3/AppsContainerRecyclerView.java +++ b/src/com/android/launcher3/AppsContainerRecyclerView.java @@ -402,7 +402,6 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView { int x; int y; int predictionBarHeight = mApps.getPredictedApps().isEmpty() ? 0 : mPredictionBarHeight; - boolean isRtl = Utilities.isRtl(getResources()); int rowCount = getNumRows(); getCurScrollState(mScrollPosState, items); if (mScrollPosState.rowIndex != -1) { @@ -413,7 +412,7 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView { (int) (height / ((float) totalScrollHeight / height))); // Calculate the position and size of the scroll bar - if (isRtl) { + if (Utilities.isRtl(getResources())) { x = mBackgroundPadding.left; } else { x = getWidth() - mBackgroundPadding.right - mScrollbarWidth; @@ -442,11 +441,10 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView { if (mFastScrollAlpha > 0f && !mFastScrollSectionName.isEmpty()) { int x; int y; - boolean isRtl = Utilities.isRtl(getResources()); // Calculate the position for the fast scroller popup Rect bgBounds = mFastScrollerBg.getBounds(); - if (isRtl) { + if (Utilities.isRtl(getResources())) { x = mBackgroundPadding.left + getScrollBarSize(); } else { x = getWidth() - getPaddingRight() - getScrollBarSize() - bgBounds.width(); diff --git a/src/com/android/launcher3/AppsContainerView.java b/src/com/android/launcher3/AppsContainerView.java index 8709101f48..6f7c31351e 100644 --- a/src/com/android/launcher3/AppsContainerView.java +++ b/src/com/android/launcher3/AppsContainerView.java @@ -686,6 +686,19 @@ public class AppsContainerView extends BaseContainerView implements DragSource, } } break; + case MotionEvent.ACTION_MOVE: + if (mPredictionIconUnderTouch != null) { + float dist = (float) Math.hypot(x - mPredictionIconTouchDownPos.x, + y - mPredictionIconTouchDownPos.y); + if (dist > ViewConfiguration.get(getContext()).getScaledTouchSlop()) { + if (mPredictionIconCheckForLongPress != null) { + mPredictionIconCheckForLongPress.cancelLongPress(); + } + mPredictionIconCheckForLongPress = null; + mPredictionIconUnderTouch = null; + } + } + break; case MotionEvent.ACTION_UP: if (mBoundsCheckLastTouchDownPos.x > -1) { ViewConfiguration viewConfig = ViewConfiguration.get(getContext()); @@ -728,8 +741,19 @@ public class AppsContainerView extends BaseContainerView implements DragSource, * Returns the predicted app in the prediction bar given a set of local coordinates. */ private View findPredictedAppAtCoordinate(int x, int y) { - int[] coord = {x, y}; Rect hitRect = new Rect(); + + // Ensure we aren't hitting the search bar + int[] coord = {x, y}; + Utilities.mapCoordInSelfToDescendent(mHeaderView, this, coord); + mHeaderView.getHitRect(hitRect); + if (hitRect.contains(coord[0], coord[1])) { + return null; + } + + // Check against the children of the prediction bar + coord[0] = x; + coord[1] = y; Utilities.mapCoordInSelfToDescendent(mPredictionBarView, this, coord); for (int i = 0; i < mPredictionBarView.getChildCount(); i++) { View child = mPredictionBarView.getChildAt(i);