changed name and dimensions of work_mode_toggle button, changed outline to surface for the (x) icon..

Fixed padding issue (tightness) between Personal/WorkTabs/EduDialog
Aligned Work Toggle button to be the same with the workTabs/eduCard
raised button up 20dp to align with specs

Fixed issue where allApps apps invade the tabs. Fixed RTL issues where it wasn't going RTL.
Fixed RTL issue for the workfab button where there was no margin on the left side of the button
Added DeviceProfile to constructor

Bug: 200810328
Bug: 224731300
Test:
	Before: https://screenshot.googleplex.com/6sRgNZQz4wKYn5n
	After: https://screenshot.googleplex.com/8hBLyDiMbMH9tn2
	After(showingLayoutBounds): https://screenshot.googleplex.com/MuVUXCegukAMzSr

Change-Id: Ibac3f5b8fe7d877c2f54a2c87f4393c1a91dc806
This commit is contained in:
Brandon Dayauon
2022-04-12 17:26:54 -07:00
parent fd64b4f2b3
commit e5142c5c53
7 changed files with 32 additions and 21 deletions
@@ -27,12 +27,12 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import android.view.ViewGroup;
import android.view.WindowInsets;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -73,15 +73,17 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
private final ItemInfoMatcher mMatcher;
private WorkModeSwitch mWorkModeSwitch;
private final DeviceProfile mDeviceProfile;
@WorkProfileState
private int mCurrentState;
public WorkProfileManager(UserManager userManager, BaseAllAppsContainerView<?> allApps,
SharedPreferences preferences) {
SharedPreferences preferences, DeviceProfile deviceProfile) {
mUserManager = userManager;
mAllApps = allApps;
mDeviceProfile = deviceProfile;
mAdapterProvider = new WorkAdapterProvider(allApps.mActivityContext, preferences);
mMatcher = mAllApps.mPersonalMatcher.negate();
}
@@ -141,8 +143,11 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
mWorkModeSwitch = (WorkModeSwitch) mAllApps.getLayoutInflater().inflate(
R.layout.work_mode_fab, mAllApps, false);
}
ViewGroup.MarginLayoutParams lp =
(ViewGroup.MarginLayoutParams) mWorkModeSwitch.getLayoutParams();
int workFabMarginBottom =
mWorkModeSwitch.getResources().getDimensionPixelSize(R.dimen.work_fab_margin);
mWorkModeSwitch.getResources().getDimensionPixelSize(
R.dimen.work_fab_margin_bottom);
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
workFabMarginBottom <<= 1; // Double margin to add space above search bar.
workFabMarginBottom +=
@@ -151,8 +156,11 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
if (!mAllApps.mActivityContext.getDeviceProfile().isGestureMode){
workFabMarginBottom += mAllApps.mActivityContext.getDeviceProfile().getInsets().bottom;
}
((ViewGroup.MarginLayoutParams) mWorkModeSwitch.getLayoutParams()).bottomMargin =
workFabMarginBottom;
lp.bottomMargin = workFabMarginBottom;
int totalScreenWidth = mDeviceProfile.widthPx;
int personalWorkTabWidth =
mAllApps.mActivityContext.getAppsView().getActiveRecyclerView().getTabWidth();
lp.rightMargin = lp.leftMargin = (totalScreenWidth - personalWorkTabWidth) / 2;
if (mWorkModeSwitch.getParent() != mAllApps) {
mAllApps.addView(mWorkModeSwitch);
}