Fix work toggle button to be placed where it should be.

Previously, the implementation used the entire screen width
within it's calculations to determine where the button should be placed.
This is wrong because allApps have it's own container which we should
take the width from. The current implementation works fine because
the width of the screen for phones is the same width as the allApps container
BUT this implemention is WRONG for tablets. With now using the
allApps width for the calculation .. it works for both tablets/phones.

Bug: 235054324
Test: Photos in bug thread
Change-Id: I4c771d310a5d33646ad618e9c241cb5662493747
This commit is contained in:
Brandon Dayauon
2022-06-10 15:29:10 -07:00
parent adc7347719
commit 9d87b0c317
@@ -158,10 +158,10 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
workFabMarginBottom += mAllApps.mActivityContext.getDeviceProfile().getInsets().bottom;
}
lp.bottomMargin = workFabMarginBottom;
int totalScreenWidth = mDeviceProfile.widthPx;
int allAppsContainerWidth = mAllApps.getVisibleContainerView().getWidth();
int personalWorkTabWidth =
mAllApps.mActivityContext.getAppsView().getFloatingHeaderView().getTabWidth();
lp.rightMargin = lp.leftMargin = (totalScreenWidth - personalWorkTabWidth) / 2;
lp.rightMargin = lp.leftMargin = (allAppsContainerWidth - personalWorkTabWidth) / 2;
if (mWorkModeSwitch.getParent() != mAllApps) {
mAllApps.addView(mWorkModeSwitch);
}