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
This commit is contained in:
Brandon Dayauon
2024-04-18 11:46:43 -07:00
parent 4e68d3992d
commit baf5f6ec3d
4 changed files with 8 additions and 12 deletions

View File

@@ -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>

View File

@@ -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"/>
@@ -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"/>

View File

@@ -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>

View File

@@ -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 =