Extract common codes for personal / work profile tabs

These codes can be reused in the FullWidgetsSheet which we will be
adding tabs for personal / work profile.

Test: Set up work profile and then switch person / work profile tabs
      in the AllAppsContainerView.

Bug: 179797520

Change-Id: Ib7eb1190e1384a664cbe3e34411c9362f1f6db03
This commit is contained in:
Steven Ng
2021-02-17 11:40:07 +00:00
parent e1a8440d78
commit b686972b7d
8 changed files with 178 additions and 107 deletions
@@ -87,17 +87,18 @@ public class LauncherAllAppsContainerView extends AllAppsContainerView {
}
@Override
public void onTabChanged(int pos) {
super.onTabChanged(pos);
public void onActivePageChanged(int currentActivePage) {
super.onActivePageChanged(currentActivePage);
if (mUsingTabs) {
// Log tab switches only when the launcher is in AllApps state
if (mLauncher.getStateManager().getCurrentStableState() == LauncherState.ALL_APPS) {
mLauncher.getStatsLogManager().logger()
.log(pos == AdapterHolder.WORK ? LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB
.log(currentActivePage == AdapterHolder.WORK
? LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB
: LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB);
}
if (pos == AdapterHolder.WORK) {
if (currentActivePage == AdapterHolder.WORK) {
WorkEduView.showWorkEduIfNeeded(mLauncher);
} else {
mWorkTabListener = WorkEduView.showEduFlowIfNeeded(mLauncher, mWorkTabListener);