Loading res/drawable/work_mode_fab_background.xml +0 −3 Original line number Diff line number Diff line Loading @@ -19,9 +19,6 @@ <shape android:shape="rectangle"> <corners android:radius="@dimen/work_fab_radius" /> <solid android:color="@color/work_fab_bg_color" /> <padding android:left="@dimen/work_profile_footer_padding" android:right="@dimen/work_profile_footer_padding" /> </shape> </item> </ripple> res/layout/work_mode_fab.xml +4 −1 Original line number Diff line number Diff line Loading @@ -24,12 +24,15 @@ android:background="@drawable/work_mode_fab_background" android:forceHasOverlappingRendering="false" android:contentDescription="@string/work_apps_pause_btn_text" android:paddingStart="@dimen/work_mode_fab_background_start_padding" android:paddingEnd="@dimen/work_mode_fab_background_end_padding" android:animateLayoutChanges="true"> <ImageView android:id="@+id/work_icon" android:layout_width="@dimen/work_fab_icon_size" android:layout_height="@dimen/work_fab_icon_size" android:importantForAccessibility="no" android:layout_marginEnd="@dimen/work_fab_icon_end_margin" android:src="@drawable/ic_corp_off" android:tint="@color/work_fab_icon_color" android:scaleType="center"/> Loading @@ -43,7 +46,7 @@ android:includeFontPadding="false" android:textDirection="locale" android:text="@string/work_apps_pause_btn_text" android:layout_marginStart="@dimen/work_fab_text_start_margin" android:layout_marginEnd="@dimen/work_fab_text_end_margin" android:ellipsize="end" android:maxLines="1" style="@style/TextHeadline"/> Loading res/values/dimens.xml +4 −2 Original line number Diff line number Diff line Loading @@ -147,13 +147,15 @@ <dimen name="work_fab_height">56dp</dimen> <dimen name="work_fab_radius">16dp</dimen> <dimen name="work_fab_icon_size">24dp</dimen> <dimen name="work_fab_text_start_margin">8dp</dimen> <dimen name="work_fab_icon_end_margin">12dp</dimen> <dimen name="work_fab_text_end_margin">16dp</dimen> <dimen name="work_card_padding_horizontal">10dp</dimen> <dimen name="work_fab_width">214dp</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_mode_fab_background_start_padding">16dp</dimen> <dimen name="work_mode_fab_background_end_padding">4dp</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> Loading src/com/android/launcher3/allapps/WorkModeSwitch.java +3 −15 Original line number Diff line number Diff line Loading @@ -15,14 +15,10 @@ */ package com.android.launcher3.allapps; import static com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.getTabWidth; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.view.WindowInsets; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; Loading @@ -35,7 +31,6 @@ import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.KeyboardInsetAnimationCallback; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.StringCache; import com.android.launcher3.views.ActivityContext; /** Loading @@ -53,12 +48,11 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, private final Rect mImeInsets = new Rect(); private int mFlags; private final ActivityContext mActivityContext; private final Context mContext; // Threshold when user scrolls up/down to determine when should button extend/collapse private final int mScrollThreshold; private ImageView mIcon; private TextView mTextView; private final StatsLogManager mStatsLogManager; public WorkModeSwitch(@NonNull Context context) { Loading @@ -71,16 +65,15 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, public WorkModeSwitch(@NonNull Context context, @NonNull AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mContext = context; mScrollThreshold = Utilities.dpToPx(SCROLL_THRESHOLD_DP); mActivityContext = ActivityContext.lookupContext(getContext()); mStatsLogManager = mActivityContext.getStatsLogManager(); } @Override protected void onFinishInflate() { super.onFinishInflate(); mIcon = findViewById(R.id.work_icon); mTextView = findViewById(R.id.pause_text); setSelected(true); KeyboardInsetAnimationCallback keyboardInsetAnimationCallback = Loading Loading @@ -114,13 +107,8 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); View parent = (View) getParent(); boolean isRtl = Utilities.isRtl(getResources()); Rect allAppsPadding = mActivityContext.getDeviceProfile().allAppsPadding; int size = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight() - (allAppsPadding.left + allAppsPadding.right); int tabWidth = getTabWidth(getContext(), size); int shift = (size - tabWidth) / 2 + (isRtl ? allAppsPadding.left : allAppsPadding.right); int shift = mActivityContext.getDeviceProfile().getAllAppsIconStartMargin(mContext); setTranslationX(isRtl ? shift : -shift); } Loading Loading
res/drawable/work_mode_fab_background.xml +0 −3 Original line number Diff line number Diff line Loading @@ -19,9 +19,6 @@ <shape android:shape="rectangle"> <corners android:radius="@dimen/work_fab_radius" /> <solid android:color="@color/work_fab_bg_color" /> <padding android:left="@dimen/work_profile_footer_padding" android:right="@dimen/work_profile_footer_padding" /> </shape> </item> </ripple>
res/layout/work_mode_fab.xml +4 −1 Original line number Diff line number Diff line Loading @@ -24,12 +24,15 @@ android:background="@drawable/work_mode_fab_background" android:forceHasOverlappingRendering="false" android:contentDescription="@string/work_apps_pause_btn_text" android:paddingStart="@dimen/work_mode_fab_background_start_padding" android:paddingEnd="@dimen/work_mode_fab_background_end_padding" android:animateLayoutChanges="true"> <ImageView android:id="@+id/work_icon" android:layout_width="@dimen/work_fab_icon_size" android:layout_height="@dimen/work_fab_icon_size" android:importantForAccessibility="no" android:layout_marginEnd="@dimen/work_fab_icon_end_margin" android:src="@drawable/ic_corp_off" android:tint="@color/work_fab_icon_color" android:scaleType="center"/> Loading @@ -43,7 +46,7 @@ android:includeFontPadding="false" android:textDirection="locale" android:text="@string/work_apps_pause_btn_text" android:layout_marginStart="@dimen/work_fab_text_start_margin" android:layout_marginEnd="@dimen/work_fab_text_end_margin" android:ellipsize="end" android:maxLines="1" style="@style/TextHeadline"/> Loading
res/values/dimens.xml +4 −2 Original line number Diff line number Diff line Loading @@ -147,13 +147,15 @@ <dimen name="work_fab_height">56dp</dimen> <dimen name="work_fab_radius">16dp</dimen> <dimen name="work_fab_icon_size">24dp</dimen> <dimen name="work_fab_text_start_margin">8dp</dimen> <dimen name="work_fab_icon_end_margin">12dp</dimen> <dimen name="work_fab_text_end_margin">16dp</dimen> <dimen name="work_card_padding_horizontal">10dp</dimen> <dimen name="work_fab_width">214dp</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_mode_fab_background_start_padding">16dp</dimen> <dimen name="work_mode_fab_background_end_padding">4dp</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> Loading
src/com/android/launcher3/allapps/WorkModeSwitch.java +3 −15 Original line number Diff line number Diff line Loading @@ -15,14 +15,10 @@ */ package com.android.launcher3.allapps; import static com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.getTabWidth; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.view.WindowInsets; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; Loading @@ -35,7 +31,6 @@ import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.KeyboardInsetAnimationCallback; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.StringCache; import com.android.launcher3.views.ActivityContext; /** Loading @@ -53,12 +48,11 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, private final Rect mImeInsets = new Rect(); private int mFlags; private final ActivityContext mActivityContext; private final Context mContext; // Threshold when user scrolls up/down to determine when should button extend/collapse private final int mScrollThreshold; private ImageView mIcon; private TextView mTextView; private final StatsLogManager mStatsLogManager; public WorkModeSwitch(@NonNull Context context) { Loading @@ -71,16 +65,15 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, public WorkModeSwitch(@NonNull Context context, @NonNull AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mContext = context; mScrollThreshold = Utilities.dpToPx(SCROLL_THRESHOLD_DP); mActivityContext = ActivityContext.lookupContext(getContext()); mStatsLogManager = mActivityContext.getStatsLogManager(); } @Override protected void onFinishInflate() { super.onFinishInflate(); mIcon = findViewById(R.id.work_icon); mTextView = findViewById(R.id.pause_text); setSelected(true); KeyboardInsetAnimationCallback keyboardInsetAnimationCallback = Loading Loading @@ -114,13 +107,8 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); View parent = (View) getParent(); boolean isRtl = Utilities.isRtl(getResources()); Rect allAppsPadding = mActivityContext.getDeviceProfile().allAppsPadding; int size = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight() - (allAppsPadding.left + allAppsPadding.right); int tabWidth = getTabWidth(getContext(), size); int shift = (size - tabWidth) / 2 + (isRtl ? allAppsPadding.left : allAppsPadding.right); int shift = mActivityContext.getDeviceProfile().getAllAppsIconStartMargin(mContext); setTranslationX(isRtl ? shift : -shift); } Loading