Loading src/com/android/launcher3/allapps/AllAppsContainerView.java +11 −9 Original line number Diff line number Diff line Loading @@ -454,7 +454,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mAllAppsStore.unregisterIconContainer(mAH[AdapterHolder.WORK].recyclerView); if (mUsingTabs) { setupWorkToggle(); mAH[AdapterHolder.MAIN].setup(mViewPager.getChildAt(0), mPersonalMatcher); mAH[AdapterHolder.WORK].setup(mViewPager.getChildAt(1), mWorkMatcher); mAH[AdapterHolder.WORK].recyclerView.setId(R.id.apps_list_view_work); Loading Loading @@ -485,6 +484,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } private void setupWorkToggle() { removeWorkToggle(); if (Utilities.ATLEAST_P) { mWorkModeSwitch = (WorkModeSwitch) mLauncher.getLayoutInflater().inflate( R.layout.work_mode_fab, this, false); Loading @@ -497,6 +497,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } } private void removeWorkToggle() { if (mWorkModeSwitch == null) return; if (mWorkModeSwitch.getParent() == this) { this.removeView(mWorkModeSwitch); } mWorkModeSwitch = null; } private void replaceRVContainer(boolean showTabs) { for (int i = 0; i < mAH.length; i++) { AllAppsRecyclerView rv = mAH[i].recyclerView; Loading @@ -519,8 +527,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mViewPager = (AllAppsPagedView) newView; mViewPager.initParentViews(this); mViewPager.getPageIndicator().setOnActivePageChangedListener(this); setupWorkToggle(); } else { mViewPager = null; removeWorkToggle(); } } Loading @@ -539,14 +549,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mWorkModeSwitch.setWorkTabVisible(currentActivePage == AdapterHolder.WORK && mAllAppsStore.hasModelFlag( FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION)); if (currentActivePage == AdapterHolder.WORK) { if (mWorkModeSwitch.getParent() == null) { addView(mWorkModeSwitch); } } else { removeView(mWorkModeSwitch); } } } Loading src/com/android/launcher3/allapps/WorkModeSwitch.java +6 −6 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Nullable private KeyboardInsetAnimationCallback mKeyboardInsetAnimationCallback; private boolean mWorkTabVisible; public WorkModeSwitch(Context context) { this(context, null, 0); Loading Loading @@ -91,11 +92,10 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi */ public void setWorkTabVisible(boolean workTabVisible) { clearAnimation(); if (workTabVisible) { mWorkTabVisible = workTabVisible; if (workTabVisible && mWorkEnabled) { setEnabled(true); if (mWorkEnabled) { setVisibility(VISIBLE); } setAlpha(0); animate().alpha(1).start(); } else { Loading @@ -105,7 +105,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Override public void onClick(View view) { if (Utilities.ATLEAST_P) { if (Utilities.ATLEAST_P && mWorkTabVisible) { setEnabled(false); Launcher.fromContext(getContext()).getStatsLogManager().logger().log( LAUNCHER_TURN_OFF_WORK_APPS_TAP); Loading Loading @@ -137,7 +137,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { if (Utilities.ATLEAST_R) { if (Utilities.ATLEAST_R && mWorkTabVisible) { setTranslationY(0); if (insets.isVisible(WindowInsets.Type.ime())) { Insets keyboardInsets = insets.getInsets(WindowInsets.Type.ime()); Loading Loading
src/com/android/launcher3/allapps/AllAppsContainerView.java +11 −9 Original line number Diff line number Diff line Loading @@ -454,7 +454,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mAllAppsStore.unregisterIconContainer(mAH[AdapterHolder.WORK].recyclerView); if (mUsingTabs) { setupWorkToggle(); mAH[AdapterHolder.MAIN].setup(mViewPager.getChildAt(0), mPersonalMatcher); mAH[AdapterHolder.WORK].setup(mViewPager.getChildAt(1), mWorkMatcher); mAH[AdapterHolder.WORK].recyclerView.setId(R.id.apps_list_view_work); Loading Loading @@ -485,6 +484,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } private void setupWorkToggle() { removeWorkToggle(); if (Utilities.ATLEAST_P) { mWorkModeSwitch = (WorkModeSwitch) mLauncher.getLayoutInflater().inflate( R.layout.work_mode_fab, this, false); Loading @@ -497,6 +497,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } } private void removeWorkToggle() { if (mWorkModeSwitch == null) return; if (mWorkModeSwitch.getParent() == this) { this.removeView(mWorkModeSwitch); } mWorkModeSwitch = null; } private void replaceRVContainer(boolean showTabs) { for (int i = 0; i < mAH.length; i++) { AllAppsRecyclerView rv = mAH[i].recyclerView; Loading @@ -519,8 +527,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mViewPager = (AllAppsPagedView) newView; mViewPager.initParentViews(this); mViewPager.getPageIndicator().setOnActivePageChangedListener(this); setupWorkToggle(); } else { mViewPager = null; removeWorkToggle(); } } Loading @@ -539,14 +549,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mWorkModeSwitch.setWorkTabVisible(currentActivePage == AdapterHolder.WORK && mAllAppsStore.hasModelFlag( FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION)); if (currentActivePage == AdapterHolder.WORK) { if (mWorkModeSwitch.getParent() == null) { addView(mWorkModeSwitch); } } else { removeView(mWorkModeSwitch); } } } Loading
src/com/android/launcher3/allapps/WorkModeSwitch.java +6 −6 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Nullable private KeyboardInsetAnimationCallback mKeyboardInsetAnimationCallback; private boolean mWorkTabVisible; public WorkModeSwitch(Context context) { this(context, null, 0); Loading Loading @@ -91,11 +92,10 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi */ public void setWorkTabVisible(boolean workTabVisible) { clearAnimation(); if (workTabVisible) { mWorkTabVisible = workTabVisible; if (workTabVisible && mWorkEnabled) { setEnabled(true); if (mWorkEnabled) { setVisibility(VISIBLE); } setAlpha(0); animate().alpha(1).start(); } else { Loading @@ -105,7 +105,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Override public void onClick(View view) { if (Utilities.ATLEAST_P) { if (Utilities.ATLEAST_P && mWorkTabVisible) { setEnabled(false); Launcher.fromContext(getContext()).getStatsLogManager().logger().log( LAUNCHER_TURN_OFF_WORK_APPS_TAP); Loading Loading @@ -137,7 +137,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { if (Utilities.ATLEAST_R) { if (Utilities.ATLEAST_R && mWorkTabVisible) { setTranslationY(0); if (insets.isVisible(WindowInsets.Type.ime())) { Insets keyboardInsets = insets.getInsets(WindowInsets.Type.ime()); Loading