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

Commit 58c5e657 authored by Yogisha Dixit's avatar Yogisha Dixit
Browse files

Center drop target icons in landscape mode.

Spec: https://docs.google.com/presentation/d/1UxdDh8EFhPbdRWRwzjbpgL-j02ew4Ew3eG3XBCeoYdo/edit#slide=id.vXfwHn8

Test: manual
Bug: 187376586
Change-Id: I2025ba75061a5ca3a004dfef2b33cdbcc17a1408
parent de268a51
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
    <dimen name="workspace_page_indicator_overlap_workspace">0dp</dimen>

<!-- Drop target bar -->
    <dimen name="dynamic_grid_drop_target_size">48dp</dimen>
    <dimen name="dynamic_grid_drop_target_size">52dp</dimen>
    <dimen name="drop_target_vertical_gap">20dp</dimen>

<!-- App Widget resize frame -->
+2 −3
Original line number Diff line number Diff line
@@ -264,9 +264,8 @@

    <!-- Drop targets -->
    <style name="DropTargetButtonBase" parent="@android:style/TextAppearance.DeviceDefault">
        <item name="android:drawablePadding">7.5dp</item>
        <item name="android:paddingLeft">16dp</item>
        <item name="android:paddingRight">16dp</item>
        <item name="android:drawablePadding">8dp</item>
        <item name="android:padding">16dp</item>
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textSize">@dimen/drop_target_text_size</item>
        <item name="android:singleLine">true</item>
+4 −12
Original line number Diff line number Diff line
@@ -121,19 +121,11 @@ public abstract class ButtonDropTarget extends TextView
    }

    protected void setDrawable(int resId) {
        mDrawable = getContext().getDrawable(resId).mutate();
        mDrawable.setBounds(0, 0, mDrawableSize, mDrawableSize);
        setDrawable(mDrawable);
    }

    private void setDrawable(Drawable drawable) {
        // We do not set the drawable in the xml as that inflates two drawables corresponding to
        // drawableLeft and drawableStart.
        if (mTextVisible) {
            setCompoundDrawablesRelative(drawable, null, null, null);
        } else {
            setCompoundDrawablesRelative(null, drawable, null, null);
        }
        mDrawable = getContext().getDrawable(resId).mutate();
        mDrawable.setBounds(0, 0, mDrawableSize, mDrawableSize);
        setCompoundDrawablesRelative(mDrawable, null, null, null);
    }

    public void setDropTargetBar(DropTargetBar dropTargetBar) {
@@ -334,7 +326,7 @@ public abstract class ButtonDropTarget extends TextView
        if (mTextVisible != isVisible || !TextUtils.equals(newText, getText())) {
            mTextVisible = isVisible;
            setText(newText);
            setDrawable(mDrawable);
            setCompoundDrawablesRelative(mDrawable, null, null, null);
        }
    }