Merge "Correct button measuring" into pi-dev
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user