Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit baf5f6ec authored by Brandon Dayauon's avatar Brandon Dayauon
Browse files

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
parent 4e68d399
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -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>
+4 −1
Original line number Diff line number Diff line
@@ -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"/>
+4 −2
Original line number Diff line number Diff line
@@ -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>
+0 −6
Original line number Diff line number Diff line
@@ -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 =