From baf5f6ec3db7bbb3f750247ee91280937c297118 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Thu, 18 Apr 2024 11:46:43 -0700 Subject: [PATCH] Polish workFAB with updated spec. Updating the workFAB to the new spec: https://docs.google.com/presentation/d/1tTODboxGqJ3ypEyYnr0-bUpSXcvX1cl6Sj8y0Nut5hU/edit?resourcekey=0-9GT8EJG43kTT4aKPWVWRig#slide=id.g2c8f3ae8e02_0_0 Have the background endPadding to be 4 and icon have an endMargin of 12 and the text endMargin of 16. So that when the text is disappeared, the space between the icon and the right bound is 16dp to spec. bug:332761814 Test manually: after LTR expanded:https://drive.google.com/file/d/1NZQW0CF9VFZBoM3673LFiUknqW2nf4r8/view?usp=sharing after LTR collapsed: https://drive.google.com/file/d/1NRpdTuYQntSs5-yeRL1fJIJy2ETDOYLM/view?usp=sharing after RTL collapsed: https://drive.google.com/file/d/1NE51MIsS5Fk0DwAuzCehEQzTa42OGj_o/view?usp=sharing after RTL expanded: https://drive.google.com/file/d/1NPgiPfzw3DOa_xbB_TtlwK-G1Y5WCi53/view?usp=sharing Flag:None Change-Id: Ied2efcf6b1bd19c191d80e47bae4f8f6e3794803 --- res/drawable/work_mode_fab_background.xml | 3 --- res/layout/work_mode_fab.xml | 5 ++++- res/values/dimens.xml | 6 ++++-- src/com/android/launcher3/allapps/WorkModeSwitch.java | 6 ------ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/res/drawable/work_mode_fab_background.xml b/res/drawable/work_mode_fab_background.xml index 478b8875d2..6be33e86ce 100644 --- a/res/drawable/work_mode_fab_background.xml +++ b/res/drawable/work_mode_fab_background.xml @@ -19,9 +19,6 @@ - diff --git a/res/layout/work_mode_fab.xml b/res/layout/work_mode_fab.xml index 276d73e8fe..b3484c9410 100644 --- a/res/layout/work_mode_fab.xml +++ b/res/layout/work_mode_fab.xml @@ -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"> @@ -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"/> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 9ed1b7229b..1e5a9574ce 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -147,13 +147,15 @@ 56dp 16dp 24dp - 8dp + 12dp + 16dp 10dp 214dp 52dp 16dp 20dp - 16dp + 16dp + 4dp 20dp 16dp 16dp diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java index 72b34c3dbe..60495742fb 100644 --- a/src/com/android/launcher3/allapps/WorkModeSwitch.java +++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java @@ -19,7 +19,6 @@ import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.WindowInsets; -import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -32,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; /** @@ -54,9 +52,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, // 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) { @@ -72,14 +68,12 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, 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 =