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

Commit 4afbbfd5 authored by Alan Viverette's avatar Alan Viverette
Browse files

Add insets to dialog background

Also adds inset attribute to InsetDrawable to control all four insets.

BUG: 16868069
Change-Id: I909d05a6dc69747e9092e9ac34551b18d70d2b9f
parent 75e3ad63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -711,6 +711,7 @@ package android {
    field public static final int innerRadiusRatio = 16843163; // 0x101019b
    field public static final deprecated int inputMethod = 16843112; // 0x1010168
    field public static final int inputType = 16843296; // 0x1010220
    field public static final int inset = 16843960; // 0x10104b8
    field public static final int insetBottom = 16843194; // 0x10101ba
    field public static final int insetLeft = 16843191; // 0x10101b7
    field public static final int insetRight = 16843192; // 0x10101b8
+7 −9
Original line number Diff line number Diff line
@@ -14,12 +14,10 @@
     limitations under the License.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners
        android:radius="2dp" />
    <solid
        android:color="?attr/colorBackground" />

<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:inset="16dp">
    <shape android:shape="rectangle">
        <corners android:radius="2dp" />
        <solid android:color="?attr/colorBackground" />
    </shape>
</inset>
+1 −0
Original line number Diff line number Diff line
@@ -4926,6 +4926,7 @@
    <declare-styleable name="InsetDrawable">
        <attr name="visible" />
        <attr name="drawable" />
        <attr name="inset"  format="dimension"/>
        <attr name="insetLeft" format="dimension" />
        <attr name="insetRight" format="dimension" />
        <attr name="insetTop" format="dimension" />
+4 −5
Original line number Diff line number Diff line
@@ -2269,6 +2269,10 @@
  <public type="attr" name="windowReenterTransition" />
  <public type="attr" name="windowSharedElementReturnTransition" />
  <public type="attr" name="windowSharedElementReenterTransition" />
  <public type="attr" name="contentRatingSystemXml"/>
  <public type="attr" name="datePickerMode"/>
  <public type="attr" name="timePickerMode"/>
  <public type="attr" name="inset" />

  <public-padding type="dimen" name="l_resource_pad" end="0x01050010" />

@@ -2560,9 +2564,4 @@
  <public type="raw" name="loaderror" id="0x01100000"/>
  <!-- WebView error page for when domain lookup fails. @hide @SystemApi -->
  <public type="raw" name="nodomain"/>

  <public type="attr" name="contentRatingSystemXml"/>

  <public type="attr" name="datePickerMode"/>
  <public type="attr" name="timePickerMode"/>
</resources>
+33 −13
Original line number Diff line number Diff line
@@ -119,20 +119,40 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
        // Extract the theme attributes, if any.
        state.mThemeAttrs = a.extractThemeAttrs();

        final Drawable dr = a.getDrawable(R.styleable.InsetDrawable_drawable);
        final int N = a.getIndexCount();
        for (int i = 0; i < N; i++) {
            final int attr = a.getIndex(i);
            switch (attr) {
                case R.styleable.InsetDrawable_drawable:
                    final Drawable dr = a.getDrawable(attr);
                    if (dr != null) {
                        state.mDrawable = dr;
                        dr.setCallback(this);
                    }

        state.mInsetLeft = a.getDimensionPixelOffset(
                R.styleable.InsetDrawable_insetLeft, state.mInsetLeft);
        state.mInsetTop = a.getDimensionPixelOffset(
                R.styleable.InsetDrawable_insetTop, state.mInsetTop);
        state.mInsetRight = a.getDimensionPixelOffset(
                R.styleable.InsetDrawable_insetRight, state.mInsetRight);
        state.mInsetBottom = a.getDimensionPixelOffset(
                R.styleable.InsetDrawable_insetBottom, state.mInsetBottom);
                    break;
                case R.styleable.InsetDrawable_inset:
                    final int inset = a.getDimensionPixelOffset(attr, Integer.MIN_VALUE);
                    if (inset != Integer.MIN_VALUE) {
                        state.mInsetLeft = inset;
                        state.mInsetTop = inset;
                        state.mInsetRight = inset;
                        state.mInsetBottom = inset;
                    }
                    break;
                case R.styleable.InsetDrawable_insetLeft:
                    state.mInsetLeft = a.getDimensionPixelOffset(attr, state.mInsetLeft);
                    break;
                case R.styleable.InsetDrawable_insetTop:
                    state.mInsetTop = a.getDimensionPixelOffset(attr, state.mInsetTop);
                    break;
                case R.styleable.InsetDrawable_insetRight:
                    state.mInsetRight = a.getDimensionPixelOffset(attr, state.mInsetRight);
                    break;
                case R.styleable.InsetDrawable_insetBottom:
                    state.mInsetBottom = a.getDimensionPixelOffset(attr, state.mInsetBottom);
                    break;
            }
        }
    }

    @Override