From e5142c5c53c40e2a58bd869d6d9f8e30a6a32bb6 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Tue, 12 Apr 2022 17:26:54 -0700 Subject: [PATCH] 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 --- res/drawable/rounded_action_button.xml | 3 ++- res/layout/work_apps_edu.xml | 21 +++++++++---------- res/layout/work_mode_fab.xml | 4 ++-- res/values/dimens.xml | 3 +++ res/values/strings.xml | 2 +- .../allapps/BaseAllAppsContainerView.java | 2 +- .../launcher3/allapps/WorkProfileManager.java | 18 +++++++++++----- 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/res/drawable/rounded_action_button.xml b/res/drawable/rounded_action_button.xml index b9942c0c92..81e94f7e2b 100644 --- a/res/drawable/rounded_action_button.xml +++ b/res/drawable/rounded_action_button.xml @@ -18,10 +18,11 @@ + + android:color="?androidprv:attr/colorSurfaceVariant" /> diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml index 73200de591..f3b3053e13 100644 --- a/res/layout/work_apps_edu.xml +++ b/res/layout/work_apps_edu.xml @@ -16,9 +16,9 @@ - + android:orientation="horizontal"> + android:padding="@dimen/rounded_button_padding"> + android:padding="@dimen/x_icon_padding" + android:src="@drawable/ic_remove_no_shadow" /> - diff --git a/res/layout/work_mode_fab.xml b/res/layout/work_mode_fab.xml index c536d77b43..d2fa5fa066 100644 --- a/res/layout/work_mode_fab.xml +++ b/res/layout/work_mode_fab.xml @@ -21,14 +21,14 @@ android:layout_width="wrap_content" android:gravity="center" android:includeFontPadding="false" + android:textDirection="locale" android:drawableTint="@color/all_apps_tab_text" android:textColor="@color/all_apps_tab_text" android:textSize="14sp" android:background="@drawable/work_apps_toggle_background" android:drawablePadding="8dp" android:drawableStart="@drawable/ic_corp_off" - android:layout_marginBottom="@dimen/work_fab_margin" - android:layout_marginEnd="@dimen/work_fab_margin" + android:layout_marginBottom="@dimen/work_fab_margin_bottom" android:paddingLeft="@dimen/work_mode_fab_padding" android:paddingRight="@dimen/work_mode_fab_padding" android:text="@string/work_apps_pause_btn_text" /> \ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 2c3f5ed6d8..a8ee72101a 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -129,6 +129,7 @@ 6dp 0dp 40dp + 16dp 2dp @@ -148,10 +149,12 @@ 10dp 52dp 16dp + 20dp 16dp 20dp 16dp 16dp + 26dp 24dp diff --git a/res/values/strings.xml b/res/values/strings.xml index ffa1e3f79e..ee5e024dac 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -428,7 +428,7 @@ Got it - Turn off work apps + Pause work apps Turn on work apps diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java index f913aa9093..be012e832b 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -140,7 +140,7 @@ public abstract class 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); }