From ad7830586299906bd0b1f653e0a8ea1128c16a8c Mon Sep 17 00:00:00 2001 From: arangelov Date: Fri, 17 Aug 2018 14:46:45 +0100 Subject: [PATCH] Highlight work tab when user already in All Apps after creating WP. When a user created a work profile and was already in the All Apps view, the work tab was not highlighted, because the logic for that was only in AllAppsContainerView#onScrollUpEnd(). This CL highlights the tab when the user has resumed and the All Apps view is expanded. Bug: 79242814 Test: Manual Change-Id: I40af0d513c95f8084e21f4e276e9f56bcb06555e --- src/com/android/launcher3/Launcher.java | 1 + .../launcher3/allapps/AllAppsContainerView.java | 7 ++++++- .../allapps/AllAppsTransitionController.java | 12 +++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 7f9932336c..f0ddd53edf 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -353,6 +353,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, public void onEnterAnimationComplete() { super.onEnterAnimationComplete(); UiFactory.onEnterAnimationComplete(this); + mAllAppsController.highlightWorkTabIfNecessary(); } @Override diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 6908ab48a6..3d15c757d0 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -486,8 +486,13 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } public void onScrollUpEnd() { + highlightWorkTabIfNecessary(); + } + + void highlightWorkTabIfNecessary() { if (mUsingTabs) { - ((PersonalWorkSlidingTabStrip) findViewById(R.id.tabs)).highlightWorkTabIfNecessary(); + ((PersonalWorkSlidingTabStrip) findViewById(R.id.tabs)) + .highlightWorkTabIfNecessary(); } } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 24a8d51451..e7313e8411 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -249,11 +249,21 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil if (Float.compare(mProgress, 1f) == 0) { mAppsView.setVisibility(View.INVISIBLE); mAppsView.reset(false /* animate */); - } else if (Float.compare(mProgress, 0f) == 0) { + } else if (isAllAppsExpanded()) { mAppsView.setVisibility(View.VISIBLE); mAppsView.onScrollUpEnd(); } else { mAppsView.setVisibility(View.VISIBLE); } } + + private boolean isAllAppsExpanded() { + return Float.compare(mProgress, 0f) == 0; + } + + public void highlightWorkTabIfNecessary() { + if (isAllAppsExpanded()) { + mAppsView.highlightWorkTabIfNecessary(); + } + } }