diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index ecb0808c48..fe8b3641e3 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -224,8 +224,8 @@ public class Workspace extends PagedView // Variables relating to touch disambiguation (scrolling workspace vs. scrolling a widget) private float mXDown; private float mYDown; - private View mQsb; - private boolean mIsEventOverQsb; + private View mFirstPagePinnedItem; + private boolean mIsEventOverFirstPagePinnedItem; final static float START_DAMPING_TOUCH_SLOP_ANGLE = (float) Math.PI / 6; final static float MAX_SWIPE_ANGLE = (float) Math.PI / 3; @@ -575,20 +575,22 @@ public class Workspace extends PagedView // Add the first page CellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, getChildCount()); - // Always add a QSB on the first screen. - if (mQsb == null) { - // In transposed layout, we add the QSB in the Grid. As workspace does not touch the - // edges, we do not need a full width QSB. - mQsb = LayoutInflater.from(getContext()) + // Always add a first page pinned widget on the first screen. + if (mFirstPagePinnedItem == null) { + // In transposed layout, we add the first page pinned widget in the Grid. + // As workspace does not touch the edges, we do not need a full + // width first page pinned widget. + mFirstPagePinnedItem = LayoutInflater.from(getContext()) .inflate(R.layout.search_container_workspace, firstPage, false); } int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns; CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1); lp.canReorder = false; - if (!firstPage.addViewToCellLayout(mQsb, 0, R.id.search_container_workspace, lp, true)) { + if (!firstPage.addViewToCellLayout( + mFirstPagePinnedItem, 0, R.id.search_container_workspace, lp, true)) { Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout"); - mQsb = null; + mFirstPagePinnedItem = null; } } @@ -597,9 +599,9 @@ public class Workspace extends PagedView // transition animations competing with us changing the scroll when we add pages disableLayoutTransitions(); - // Recycle the QSB widget - if (mQsb != null) { - ((ViewGroup) mQsb.getParent()).removeView(mQsb); + // Recycle the first page pinned widget + if (mFirstPagePinnedItem != null) { + ((ViewGroup) mFirstPagePinnedItem.getParent()).removeView(mFirstPagePinnedItem); } // Remove the pages and clear the screen models @@ -919,8 +921,8 @@ public class Workspace extends PagedView return mScreenOrder; } - protected View getQsb() { - return mQsb; + protected View getFirstPagePinnedItem() { + return mFirstPagePinnedItem; } /** @@ -1074,20 +1076,22 @@ public class Workspace extends PagedView mXDown = ev.getX(); mYDown = ev.getY(); - if (mQsb != null) { + if (mFirstPagePinnedItem != null) { mTempFXY[0] = mXDown + getScrollX(); mTempFXY[1] = mYDown + getScrollY(); - Utilities.mapCoordInSelfToDescendant(mQsb, this, mTempFXY); - mIsEventOverQsb = mQsb.getLeft() <= mTempFXY[0] && mQsb.getRight() >= mTempFXY[0] - && mQsb.getTop() <= mTempFXY[1] && mQsb.getBottom() >= mTempFXY[1]; + Utilities.mapCoordInSelfToDescendant(mFirstPagePinnedItem, this, mTempFXY); + mIsEventOverFirstPagePinnedItem = mFirstPagePinnedItem.getLeft() <= mTempFXY[0] + && mFirstPagePinnedItem.getRight() >= mTempFXY[0] + && mFirstPagePinnedItem.getTop() <= mTempFXY[1] + && mFirstPagePinnedItem.getBottom() >= mTempFXY[1]; } else { - mIsEventOverQsb = false; + mIsEventOverFirstPagePinnedItem = false; } } @Override protected void determineScrollingStart(MotionEvent ev) { - if (!isFinishedSwitchingState() || mIsEventOverQsb) return; + if (!isFinishedSwitchingState() || mIsEventOverFirstPagePinnedItem) return; float deltaX = ev.getX() - mXDown; float absDeltaX = Math.abs(deltaX); @@ -2538,10 +2542,10 @@ public class Workspace extends PagedView } private boolean isDragObjectOverSmartSpace(DragObject dragObject) { - if (mQsb == null) { + if (mFirstPagePinnedItem == null) { return false; } - getViewBoundsRelativeToWorkspace(mQsb, mTempRect); + getViewBoundsRelativeToWorkspace(mFirstPagePinnedItem, mTempRect); return mTempRect.contains(dragObject.x, dragObject.y); } diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index 7699a1ab37..264c0a79dc 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -71,7 +71,7 @@ import com.android.systemui.plugins.ResourceProvider; */ public class WorkspaceStateTransitionAnimation { - private static final float QSB_DISABLED_ALPHA = 0.3f; + private static final float FIRST_PAGE_PINNED_WIDGET_DISABLED_ALPHA = 0.3f; private static final FloatProperty> WORKSPACE_SCALE_PROPERTY = WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_WORKSPACE_STATE); @@ -161,12 +161,12 @@ public class WorkspaceStateTransitionAnimation { if (SHOW_HOME_GARDENING.get()) { propertySetter.setViewAlpha( - mWorkspace.getQsb(), - state == SPRING_LOADED ? QSB_DISABLED_ALPHA : 1, + mWorkspace.getFirstPagePinnedItem(), + state == SPRING_LOADED ? FIRST_PAGE_PINNED_WIDGET_DISABLED_ALPHA : 1, workspaceFadeInterpolator); propertySetter.addEndListener(success -> { if (success) { - mWorkspace.getQsb().setClickable(state != SPRING_LOADED); + mWorkspace.getFirstPagePinnedItem().setClickable(state != SPRING_LOADED); } }); }