Merge "changed name and dimensions of work_mode_toggle button, changed outline to surface for the (x) icon.." into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5a726787db
@@ -18,10 +18,11 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="?androidprv:attr/colorSurfaceVariant" />
|
||||
<corners android:radius="@dimen/rounded_button_radius" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="?androidprv:attr/colorAccentPrimaryVariant" />
|
||||
android:color="?androidprv:attr/colorSurfaceVariant" />
|
||||
<padding
|
||||
android:left="@dimen/rounded_button_padding"
|
||||
android:right="@dimen/rounded_button_padding" />
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
<com.android.launcher3.allapps.WorkEduCard xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="@dimen/work_edu_card_margin"
|
||||
android:layout_marginBottom="@dimen/work_edu_card_bottom_margin"
|
||||
android:gravity="center">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -36,30 +36,29 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/work_card_margin"
|
||||
android:layout_marginRight="@dimen/work_card_margin"
|
||||
android:layout_marginEnd="@dimen/work_card_margin"
|
||||
android:text="@string/work_profile_edu_work_apps"
|
||||
android:textDirection="locale"
|
||||
android:textSize="18sp" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/padded_rounded_button_height"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
android:orientation="horizontal">
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/rounded_button_width"
|
||||
android:layout_height="@dimen/rounded_button_width"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/rounded_action_button"
|
||||
android:padding="@dimen/rounded_button_padding"
|
||||
android:layout_alignParentRight="true">
|
||||
android:padding="@dimen/rounded_button_padding">
|
||||
<ImageButton
|
||||
android:id="@+id/action_btn"
|
||||
android:layout_width="@dimen/x_icon_size"
|
||||
android:layout_height="@dimen/x_icon_size"
|
||||
android:id="@+id/action_btn"
|
||||
android:src="@drawable/ic_remove_no_shadow"
|
||||
android:layout_gravity="center"
|
||||
android:padding="@dimen/x_icon_padding" />
|
||||
android:padding="@dimen/x_icon_padding"
|
||||
android:src="@drawable/ic_remove_no_shadow" />
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
@@ -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" />
|
||||
@@ -129,6 +129,7 @@
|
||||
<dimen name="all_apps_height_extra">6dp</dimen>
|
||||
<dimen name="all_apps_bottom_sheet_horizontal_padding">0dp</dimen>
|
||||
<dimen name="all_apps_paged_view_top_padding">40dp</dimen>
|
||||
<dimen name="all_apps_personal_work_tabs_vertical_margin">16dp</dimen>
|
||||
|
||||
<!-- The size of corner radius of the arrow in the arrow toast. -->
|
||||
<dimen name="arrow_toast_corner_radius">2dp</dimen>
|
||||
@@ -148,10 +149,12 @@
|
||||
<dimen name="work_card_padding_horizontal">10dp</dimen>
|
||||
<dimen name="work_card_button_height">52dp</dimen>
|
||||
<dimen name="work_fab_margin">16dp</dimen>
|
||||
<dimen name="work_fab_margin_bottom">20dp</dimen>
|
||||
<dimen name="work_mode_fab_padding">16dp</dimen>
|
||||
<dimen name="work_profile_footer_padding">20dp</dimen>
|
||||
<dimen name="work_edu_card_margin">16dp</dimen>
|
||||
<dimen name="work_edu_card_radius">16dp</dimen>
|
||||
<dimen name="work_edu_card_bottom_margin">26dp</dimen>
|
||||
|
||||
<dimen name="work_card_margin">24dp</dimen>
|
||||
<!-- (x) icon button inside work edu card -->
|
||||
|
||||
@@ -428,7 +428,7 @@
|
||||
<string name="work_apps_paused_edu_accept">Got it</string>
|
||||
|
||||
<!-- button string shown pause work profile -->
|
||||
<string name="work_apps_pause_btn_text">Turn off work apps</string>
|
||||
<string name="work_apps_pause_btn_text">Pause work apps</string>
|
||||
<!-- button string shown enable work profile -->
|
||||
<string name="work_apps_enable_btn_text">Turn on work apps</string>
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
mWorkManager = new WorkProfileManager(
|
||||
mActivityContext.getSystemService(UserManager.class),
|
||||
this,
|
||||
Utilities.getPrefs(mActivityContext));
|
||||
Utilities.getPrefs(mActivityContext), mActivityContext.getDeviceProfile());
|
||||
mAH = Arrays.asList(null, null);
|
||||
mAH.set(AdapterHolder.MAIN, new AdapterHolder(false /* isWork */));
|
||||
mAH.set(AdapterHolder.WORK, new AdapterHolder(true /* isWork */));
|
||||
|
||||
@@ -32,6 +32,7 @@ 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.model.data.ItemInfo;
|
||||
@@ -73,15 +74,17 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
|
||||
private final Predicate<ItemInfo> 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 +144,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 +157,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user