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

Commit e5f71abd authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Correct button measuring" into pi-dev

am: 75572343

Change-Id: I61d5cdf72fc61423c433644dcf2fe9d0a2a3be67
parents 40a1f6b2 75572343
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_marginStart="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginEnd="16dp"
    android:layout_marginEnd="16dp"
    android:layout_width="wrap_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_gravity="center_horizontal"
    android:clipToPadding="false"
    android:clipToPadding="false"
@@ -37,7 +37,8 @@
              android:textColor="?attr/wallpaperTextColor"
              android:textColor="?attr/wallpaperTextColor"
              android:theme="@style/TextAppearance.Keyguard"
              android:theme="@style/TextAppearance.Keyguard"
    />
    />
    <LinearLayout android:id="@+id/row"
    <view class="com.android.keyguard.KeyguardSliceView$Row"
              android:id="@+id/row"
              android:layout_width="match_parent"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              android:orientation="horizontal"
+31 −1
Original line number Original line Diff line number Diff line
@@ -331,6 +331,37 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe
        updateVisibility();
        updateVisibility();
    }
    }


    public static class Row extends LinearLayout {

        public Row(Context context) {
            super(context);
        }

        public Row(Context context, AttributeSet attrs) {
            super(context, attrs);
        }

        public Row(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }

        public Row(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
            super(context, attrs, defStyleAttr, defStyleRes);
        }

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            int width = MeasureSpec.getSize(widthMeasureSpec);
            for (int i = 0; i < getChildCount(); i++) {
                View child = getChildAt(i);
                if (child instanceof KeyguardSliceButton) {
                    ((KeyguardSliceButton) child).setMaxWidth(width / 2);
                }
            }
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }
    }

    /**
    /**
     * Representation of an item that appears under the clock on main keyguard message.
     * Representation of an item that appears under the clock on main keyguard message.
     */
     */
@@ -344,7 +375,6 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe
            setPadding(horizontalPadding / 2, 0, horizontalPadding / 2, 0);
            setPadding(horizontalPadding / 2, 0, horizontalPadding / 2, 0);
            setCompoundDrawablePadding((int) context.getResources()
            setCompoundDrawablePadding((int) context.getResources()
                    .getDimension(R.dimen.widget_icon_padding));
                    .getDimension(R.dimen.widget_icon_padding));
            setMaxWidth(KeyguardSliceView.this.getWidth() / 2);
            setMaxLines(1);
            setMaxLines(1);
            setEllipsize(TruncateAt.END);
            setEllipsize(TruncateAt.END);
        }
        }