From 43a161579600c2f7cbce8d96e2474f97983f7d15 Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Tue, 25 Feb 2020 14:29:37 -0800 Subject: [PATCH] Hide apps view in transitions if none of its parts are visible. Check where the all apps view has any pieces visible, if not hide it. Test: local Change-Id: I1d9b957b6c10dfbe4beaa56c4fee920844699a6c --- src/com/android/launcher3/LauncherState.java | 4 ++++ .../launcher3/allapps/AllAppsTransitionController.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index 16be391891..36440c9151 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -74,6 +74,10 @@ public abstract class LauncherState { public static final int VERTICAL_SWIPE_INDICATOR = 1 << 5; public static final int RECENTS_CLEAR_ALL_BUTTON = 1 << 6; + /** Mask of all the items that are contained in the apps view. */ + public static final int APPS_VIEW_ITEM_MASK = + HOTSEAT_SEARCH_BOX | ALL_APPS_HEADER | ALL_APPS_HEADER_EXTRA | ALL_APPS_CONTENT; + protected static final int FLAG_MULTI_PAGE = 1 << 0; protected static final int FLAG_DISABLE_ACCESSIBILITY = 1 << 1; protected static final int FLAG_DISABLE_RESTORE = 1 << 2; diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 6aa3efc277..e49ff30f20 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -2,6 +2,7 @@ package com.android.launcher3.allapps; import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT; import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA; +import static com.android.launcher3.LauncherState.APPS_VIEW_ITEM_MASK; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.VERTICAL_SWIPE_INDICATOR; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_FADE; @@ -203,6 +204,8 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil boolean hasHeaderExtra = (visibleElements & ALL_APPS_HEADER_EXTRA) != 0; boolean hasAllAppsContent = (visibleElements & ALL_APPS_CONTENT) != 0; + boolean hasAnyVisibleItem = (visibleElements & APPS_VIEW_ITEM_MASK) != 0; + Interpolator allAppsFade = builder.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR); Interpolator headerFade = builder.getInterpolator(ANIM_ALL_APPS_HEADER_FADE, allAppsFade); setter.setViewAlpha(mAppsView.getContentView(), hasAllAppsContent ? 1 : 0, allAppsFade); @@ -213,6 +216,8 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA, (visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, allAppsFade); + + setter.setViewAlpha(mAppsView, hasAnyVisibleItem ? 1 : 0, allAppsFade); } public AnimatorListenerAdapter getProgressAnimatorListener() {