diff options
| -rw-r--r-- | packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml | 5 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java | 32 |
2 files changed, 34 insertions, 3 deletions
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml index 828c9df4525e..611aa4399cb2 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:clipToPadding="false" @@ -37,7 +37,8 @@ android:textColor="?attr/wallpaperTextColor" 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_height="wrap_content" android:orientation="horizontal" diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java index 6b9920696baf..f0952f9641f2 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java @@ -331,6 +331,37 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe 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. */ @@ -344,7 +375,6 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe setPadding(horizontalPadding / 2, 0, horizontalPadding / 2, 0); setCompoundDrawablePadding((int) context.getResources() .getDimension(R.dimen.widget_icon_padding)); - setMaxWidth(KeyguardSliceView.this.getWidth() / 2); setMaxLines(1); setEllipsize(TruncateAt.END); } |