From 876e462ffa47d297100a2c8c4427d749e1ed0ed8 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 2 Nov 2018 13:50:40 -0700 Subject: [PATCH] Removing separate hotseat widget, instead using a QSB acroll all UI. The QSB is responsible for updating its UI according to various states. Bug: 109828640 Change-Id: Ic8cbf3d404d5870de0f6b8fe25a332b8d21bae20 --- res/layout/all_apps.xml | 4 +- res/layout/hotseat.xml | 28 ----- res/layout/launcher.xml | 15 ++- res/values/config.xml | 1 - src/com/android/launcher3/Hotseat.java | 37 ++---- src/com/android/launcher3/Launcher.java | 22 +--- src/com/android/launcher3/Workspace.java | 116 +++++++----------- .../WorkspaceStateTransitionAnimation.java | 5 +- .../allapps/AllAppsTransitionController.java | 17 +-- .../launcher3/allapps/SearchUiManager.java | 9 ++ .../search/AppsSearchContainerLayout.java | 9 ++ .../graphics/WorkspaceAndHotseatScrim.java | 2 +- 12 files changed, 90 insertions(+), 175 deletions(-) delete mode 100644 res/layout/hotseat.xml diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml index 02d793e1c0..b1e6f2efd7 100644 --- a/res/layout/all_apps.xml +++ b/res/layout/all_apps.xml @@ -26,7 +26,9 @@ android:focusable="false" android:saveEnabled="false" > - + diff --git a/res/layout/hotseat.xml b/res/layout/hotseat.xml deleted file mode 100644 index 00f0b5ff8a..0000000000 --- a/res/layout/hotseat.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml index 304d012d24..87078b93e3 100644 --- a/res/layout/launcher.xml +++ b/res/layout/launcher.xml @@ -56,22 +56,25 @@ android:id="@+id/drop_target_bar" layout="@layout/drop_target_bar" /> - + android:layout_height="match_parent" /> - + android:layout_height="match_parent" + android:theme="@style/HomeScreenElementTheme" + android:importantForAccessibility="no" + launcher:containerType="hotseat" /> + diff --git a/res/values/config.xml b/res/values/config.xml index 4ab22741c6..b33cfa113e 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -131,7 +131,6 @@ - diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index cb354a6f1c..6b5db307bc 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -27,13 +27,12 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; -public class Hotseat extends FrameLayout implements LogContainerProvider, Insettable { +public class Hotseat extends CellLayout implements LogContainerProvider, Insettable { private final Launcher mLauncher; - private CellLayout mContent; @ViewDebug.ExportedProperty(category = "launcher") private boolean mHasVerticalHotseat; @@ -51,38 +50,23 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett mLauncher = Launcher.getLauncher(context); } - public CellLayout getLayout() { - return mContent; - } - - /* Get the orientation invariant order of the item in the hotseat for persistence. */ - int getOrderInHotseat(int x, int y) { - return mHasVerticalHotseat ? (mContent.getCountY() - y - 1) : x; - } - /* Get the orientation specific coordinates given an invariant order in the hotseat. */ int getCellXFromOrder(int rank) { return mHasVerticalHotseat ? 0 : rank; } int getCellYFromOrder(int rank) { - return mHasVerticalHotseat ? (mContent.getCountY() - (rank + 1)) : 0; - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - mContent = findViewById(R.id.layout); + return mHasVerticalHotseat ? (getCountY() - (rank + 1)) : 0; } void resetLayout(boolean hasVerticalHotseat) { - mContent.removeAllViewsInLayout(); + removeAllViewsInLayout(); mHasVerticalHotseat = hasVerticalHotseat; InvariantDeviceProfile idp = mLauncher.getDeviceProfile().inv; if (hasVerticalHotseat) { - mContent.setGridSize(1, idp.numHotseatIcons); + setGridSize(1, idp.numHotseatIcons); } else { - mContent.setGridSize(idp.numHotseatIcons, 1); + setGridSize(idp.numHotseatIcons, 1); } } @@ -90,15 +74,16 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett public boolean onInterceptTouchEvent(MotionEvent ev) { // We don't want any clicks to go through to the hotseat unless the workspace is in // the normal state or an accessible drag is in progress. - return !mLauncher.getWorkspace().workspaceIconsCanBeDragged() && - !mLauncher.getAccessibilityDelegate().isInAccessibleDrag(); + return (!mLauncher.getWorkspace().workspaceIconsCanBeDragged() + && !mLauncher.getAccessibilityDelegate().isInAccessibleDrag()) + || super.onInterceptTouchEvent(ev); } @Override public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) { target.gridX = info.cellX; target.gridY = info.cellY; - targetParent.containerType = ContainerType.HOTSEAT; + targetParent.containerType = LauncherLogProto.ContainerType.HOTSEAT; } @Override @@ -121,7 +106,7 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett lp.height = grid.hotseatBarSizePx + insets.bottom; } Rect padding = grid.getHotseatLayoutPadding(); - getLayout().setPadding(padding.left, padding.top, padding.right, padding.bottom); + setPadding(padding.left, padding.top, padding.right, padding.bottom); setLayoutParams(lp); InsettableFrameLayout.dispatchInsets(this, insets); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 3a38c0fbc8..4090320c48 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -207,7 +207,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, private final int[] mTmpAddItemCellCoordinates = new int[2]; @Thunk Hotseat mHotseat; - @Nullable private View mHotseatSearchBox; private DropTargetBar mDropTargetBar; @@ -914,7 +913,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, mWorkspace.initParentViews(mDragLayer); mOverviewPanel = findViewById(R.id.overview_panel); mHotseat = findViewById(R.id.hotseat); - mHotseatSearchBox = findViewById(R.id.search_container_hotseat); mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION @@ -1159,10 +1157,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, return mHotseat; } - public View getHotseatSearchBox() { - return mHotseatSearchBox; - } - public T getOverviewPanel() { return (T) mOverviewPanel; } @@ -1654,23 +1648,15 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, boolean isHotseatLayout(View layout) { // TODO: Remove this method - return mHotseat != null && layout != null && - (layout instanceof CellLayout) && (layout == mHotseat.getLayout()); + return mHotseat != null && (layout == mHotseat); } /** * Returns the CellLayout of the specified container at the specified screen. */ public CellLayout getCellLayout(int container, int screenId) { - if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { - if (mHotseat != null) { - return mHotseat.getLayout(); - } else { - return null; - } - } else { - return mWorkspace.getScreenWithId(screenId); - } + return (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) + ? mHotseat : mWorkspace.getScreenWithId(screenId); } @Override @@ -2281,7 +2267,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, } writer.println(prefix + " Hotseat"); - ViewGroup layout = mHotseat.getLayout().getShortcutsAndWidgets(); + ViewGroup layout = mHotseat.getShortcutsAndWidgets(); for (int j = 0; j < layout.getChildCount(); j++) { Object tag = layout.getChildAt(j).getTag(); if (tag != null) { diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 3f7d68d12f..7a8d984d74 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -85,8 +85,8 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.IntArray; -import com.android.launcher3.util.IntSparseArrayMap; import com.android.launcher3.util.IntSet; +import com.android.launcher3.util.IntSparseArrayMap; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.Thunk; @@ -880,7 +880,7 @@ public class Workspace extends PagedView final CellLayout layout; if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { - layout = mLauncher.getHotseat().getLayout(); + layout = mLauncher.getHotseat(); // Hide folder title in the hotseat if (child instanceof FolderIcon) { @@ -1517,7 +1517,7 @@ public class Workspace extends PagedView @Override protected void enableAccessibleDrag(boolean enable) { super.enableAccessibleDrag(enable); - setEnableForLayout(mLauncher.getHotseat().getLayout(),enable); + setEnableForLayout(mLauncher.getHotseat(),enable); } }); } @@ -1625,11 +1625,7 @@ public class Workspace extends PagedView mDragViewVisualCenter = d.getVisualCenter(mDragViewVisualCenter); // We want the point to be mapped to the dragTarget. - if (mLauncher.isHotseatLayout(dropTargetLayout)) { - mapPointFromSelfToHotseatLayout(mLauncher.getHotseat(), mDragViewVisualCenter); - } else { - mapPointFromSelfToChild(dropTargetLayout, mDragViewVisualCenter); - } + mapPointFromDropLayout(mLauncher.getHotseat(), mDragViewVisualCenter); int spanX; int spanY; @@ -1831,11 +1827,7 @@ public class Workspace extends PagedView // We want the point to be mapped to the dragTarget. if (dropTargetLayout != null) { - if (mLauncher.isHotseatLayout(dropTargetLayout)) { - mapPointFromSelfToHotseatLayout(mLauncher.getHotseat(), mDragViewVisualCenter); - } else { - mapPointFromSelfToChild(dropTargetLayout, mDragViewVisualCenter); - } + mapPointFromDropLayout(mLauncher.getHotseat(), mDragViewVisualCenter); } boolean droppedOnOriginalCell = false; @@ -2195,7 +2187,7 @@ public class Workspace extends PagedView * Convert the 2D coordinate xy from the parent View's coordinate space to this CellLayout's * coordinate space. The argument xy is modified with the return result. */ - void mapPointFromSelfToChild(View v, float[] xy) { + private void mapPointFromSelfToChild(View v, float[] xy) { xy[0] = xy[0] - v.getLeft(); xy[1] = xy[1] - v.getTop(); } @@ -2211,14 +2203,23 @@ public class Workspace extends PagedView mTempXY[1] <= hotseat.getBottom(); } - void mapPointFromSelfToHotseatLayout(Hotseat hotseat, float[] xy) { - mTempXY[0] = (int) xy[0]; - mTempXY[1] = (int) xy[1]; - mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(this, mTempXY, true); - mLauncher.getDragLayer().mapCoordInSelfToDescendant(hotseat.getLayout(), mTempXY); + /** + * Updates the point in {@param xy} to point to the co-ordinate space of {@param layout} + * @param layout either hotseat of a page in workspace + * @param xy the point location in workspace co-ordinate space + */ + private void mapPointFromDropLayout(CellLayout layout, float[] xy) { + if (mLauncher.isHotseatLayout(layout)) { + mTempXY[0] = (int) xy[0]; + mTempXY[1] = (int) xy[1]; + mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(this, mTempXY, true); + mLauncher.getDragLayer().mapCoordInSelfToDescendant(layout, mTempXY); - xy[0] = mTempXY[0]; - xy[1] = mTempXY[1]; + xy[0] = mTempXY[0]; + xy[1] = mTempXY[1]; + } else { + mapPointFromSelfToChild(layout, xy); + } } private boolean isDragWidget(DragObject d) { @@ -2254,11 +2255,7 @@ public class Workspace extends PagedView // Handle the drag over if (mDragTargetLayout != null) { // We want the point to be mapped to the dragTarget. - if (mLauncher.isHotseatLayout(mDragTargetLayout)) { - mapPointFromSelfToHotseatLayout(mLauncher.getHotseat(), mDragViewVisualCenter); - } else { - mapPointFromSelfToChild(mDragTargetLayout, mDragViewVisualCenter); - } + mapPointFromDropLayout(mLauncher.getHotseat(), mDragViewVisualCenter); int minSpanX = item.spanX; int minSpanY = item.spanY; @@ -2329,7 +2326,7 @@ public class Workspace extends PagedView // Test to see if we are over the hotseat first if (mLauncher.getHotseat() != null && !isDragWidget(d)) { if (isPointInSelfOverHotseat(d.x, d.y)) { - layout = mLauncher.getHotseat().getLayout(); + layout = mLauncher.getHotseat(); } } @@ -2967,8 +2964,7 @@ public class Workspace extends PagedView * Returns a specific CellLayout */ CellLayout getParentCellLayoutForView(View v) { - ArrayList layouts = getWorkspaceAndHotseatCellLayouts(); - for (CellLayout layout : layouts) { + for (CellLayout layout : getWorkspaceAndHotseatCellLayouts()) { if (layout.getShortcutsAndWidgets().indexOfChild(v) > -1) { return layout; } @@ -2977,56 +2973,31 @@ public class Workspace extends PagedView } /** - * Returns a list of all the CellLayouts in the workspace. + * Returns a list of all the CellLayouts on the Homescreen. */ - ArrayList getWorkspaceAndHotseatCellLayouts() { - ArrayList layouts = new ArrayList<>(); + private CellLayout[] getWorkspaceAndHotseatCellLayouts() { int screenCount = getChildCount(); - for (int screen = 0; screen < screenCount; screen++) { - layouts.add(((CellLayout) getChildAt(screen))); - } + final CellLayout[] layouts; if (mLauncher.getHotseat() != null) { - layouts.add(mLauncher.getHotseat().getLayout()); + layouts = new CellLayout[screenCount + 1]; + layouts[screenCount] = mLauncher.getHotseat(); + } else { + layouts = new CellLayout[screenCount]; + } + for (int screen = 0; screen < screenCount; screen++) { + layouts[screen] = (CellLayout) getChildAt(screen); } return layouts; } - /** - * We should only use this to search for specific children. Do not use this method to modify - * ShortcutsAndWidgetsContainer directly. Includes ShortcutAndWidgetContainers from - * the hotseat and workspace pages - */ - ArrayList getAllShortcutAndWidgetContainers() { - ArrayList childrenLayouts = new ArrayList<>(); - int screenCount = getChildCount(); - for (int screen = 0; screen < screenCount; screen++) { - childrenLayouts.add(((CellLayout) getChildAt(screen)).getShortcutsAndWidgets()); - } - if (mLauncher.getHotseat() != null) { - childrenLayouts.add(mLauncher.getHotseat().getLayout().getShortcutsAndWidgets()); - } - return childrenLayouts; - } - public View getHomescreenIconByItemId(final int id) { - return getFirstMatch(new ItemOperator() { - - @Override - public boolean evaluate(ItemInfo info, View v) { - return info != null && info.id == id; - } - }); + return getFirstMatch((info, v) -> info != null && info.id == id); } public LauncherAppWidgetHostView getWidgetForAppWidgetId(final int appWidgetId) { - return (LauncherAppWidgetHostView) getFirstMatch(new ItemOperator() { - - @Override - public boolean evaluate(ItemInfo info, View v) { - return (info instanceof LauncherAppWidgetInfo) && - ((LauncherAppWidgetInfo) info).appWidgetId == appWidgetId; - } - }); + return (LauncherAppWidgetHostView) getFirstMatch((info, v) -> + (info instanceof LauncherAppWidgetInfo) && + ((LauncherAppWidgetInfo) info).appWidgetId == appWidgetId); } public View getFirstMatch(final ItemOperator operator) { @@ -3063,8 +3034,7 @@ public class Workspace extends PagedView * shortcuts are not removed. */ public void removeItemsByMatcher(final ItemInfoMatcher matcher) { - ArrayList cellLayouts = getWorkspaceAndHotseatCellLayouts(); - for (final CellLayout layoutParent: cellLayouts) { + for (final CellLayout layoutParent: getWorkspaceAndHotseatCellLayouts()) { final ViewGroup layout = layoutParent.getShortcutsAndWidgets(); IntSparseArrayMap idToViewMap = new IntSparseArrayMap<>(); @@ -3122,10 +3092,8 @@ public class Workspace extends PagedView * @param op the operator to map over the shortcuts */ public void mapOverItems(boolean recurse, ItemOperator op) { - ArrayList containers = getAllShortcutAndWidgetContainers(); - final int containerCount = containers.size(); - for (int containerIdx = 0; containerIdx < containerCount; containerIdx++) { - ShortcutAndWidgetContainer container = containers.get(containerIdx); + for (CellLayout layout : getWorkspaceAndHotseatCellLayouts()) { + ShortcutAndWidgetContainer container = layout.getShortcutsAndWidgets(); // map over all the shortcuts on the workspace final int itemCount = container.getChildCount(); for (int itemIdx = 0; itemIdx < itemCount; itemIdx++) { diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index e734e70533..3e094935d9 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -88,7 +88,7 @@ public class WorkspaceStateTransitionAnimation { Interpolator scaleInterpolator = builder.getInterpolator(ANIM_WORKSPACE_SCALE, ZOOM_OUT); propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator); float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0; - propertySetter.setViewAlpha(mLauncher.getHotseat().getLayout(), hotseatIconsAlpha, + propertySetter.setViewAlpha(mLauncher.getHotseat(), hotseatIconsAlpha, fadeInterpolator); propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(), hotseatIconsAlpha, fadeInterpolator); @@ -105,9 +105,6 @@ public class WorkspaceStateTransitionAnimation { propertySetter.setFloat(mWorkspace, View.TRANSLATION_Y, scaleAndTranslation[2], translationInterpolator); - propertySetter.setViewAlpha(mLauncher.getHotseatSearchBox(), - (elements & HOTSEAT_SEARCH_BOX) != 0 ? 1 : 0, fadeInterpolator); - // Set scrim WorkspaceAndHotseatScrim scrim = mLauncher.getDragLayer().getScrim(); propertySetter.setFloat(scrim, SCRIM_PROGRESS, state.getWorkspaceScrimAlpha(mLauncher), diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index e7313e8411..2d6be7b08c 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -91,11 +91,6 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil return mShiftRange; } - private void onProgressAnimationStart() { - // Initialize values that should not change until #onDragEnd - mAppsView.setVisibility(View.VISIBLE); - } - @Override public void onDeviceProfileChanged(DeviceProfile dp) { mIsVerticalLayout = dp.isVerticalBarLayout(); @@ -195,16 +190,15 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil PropertySetter setter = config == null ? NO_ANIM_PROPERTY_SETTER : config.getPropertySetter(builder); int visibleElements = toState.getVisibleElements(mLauncher); - boolean hasHeader = (visibleElements & ALL_APPS_HEADER) != 0; boolean hasHeaderExtra = (visibleElements & ALL_APPS_HEADER_EXTRA) != 0; boolean hasContent = (visibleElements & ALL_APPS_CONTENT) != 0; Interpolator allAppsFade = builder.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR); - setter.setViewAlpha(mAppsView.getSearchView(), hasHeader ? 1 : 0, allAppsFade); setter.setViewAlpha(mAppsView.getContentView(), hasContent ? 1 : 0, allAppsFade); setter.setViewAlpha(mAppsView.getScrollBar(), hasContent ? 1 : 0, allAppsFade); mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasContent, setter, allAppsFade); + mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade); setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA, (visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, LINEAR); @@ -216,11 +210,6 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil public void onAnimationSuccess(Animator animator) { onProgressAnimationEnd(); } - - @Override - public void onAnimationStart(Animator animation) { - onProgressAnimationStart(); - } }; } @@ -247,13 +236,9 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil */ private void onProgressAnimationEnd() { if (Float.compare(mProgress, 1f) == 0) { - mAppsView.setVisibility(View.INVISIBLE); mAppsView.reset(false /* animate */); } else if (isAllAppsExpanded()) { - mAppsView.setVisibility(View.VISIBLE); mAppsView.onScrollUpEnd(); - } else { - mAppsView.setVisibility(View.VISIBLE); } } diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java index 68193f5c1c..51b90f71eb 100644 --- a/src/com/android/launcher3/allapps/SearchUiManager.java +++ b/src/com/android/launcher3/allapps/SearchUiManager.java @@ -16,6 +16,9 @@ package com.android.launcher3.allapps; import android.view.KeyEvent; +import android.view.animation.Interpolator; + +import com.android.launcher3.anim.PropertySetter; /** * Interface for controlling the Apps search UI. @@ -37,4 +40,10 @@ public interface SearchUiManager { * some UI beforehand. */ void preDispatchKeyEvent(KeyEvent keyEvent); + + /** + * Called as part of state transition to update the content UI + */ + void setContentVisibility(int visibleElements, PropertySetter setter, + Interpolator interpolator); } diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java index 15cc2caae6..b1e23d4e22 100644 --- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java @@ -19,6 +19,7 @@ import static android.view.View.MeasureSpec.EXACTLY; import static android.view.View.MeasureSpec.getSize; import static android.view.View.MeasureSpec.makeMeasureSpec; +import static com.android.launcher3.LauncherState.ALL_APPS_HEADER; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; import android.content.Context; @@ -32,6 +33,7 @@ import android.util.AttributeSet; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup.MarginLayoutParams; +import android.view.animation.Interpolator; import com.android.launcher3.DeviceProfile; import com.android.launcher3.ExtendedEditText; @@ -42,6 +44,7 @@ import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AlphabeticalAppsList; import com.android.launcher3.allapps.SearchUiManager; +import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.graphics.TintedDrawableSpan; import com.android.launcher3.util.ComponentKey; @@ -214,4 +217,10 @@ public class AppsSearchContainerLayout extends ExtendedEditText insets.bottom + mlp.topMargin + mFixedTranslationY); } } + + @Override + public void setContentVisibility(int visibleElements, PropertySetter setter, + Interpolator interpolator) { + setter.setViewAlpha(this, (visibleElements & ALL_APPS_HEADER) != 0 ? 1 : 0, interpolator); + } } diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java index 6c98d16b42..23d647b441 100644 --- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java +++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java @@ -167,7 +167,7 @@ public class WorkspaceAndHotseatScrim implements mWorkspace.computeScrollWithoutInvalidation(); CellLayout currCellLayout = mWorkspace.getCurrentDragOverlappingLayout(); canvas.save(); - if (currCellLayout != null && currCellLayout != mLauncher.getHotseat().getLayout()) { + if (currCellLayout != null && currCellLayout != mLauncher.getHotseat()) { // Cut a hole in the darkening scrim on the page that should be highlighted, if any. mLauncher.getDragLayer() .getDescendantRectRelativeToSelf(currCellLayout, mHighlightRect);