Loading api/current.txt +5 −12 Original line number Original line Diff line number Diff line Loading @@ -598,10 +598,10 @@ package android { field public static final int layout_centerInParent = 16843151; // 0x101018f field public static final int layout_centerInParent = 16843151; // 0x101018f field public static final int layout_centerVertical = 16843153; // 0x1010191 field public static final int layout_centerVertical = 16843153; // 0x1010191 field public static final int layout_column = 16843084; // 0x101014c field public static final int layout_column = 16843084; // 0x101014c field public static final int layout_columnSpan = 16843644; // 0x101037c field public static final int layout_columnFlexibility = 16843646; // 0x101037e field public static final int layout_columnSpan = 16843645; // 0x101037d field public static final int layout_gravity = 16842931; // 0x10100b3 field public static final int layout_gravity = 16842931; // 0x10100b3 field public static final int layout_height = 16842997; // 0x10100f5 field public static final int layout_height = 16842997; // 0x10100f5 field public static final int layout_heightSpec = 16843646; // 0x101037e field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_marginBottom = 16843002; // 0x10100fa field public static final int layout_marginBottom = 16843002; // 0x10100fa field public static final int layout_marginEnd = 16843674; // 0x101039a field public static final int layout_marginEnd = 16843674; // 0x101039a Loading @@ -610,6 +610,7 @@ package android { field public static final int layout_marginStart = 16843673; // 0x1010399 field public static final int layout_marginStart = 16843673; // 0x1010399 field public static final int layout_marginTop = 16843000; // 0x10100f8 field public static final int layout_marginTop = 16843000; // 0x10100f8 field public static final int layout_row = 16843642; // 0x101037a field public static final int layout_row = 16843642; // 0x101037a field public static final int layout_rowFlexibility = 16843644; // 0x101037c field public static final int layout_rowSpan = 16843643; // 0x101037b field public static final int layout_rowSpan = 16843643; // 0x101037b field public static final int layout_scale = 16843155; // 0x1010193 field public static final int layout_scale = 16843155; // 0x1010193 field public static final int layout_span = 16843085; // 0x101014d field public static final int layout_span = 16843085; // 0x101014d Loading @@ -617,7 +618,6 @@ package android { field public static final int layout_toRightOf = 16843139; // 0x1010183 field public static final int layout_toRightOf = 16843139; // 0x1010183 field public static final int layout_weight = 16843137; // 0x1010181 field public static final int layout_weight = 16843137; // 0x1010181 field public static final int layout_width = 16842996; // 0x10100f4 field public static final int layout_width = 16842996; // 0x10100f4 field public static final int layout_widthSpec = 16843645; // 0x101037d field public static final int layout_x = 16843135; // 0x101017f field public static final int layout_x = 16843135; // 0x101017f field public static final int layout_y = 16843136; // 0x1010180 field public static final int layout_y = 16843136; // 0x1010180 field public static final int left = 16843181; // 0x10101ad field public static final int left = 16843181; // 0x10101ad Loading Loading @@ -24953,11 +24953,9 @@ package android.widget { field public static final int ALIGN_MARGINS = 1; // 0x1 field public static final int ALIGN_MARGINS = 1; // 0x1 field public static final android.widget.GridLayout.Alignment BASELINE; field public static final android.widget.GridLayout.Alignment BASELINE; field public static final android.widget.GridLayout.Alignment BOTTOM; field public static final android.widget.GridLayout.Alignment BOTTOM; field public static final android.widget.GridLayout.Spec CAN_SHRINK; field public static final int CAN_STRETCH = 2; // 0x2 field public static final android.widget.GridLayout.Spec CAN_STRETCH; field public static final android.widget.GridLayout.Alignment CENTER; field public static final android.widget.GridLayout.Alignment CENTER; field public static final android.widget.GridLayout.Alignment FILL; field public static final android.widget.GridLayout.Alignment FILL; field public static final android.widget.GridLayout.Spec FIXED; field public static final int HORIZONTAL = 0; // 0x0 field public static final int HORIZONTAL = 0; // 0x0 field public static final android.widget.GridLayout.Alignment LEFT; field public static final android.widget.GridLayout.Alignment LEFT; field public static final android.widget.GridLayout.Alignment RIGHT; field public static final android.widget.GridLayout.Alignment RIGHT; Loading @@ -24973,6 +24971,7 @@ package android.widget { ctor public GridLayout.Group(int, int, android.widget.GridLayout.Alignment); ctor public GridLayout.Group(int, int, android.widget.GridLayout.Alignment); ctor public GridLayout.Group(int, android.widget.GridLayout.Alignment); ctor public GridLayout.Group(int, android.widget.GridLayout.Alignment); field public final android.widget.GridLayout.Alignment alignment; field public final android.widget.GridLayout.Alignment alignment; field public int flexibility; } } public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { Loading @@ -24984,13 +24983,7 @@ package android.widget { ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet); ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet); method public void setGravity(int); method public void setGravity(int); field public android.widget.GridLayout.Group columnGroup; field public android.widget.GridLayout.Group columnGroup; field public android.widget.GridLayout.Spec heightSpec; field public android.widget.GridLayout.Group rowGroup; field public android.widget.GridLayout.Group rowGroup; field public android.widget.GridLayout.Spec widthSpec; } public static abstract class GridLayout.Spec { ctor public GridLayout.Spec(); } } public class GridView extends android.widget.AbsListView { public class GridView extends android.widget.AbsListView { core/java/android/widget/GridLayout.java +104 −78 Original line number Original line Diff line number Diff line Loading @@ -92,10 +92,8 @@ import static java.lang.Math.min; * * * <h4>Excess Space Distribution</h4> * <h4>Excess Space Distribution</h4> * * * Like {@link LinearLayout}, a child's ability to stretch is controlled * A child's ability to stretch is controlled using the {@link Group#flexibility flexibility} * using <em>weights</em>, which are specified using the * properties of its row and column groups. * {@link GridLayout.LayoutParams#widthSpec widthSpec} and * {@link GridLayout.LayoutParams#heightSpec heightSpec} layout parameters. * <p> * <p> * <p> * <p> * See {@link GridLayout.LayoutParams} for a full description of the * See {@link GridLayout.LayoutParams} for a full description of the Loading Loading @@ -1055,7 +1053,7 @@ public class GridLayout extends ViewGroup { if (isGone(c)) continue; if (isGone(c)) continue; LayoutParams lp = getLayoutParams(c); LayoutParams lp = getLayoutParams(c); Group g = horizontal ? lp.columnGroup : lp.rowGroup; Group g = horizontal ? lp.columnGroup : lp.rowGroup; groupBounds.getValue(i).include(c, g, GridLayout.this, this, lp); groupBounds.getValue(i).include(c, g, GridLayout.this, this); } } } } Loading Loading @@ -1087,13 +1085,17 @@ public class GridLayout extends ViewGroup { spans[i].reset(); spans[i].reset(); } } // use getter to trigger a re-evaluation // Use getter to trigger a re-evaluation Bounds[] bounds = getGroupBounds().values; Bounds[] bounds = getGroupBounds().values; for (int i = 0; i < bounds.length; i++) { for (int i = 0; i < bounds.length; i++) { int size = bounds[i].size(min); int size = bounds[i].size(min); int value = min ? size : -size; MutableInt valueHolder = links.getValue(i); MutableInt valueHolder = links.getValue(i); valueHolder.value = max(valueHolder.value, value); if (min) { valueHolder.value = max(valueHolder.value, size); } else { valueHolder.value = -max(-valueHolder.value, size); } } } } } Loading Loading @@ -1622,16 +1624,14 @@ public class GridLayout extends ViewGroup { * <li>{@link #rowGroup}{@code .alignment} = {@link #BASELINE} </li> * <li>{@link #rowGroup}{@code .alignment} = {@link #BASELINE} </li> * <li>{@link #columnGroup}{@code .span} = {@code [0, 1]} </li> * <li>{@link #columnGroup}{@code .span} = {@code [0, 1]} </li> * <li>{@link #columnGroup}{@code .alignment} = {@link #LEFT} </li> * <li>{@link #columnGroup}{@code .alignment} = {@link #LEFT} </li> * <li>{@link #widthSpec} = {@link #FIXED} </li> * <li>{@link #heightSpec} = {@link #FIXED} </li> * </ul> * </ul> * * * @attr ref android.R.styleable#GridLayout_Layout_layout_row * @attr ref android.R.styleable#GridLayout_Layout_layout_row * @attr ref android.R.styleable#GridLayout_Layout_layout_rowSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_rowSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_heightSpec * @attr ref android.R.styleable#GridLayout_Layout_layout_rowFlexibility * @attr ref android.R.styleable#GridLayout_Layout_layout_column * @attr ref android.R.styleable#GridLayout_Layout_layout_column * @attr ref android.R.styleable#GridLayout_Layout_layout_columnSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_columnSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_widthSpec * @attr ref android.R.styleable#GridLayout_Layout_layout_columnFlexibility * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity */ */ public static class LayoutParams extends MarginLayoutParams { public static class LayoutParams extends MarginLayoutParams { Loading @@ -1647,19 +1647,12 @@ public class GridLayout extends ViewGroup { private static final int DEFAULT_SPAN_SIZE = DEFAULT_SPAN.size(); private static final int DEFAULT_SPAN_SIZE = DEFAULT_SPAN.size(); private static final Alignment DEFAULT_COLUMN_ALIGNMENT = LEFT; private static final Alignment DEFAULT_COLUMN_ALIGNMENT = LEFT; private static final Alignment DEFAULT_ROW_ALIGNMENT = BASELINE; private static final Alignment DEFAULT_ROW_ALIGNMENT = BASELINE; private static final Group DEFAULT_COLUMN_GROUP = new Group(DEFAULT_SPAN, DEFAULT_COLUMN_ALIGNMENT); private static final Group DEFAULT_ROW_GROUP = new Group(DEFAULT_SPAN, DEFAULT_ROW_ALIGNMENT); private static final Spec DEFAULT_SPEC = FIXED; private static final int DEFAULT_SPEC_INDEX = 0; // Misc // Misc private static final Rect CONTAINER_BOUNDS = new Rect(0, 0, 2, 2); private static final Rect CONTAINER_BOUNDS = new Rect(0, 0, 2, 2); private static final Alignment[] COLUMN_ALIGNMENTS = { LEFT, CENTER, RIGHT }; private static final Alignment[] COLUMN_ALIGNMENTS = { LEFT, CENTER, RIGHT }; private static final Alignment[] ROW_ALIGNMENTS = { TOP, CENTER, BOTTOM }; private static final Alignment[] ROW_ALIGNMENTS = { TOP, CENTER, BOTTOM }; private static final Spec[] SPECS = { FIXED, CAN_SHRINK, CAN_STRETCH }; // TypedArray indices // TypedArray indices Loading @@ -1672,10 +1665,14 @@ public class GridLayout extends ViewGroup { private static final int COLUMN = styleable.GridLayout_Layout_layout_column; private static final int COLUMN = styleable.GridLayout_Layout_layout_column; private static final int COLUMN_SPAN = styleable.GridLayout_Layout_layout_columnSpan; private static final int COLUMN_SPAN = styleable.GridLayout_Layout_layout_columnSpan; private static final int WIDTH_SPEC = styleable.GridLayout_Layout_layout_widthSpec; private static final int COLUMN_FLEXIBILITY = styleable.GridLayout_Layout_layout_columnFlexibility; private static final int ROW = styleable.GridLayout_Layout_layout_row; private static final int ROW = styleable.GridLayout_Layout_layout_row; private static final int ROW_SPAN = styleable.GridLayout_Layout_layout_rowSpan; private static final int ROW_SPAN = styleable.GridLayout_Layout_layout_rowSpan; private static final int HEIGHT_SPEC = styleable.GridLayout_Layout_layout_heightSpec; private static final int ROW_FLEXIBILITY = styleable.GridLayout_Layout_layout_rowFlexibility; private static final int GRAVITY = styleable.GridLayout_Layout_layout_gravity; private static final int GRAVITY = styleable.GridLayout_Layout_layout_gravity; // Instance variables // Instance variables Loading @@ -1690,30 +1687,17 @@ public class GridLayout extends ViewGroup { * described by these layout parameters. * described by these layout parameters. */ */ public Group columnGroup; public Group columnGroup; /** * The proportional space that should be taken by the associated column group * during excess space distribution. */ public Spec widthSpec; /** * The proportional space that should be taken by the associated row group * during excess space distribution. */ public Spec heightSpec; // Constructors // Constructors private LayoutParams( private LayoutParams( int width, int height, int width, int height, int left, int top, int right, int bottom, int left, int top, int right, int bottom, Group rowGroup, Group columnGroup, Group rowGroup, Group columnGroup) { Spec widthSpec, Spec heightSpec) { super(width, height); super(width, height); setMargins(left, top, right, bottom); setMargins(left, top, right, bottom); this.rowGroup = rowGroup; this.rowGroup = rowGroup; this.columnGroup = columnGroup; this.columnGroup = columnGroup; this.heightSpec = heightSpec; this.widthSpec = widthSpec; } } /** /** Loading @@ -1727,14 +1711,15 @@ public class GridLayout extends ViewGroup { public LayoutParams(Group rowGroup, Group columnGroup) { public LayoutParams(Group rowGroup, Group columnGroup) { this(DEFAULT_WIDTH, DEFAULT_HEIGHT, this(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, rowGroup, columnGroup, DEFAULT_SPEC, DEFAULT_SPEC); rowGroup, columnGroup); } } /** /** * Constructs a new LayoutParams with default values as defined in {@link LayoutParams}. * Constructs a new LayoutParams with default values as defined in {@link LayoutParams}. */ */ public LayoutParams() { public LayoutParams() { this(DEFAULT_ROW_GROUP, DEFAULT_COLUMN_GROUP); this(new Group(DEFAULT_SPAN, DEFAULT_ROW_ALIGNMENT), new Group(DEFAULT_SPAN, DEFAULT_COLUMN_ALIGNMENT)); } } // Copying constructors // Copying constructors Loading @@ -1758,10 +1743,8 @@ public class GridLayout extends ViewGroup { */ */ public LayoutParams(LayoutParams that) { public LayoutParams(LayoutParams that) { super(that); super(that); this.columnGroup = that.columnGroup; this.columnGroup = new Group(that.columnGroup); this.rowGroup = that.rowGroup; this.rowGroup = new Group(that.rowGroup); this.widthSpec = that.widthSpec; this.heightSpec = that.heightSpec; } } // AttributeSet constructors // AttributeSet constructors Loading Loading @@ -1825,7 +1808,7 @@ public class GridLayout extends ViewGroup { // Gravity. For conversion from the static the integers defined in the Gravity class, // Gravity. For conversion from the static the integers defined in the Gravity class, // use Gravity.apply() to apply gravity to a view of zero size and see where it ends up. // use Gravity.apply() to apply gravity to a view of zero size and see where it ends up. private static Alignment getColumnAlignment(int gravity, int width) { private static Alignment getColAlignment(int gravity, int width) { Rect r = new Rect(0, 0, 0, 0); Rect r = new Rect(0, 0, 0, 0); Gravity.apply(gravity, 0, 0, CONTAINER_BOUNDS, r); Gravity.apply(gravity, 0, 0, CONTAINER_BOUNDS, r); Loading Loading @@ -1853,14 +1836,14 @@ public class GridLayout extends ViewGroup { int column = a.getInt(COLUMN, DEFAULT_COLUMN); int column = a.getInt(COLUMN, DEFAULT_COLUMN); int columnSpan = a.getInt(COLUMN_SPAN, DEFAULT_SPAN_SIZE); int columnSpan = a.getInt(COLUMN_SPAN, DEFAULT_SPAN_SIZE); Interval hSpan = new Interval(column, column + columnSpan); Interval hSpan = new Interval(column, column + columnSpan); this.columnGroup = new Group(hSpan, getColumnAlignment(gravity, width)); int hFlexibility = a.getInt(COLUMN_FLEXIBILITY, Group.DEFAULT_FLEXIBILITY); this.widthSpec = SPECS[a.getInt(WIDTH_SPEC, DEFAULT_SPEC_INDEX)]; this.columnGroup = new Group(hSpan, getColAlignment(gravity, width), hFlexibility); int row = a.getInt(ROW, DEFAULT_ROW); int row = a.getInt(ROW, DEFAULT_ROW); int rowSpan = a.getInt(ROW_SPAN, DEFAULT_SPAN_SIZE); int rowSpan = a.getInt(ROW_SPAN, DEFAULT_SPAN_SIZE); Interval vSpan = new Interval(row, row + rowSpan); Interval vSpan = new Interval(row, row + rowSpan); this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height)); int vFlexibility = a.getInt(ROW_FLEXIBILITY, Group.DEFAULT_FLEXIBILITY); this.heightSpec = SPECS[a.getInt(HEIGHT_SPEC, DEFAULT_SPEC_INDEX)]; this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height), vFlexibility); } finally { } finally { a.recycle(); a.recycle(); } } Loading @@ -1875,7 +1858,7 @@ public class GridLayout extends ViewGroup { * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity */ */ public void setGravity(int gravity) { public void setGravity(int gravity) { columnGroup = columnGroup.copyWriteAlignment(getColumnAlignment(gravity, width)); columnGroup = columnGroup.copyWriteAlignment(getColAlignment(gravity, width)); rowGroup = rowGroup.copyWriteAlignment(getRowAlignment(gravity, height)); rowGroup = rowGroup.copyWriteAlignment(getRowAlignment(gravity, height)); } } Loading Loading @@ -2051,7 +2034,7 @@ public class GridLayout extends ViewGroup { public int before; public int before; public int after; public int after; public boolean canStretch; public int flexibility; private Bounds() { private Bounds() { reset(); reset(); Loading @@ -2060,7 +2043,7 @@ public class GridLayout extends ViewGroup { protected void reset() { protected void reset() { before = Integer.MIN_VALUE; before = Integer.MIN_VALUE; after = Integer.MIN_VALUE; after = Integer.MIN_VALUE; canStretch = false; flexibility = UNDEFINED_FLEXIBILITY; } } protected void include(int before, int after) { protected void include(int before, int after) { Loading @@ -2069,9 +2052,14 @@ public class GridLayout extends ViewGroup { } } protected int size(boolean min) { protected int size(boolean min) { if (!min && canStretch) { if (!min) { // Note in the usual case, components don't define anything // leaving their flexibility is undefined and their stretchability // defined as if the CAN_STRETCH flag was false. if (canStretch(flexibility) && !isUndefined(flexibility)) { return MAX_SIZE; return MAX_SIZE; } } } return before + after; return before + after; } } Loading @@ -2079,14 +2067,11 @@ public class GridLayout extends ViewGroup { return before - alignment.getAlignmentValue(c, size); return before - alignment.getAlignmentValue(c, size); } } protected void include(View c, Group g, GridLayout gridLayout, Axis axis, LayoutParams lp) { protected void include(View c, Group group, GridLayout gridLayout, Axis axis) { Spec spec = axis.horizontal ? lp.widthSpec : lp.heightSpec; this.flexibility &= group.flexibility; if (spec == CAN_STRETCH) { canStretch = true; } int size = gridLayout.getMeasurementIncludingMargin(c, axis.horizontal); int size = gridLayout.getMeasurementIncludingMargin(c, axis.horizontal); // todo test this works correctly when the returned value is UNDEFINED // todo test this works correctly when the returned value is UNDEFINED int before = g.alignment.getAlignmentValue(c, size); int before = group.alignment.getAlignmentValue(c, size); include(before, size - before); include(before, size - before); } } Loading Loading @@ -2198,6 +2183,8 @@ public class GridLayout extends ViewGroup { * {@code span} and {@code alignment}. * {@code span} and {@code alignment}. */ */ public static class Group { public static class Group { private static final int DEFAULT_FLEXIBILITY = UNDEFINED_FLEXIBILITY; private static final Group GONE = new Group(Interval.GONE, Alignment.GONE); private static final Group GONE = new Group(Interval.GONE, Alignment.GONE); /** /** Loading @@ -2215,6 +2202,18 @@ public class GridLayout extends ViewGroup { */ */ public final Alignment alignment; public final Alignment alignment; /** * The flexibility field tells GridLayout how to derive minimum and maximum size * values for a component. Specifications are made with respect to a child's * 'measured size'. A child's measured size is, in turn, controlled by its * height and width layout parameters which either specify a size or, in * the case of {@link LayoutParams#WRAP_CONTENT WRAP_CONTENT}, defer to * the computed size of the component. * * @see GridLayout#CAN_STRETCH */ public int flexibility = DEFAULT_FLEXIBILITY; /** /** * Construct a new Group, {@code group}, where: * Construct a new Group, {@code group}, where: * <ul> * <ul> Loading @@ -2225,9 +2224,22 @@ public class GridLayout extends ViewGroup { * @param span the span * @param span the span * @param alignment the alignment * @param alignment the alignment */ */ Group(Interval span, Alignment alignment) { private Group(Interval span, Alignment alignment) { this.span = span; this.alignment = alignment; } private Group(Interval span, Alignment alignment, int flexibility) { this.span = span; this.span = span; this.alignment = alignment; this.alignment = alignment; this.flexibility = flexibility; } /* Copying constructor */ private Group(Group that) { this.span = that.span; this.alignment = that.alignment; this.flexibility = that.flexibility; } } /** /** Loading Loading @@ -2260,11 +2272,11 @@ public class GridLayout extends ViewGroup { } } private Group copyWriteSpan(Interval span) { private Group copyWriteSpan(Interval span) { return new Group(span, alignment); return new Group(span, alignment, flexibility); } } private Group copyWriteAlignment(Alignment alignment) { private Group copyWriteAlignment(Alignment alignment) { return new Group(span, alignment); return new Group(span, alignment, flexibility); } } /** /** Loading Loading @@ -2490,40 +2502,54 @@ public class GridLayout extends ViewGroup { } } }; }; /** private static boolean canStretch(int flexibility) { * Spec's tell GridLayout how to derive minimum and maximum size values for a return (flexibility & CAN_STRETCH) != 0; * component. Specifications are made with respect to a child's 'measured size'. } * A child's measured size is, in turn, controlled by its height and width * layout parameters which either specify a size or, in the case of private static boolean isUndefined(int flexibility) { * WRAP_CONTENT, defer to the computed size of the component. return (flexibility & UNDEFINED) != 0; */ public static abstract class Spec { } } /** /** * Indicates that a view requests precisely the size specified by its layout parameters. * Indicates that a view requests precisely the size specified by its layout parameters. * * * @see Spec * @see Group#flexibility * * @hide */ */ public static final Spec FIXED = new Spec() { public static final int FIXED = 0; }; /** /** * Indicates that a view's size should lie between its minimum and the size specified by * Indicates that a view's size should lie between its minimum and the size specified by * its layout parameters. * its layout parameters. * * * @see Spec * @see Group#flexibility * * @hide */ */ public static final Spec CAN_SHRINK = new Spec() { public static final int CAN_SHRINK = 1; }; /** /** * Indicates that a view's size should be greater than or equal to the size specified by * Indicates that a view's size should be greater than or equal to the size specified by * its layout parameters. * its layout parameters. * * * @see Spec * @see Group#flexibility */ */ public static final Spec CAN_STRETCH = new Spec() { public static final int CAN_STRETCH = 2; }; /** * Indicates that a view will ignore its measurement, and can take any size that is greater * than its minimum. * * @see Group#flexibility */ private static final int CAN_SHRINK_OR_STRETCH = CAN_SHRINK | CAN_STRETCH; /** * A default value for flexibility. * * @see Group#flexibility */ private static final int UNDEFINED_FLEXIBILITY = UNDEFINED | CAN_SHRINK | CAN_STRETCH; } } core/res/res/layout/keyguard_screen_password_landscape.xml +8 −9 Original line number Original line Diff line number Diff line Loading @@ -24,15 +24,13 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:orientation="vertical" android:rowCount="11" android:rowCount="10" android:id="@+id/root" android:id="@+id/root" android:clipChildren="false"> android:clipChildren="false"> <!-- Column 0 --> <!-- Column 0 --> <Space android:height="20dip"/> <com.android.internal.widget.DigitalClock android:id="@+id/time" <com.android.internal.widget.DigitalClock android:id="@+id/time" android:layout_marginTop="16dip" android:layout_marginTop="8dip" android:layout_marginBottom="8dip" android:layout_marginBottom="8dip" android:layout_gravity="right"> android:layout_gravity="right"> Loading Loading @@ -120,7 +118,10 @@ android:layout_gravity="right" android:layout_gravity="right" /> /> <Space android:height="20dip"/> <Space android:layout_rowFlexibility="canStretch" android:layout_columnFlexibility="canStretch" /> <TextView <TextView android:id="@+id/carrier" android:id="@+id/carrier" Loading Loading @@ -156,15 +157,13 @@ /> /> <!-- Column 1 --> <!-- Column 1 --> <Space android:layout_widthSpec="canStretch" android:layout_rowSpan="11" /> <Space android:layout_width="32dip" android:layout_rowSpan="10" /> <!-- Column 2 - password entry field and PIN keyboard --> <!-- Column 2 - password entry field and PIN keyboard --> <LinearLayout <LinearLayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" android:orientation="vertical" android:layout_gravity="center|fill" android:layout_gravity="center|fill" android:layout_rowSpan="11"> android:layout_rowSpan="10"> <EditText android:id="@+id/passwordEntry" <EditText android:id="@+id/passwordEntry" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading core/res/res/layout/keyguard_screen_tab_unlock_land.xml +9 −11 Original line number Original line Diff line number Diff line Loading @@ -24,15 +24,13 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:orientation="vertical" android:rowCount="10" android:rowCount="8" android:id="@+id/root" android:id="@+id/root" android:clipChildren="false"> android:clipChildren="false"> <!-- Column 0 --> <!-- Column 0 --> <Space android:height="20dip"/> <com.android.internal.widget.DigitalClock android:id="@+id/time" <com.android.internal.widget.DigitalClock android:id="@+id/time" android:layout_marginTop="16dip" android:layout_marginTop="8dip" android:layout_marginBottom="8dip" android:layout_marginBottom="8dip" android:layout_gravity="right"> android:layout_gravity="right"> Loading Loading @@ -120,7 +118,10 @@ android:layout_gravity="right" android:layout_gravity="right" /> /> <Space android:height="20dip"/> <Space android:layout_rowFlexibility="canStretch" android:layout_columnFlexibility="canStretch" /> <LinearLayout android:orientation="vertical" <LinearLayout android:orientation="vertical" android:layout_gravity="right" android:layout_gravity="right" Loading Loading @@ -169,17 +170,14 @@ </LinearLayout> </LinearLayout> <!-- Column 1 --> <!-- Column 1 --> <Space <Space android:layout_width="32dip" android:layout_rowSpan="8" /> android:width="20dip" android:layout_heightSpec="canStretch" android:layout_rowSpan="10" /> <!-- Column 2 --> <!-- Column 2 --> <com.android.internal.widget.multiwaveview.MultiWaveView <com.android.internal.widget.multiwaveview.MultiWaveView android:id="@+id/unlock_widget" android:id="@+id/unlock_widget" android:layout_width="300dip" android:layout_width="200dip" android:layout_height="match_parent" android:layout_height="match_parent" android:layout_rowSpan="10" android:layout_rowSpan="8" android:targetDrawables="@array/lockscreen_targets_when_silent" android:targetDrawables="@array/lockscreen_targets_when_silent" android:handleDrawable="@drawable/ic_lockscreen_handle" android:handleDrawable="@drawable/ic_lockscreen_handle" Loading core/res/res/layout/keyguard_screen_unlock_landscape.xml +2 −14 Original line number Original line Diff line number Diff line Loading @@ -30,8 +30,6 @@ <!-- Column 0: Time, date and status --> <!-- Column 0: Time, date and status --> <com.android.internal.widget.DigitalClock android:id="@+id/time" <com.android.internal.widget.DigitalClock android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dip" android:layout_marginTop="8dip" android:layout_marginBottom="12dip" android:layout_marginBottom="12dip" android:layout_gravity="right"> android:layout_gravity="right"> Loading Loading @@ -66,8 +64,6 @@ <TextView <TextView android:id="@+id/date" android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:singleLine="true" android:ellipsize="marquee" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" Loading @@ -77,8 +73,6 @@ <TextView <TextView android:id="@+id/alarm_status" android:id="@+id/alarm_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:singleLine="true" android:ellipsize="marquee" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" Loading @@ -89,8 +83,6 @@ <TextView <TextView android:id="@+id/status1" android:id="@+id/status1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:singleLine="true" android:ellipsize="marquee" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" Loading @@ -100,10 +92,8 @@ <!-- TODO: remove hard coded height since layout_rowWeight doesn't seem to be working --> <!-- TODO: remove hard coded height since layout_rowWeight doesn't seem to be working --> <Space <Space android:layout_height="43dip" android:layout_rowFlexibility="canStretch" android:layout_gravity="fill" android:layout_columnFlexibility="canStretch" android:layout_heightSpec="canStretch" android:layout_widthSpec="canStretch" /> /> <TextView android:id="@+id/carrier" <TextView android:id="@+id/carrier" Loading @@ -117,8 +107,6 @@ <LinearLayout <LinearLayout style="?android:attr/buttonBarStyle" style="?android:attr/buttonBarStyle" android:orientation="vertical" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right"> android:layout_gravity="right"> <Button android:id="@+id/emergencyCallButton" <Button android:id="@+id/emergencyCallButton" Loading Loading
api/current.txt +5 −12 Original line number Original line Diff line number Diff line Loading @@ -598,10 +598,10 @@ package android { field public static final int layout_centerInParent = 16843151; // 0x101018f field public static final int layout_centerInParent = 16843151; // 0x101018f field public static final int layout_centerVertical = 16843153; // 0x1010191 field public static final int layout_centerVertical = 16843153; // 0x1010191 field public static final int layout_column = 16843084; // 0x101014c field public static final int layout_column = 16843084; // 0x101014c field public static final int layout_columnSpan = 16843644; // 0x101037c field public static final int layout_columnFlexibility = 16843646; // 0x101037e field public static final int layout_columnSpan = 16843645; // 0x101037d field public static final int layout_gravity = 16842931; // 0x10100b3 field public static final int layout_gravity = 16842931; // 0x10100b3 field public static final int layout_height = 16842997; // 0x10100f5 field public static final int layout_height = 16842997; // 0x10100f5 field public static final int layout_heightSpec = 16843646; // 0x101037e field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_marginBottom = 16843002; // 0x10100fa field public static final int layout_marginBottom = 16843002; // 0x10100fa field public static final int layout_marginEnd = 16843674; // 0x101039a field public static final int layout_marginEnd = 16843674; // 0x101039a Loading @@ -610,6 +610,7 @@ package android { field public static final int layout_marginStart = 16843673; // 0x1010399 field public static final int layout_marginStart = 16843673; // 0x1010399 field public static final int layout_marginTop = 16843000; // 0x10100f8 field public static final int layout_marginTop = 16843000; // 0x10100f8 field public static final int layout_row = 16843642; // 0x101037a field public static final int layout_row = 16843642; // 0x101037a field public static final int layout_rowFlexibility = 16843644; // 0x101037c field public static final int layout_rowSpan = 16843643; // 0x101037b field public static final int layout_rowSpan = 16843643; // 0x101037b field public static final int layout_scale = 16843155; // 0x1010193 field public static final int layout_scale = 16843155; // 0x1010193 field public static final int layout_span = 16843085; // 0x101014d field public static final int layout_span = 16843085; // 0x101014d Loading @@ -617,7 +618,6 @@ package android { field public static final int layout_toRightOf = 16843139; // 0x1010183 field public static final int layout_toRightOf = 16843139; // 0x1010183 field public static final int layout_weight = 16843137; // 0x1010181 field public static final int layout_weight = 16843137; // 0x1010181 field public static final int layout_width = 16842996; // 0x10100f4 field public static final int layout_width = 16842996; // 0x10100f4 field public static final int layout_widthSpec = 16843645; // 0x101037d field public static final int layout_x = 16843135; // 0x101017f field public static final int layout_x = 16843135; // 0x101017f field public static final int layout_y = 16843136; // 0x1010180 field public static final int layout_y = 16843136; // 0x1010180 field public static final int left = 16843181; // 0x10101ad field public static final int left = 16843181; // 0x10101ad Loading Loading @@ -24953,11 +24953,9 @@ package android.widget { field public static final int ALIGN_MARGINS = 1; // 0x1 field public static final int ALIGN_MARGINS = 1; // 0x1 field public static final android.widget.GridLayout.Alignment BASELINE; field public static final android.widget.GridLayout.Alignment BASELINE; field public static final android.widget.GridLayout.Alignment BOTTOM; field public static final android.widget.GridLayout.Alignment BOTTOM; field public static final android.widget.GridLayout.Spec CAN_SHRINK; field public static final int CAN_STRETCH = 2; // 0x2 field public static final android.widget.GridLayout.Spec CAN_STRETCH; field public static final android.widget.GridLayout.Alignment CENTER; field public static final android.widget.GridLayout.Alignment CENTER; field public static final android.widget.GridLayout.Alignment FILL; field public static final android.widget.GridLayout.Alignment FILL; field public static final android.widget.GridLayout.Spec FIXED; field public static final int HORIZONTAL = 0; // 0x0 field public static final int HORIZONTAL = 0; // 0x0 field public static final android.widget.GridLayout.Alignment LEFT; field public static final android.widget.GridLayout.Alignment LEFT; field public static final android.widget.GridLayout.Alignment RIGHT; field public static final android.widget.GridLayout.Alignment RIGHT; Loading @@ -24973,6 +24971,7 @@ package android.widget { ctor public GridLayout.Group(int, int, android.widget.GridLayout.Alignment); ctor public GridLayout.Group(int, int, android.widget.GridLayout.Alignment); ctor public GridLayout.Group(int, android.widget.GridLayout.Alignment); ctor public GridLayout.Group(int, android.widget.GridLayout.Alignment); field public final android.widget.GridLayout.Alignment alignment; field public final android.widget.GridLayout.Alignment alignment; field public int flexibility; } } public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { Loading @@ -24984,13 +24983,7 @@ package android.widget { ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet); ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet); method public void setGravity(int); method public void setGravity(int); field public android.widget.GridLayout.Group columnGroup; field public android.widget.GridLayout.Group columnGroup; field public android.widget.GridLayout.Spec heightSpec; field public android.widget.GridLayout.Group rowGroup; field public android.widget.GridLayout.Group rowGroup; field public android.widget.GridLayout.Spec widthSpec; } public static abstract class GridLayout.Spec { ctor public GridLayout.Spec(); } } public class GridView extends android.widget.AbsListView { public class GridView extends android.widget.AbsListView {
core/java/android/widget/GridLayout.java +104 −78 Original line number Original line Diff line number Diff line Loading @@ -92,10 +92,8 @@ import static java.lang.Math.min; * * * <h4>Excess Space Distribution</h4> * <h4>Excess Space Distribution</h4> * * * Like {@link LinearLayout}, a child's ability to stretch is controlled * A child's ability to stretch is controlled using the {@link Group#flexibility flexibility} * using <em>weights</em>, which are specified using the * properties of its row and column groups. * {@link GridLayout.LayoutParams#widthSpec widthSpec} and * {@link GridLayout.LayoutParams#heightSpec heightSpec} layout parameters. * <p> * <p> * <p> * <p> * See {@link GridLayout.LayoutParams} for a full description of the * See {@link GridLayout.LayoutParams} for a full description of the Loading Loading @@ -1055,7 +1053,7 @@ public class GridLayout extends ViewGroup { if (isGone(c)) continue; if (isGone(c)) continue; LayoutParams lp = getLayoutParams(c); LayoutParams lp = getLayoutParams(c); Group g = horizontal ? lp.columnGroup : lp.rowGroup; Group g = horizontal ? lp.columnGroup : lp.rowGroup; groupBounds.getValue(i).include(c, g, GridLayout.this, this, lp); groupBounds.getValue(i).include(c, g, GridLayout.this, this); } } } } Loading Loading @@ -1087,13 +1085,17 @@ public class GridLayout extends ViewGroup { spans[i].reset(); spans[i].reset(); } } // use getter to trigger a re-evaluation // Use getter to trigger a re-evaluation Bounds[] bounds = getGroupBounds().values; Bounds[] bounds = getGroupBounds().values; for (int i = 0; i < bounds.length; i++) { for (int i = 0; i < bounds.length; i++) { int size = bounds[i].size(min); int size = bounds[i].size(min); int value = min ? size : -size; MutableInt valueHolder = links.getValue(i); MutableInt valueHolder = links.getValue(i); valueHolder.value = max(valueHolder.value, value); if (min) { valueHolder.value = max(valueHolder.value, size); } else { valueHolder.value = -max(-valueHolder.value, size); } } } } } Loading Loading @@ -1622,16 +1624,14 @@ public class GridLayout extends ViewGroup { * <li>{@link #rowGroup}{@code .alignment} = {@link #BASELINE} </li> * <li>{@link #rowGroup}{@code .alignment} = {@link #BASELINE} </li> * <li>{@link #columnGroup}{@code .span} = {@code [0, 1]} </li> * <li>{@link #columnGroup}{@code .span} = {@code [0, 1]} </li> * <li>{@link #columnGroup}{@code .alignment} = {@link #LEFT} </li> * <li>{@link #columnGroup}{@code .alignment} = {@link #LEFT} </li> * <li>{@link #widthSpec} = {@link #FIXED} </li> * <li>{@link #heightSpec} = {@link #FIXED} </li> * </ul> * </ul> * * * @attr ref android.R.styleable#GridLayout_Layout_layout_row * @attr ref android.R.styleable#GridLayout_Layout_layout_row * @attr ref android.R.styleable#GridLayout_Layout_layout_rowSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_rowSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_heightSpec * @attr ref android.R.styleable#GridLayout_Layout_layout_rowFlexibility * @attr ref android.R.styleable#GridLayout_Layout_layout_column * @attr ref android.R.styleable#GridLayout_Layout_layout_column * @attr ref android.R.styleable#GridLayout_Layout_layout_columnSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_columnSpan * @attr ref android.R.styleable#GridLayout_Layout_layout_widthSpec * @attr ref android.R.styleable#GridLayout_Layout_layout_columnFlexibility * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity */ */ public static class LayoutParams extends MarginLayoutParams { public static class LayoutParams extends MarginLayoutParams { Loading @@ -1647,19 +1647,12 @@ public class GridLayout extends ViewGroup { private static final int DEFAULT_SPAN_SIZE = DEFAULT_SPAN.size(); private static final int DEFAULT_SPAN_SIZE = DEFAULT_SPAN.size(); private static final Alignment DEFAULT_COLUMN_ALIGNMENT = LEFT; private static final Alignment DEFAULT_COLUMN_ALIGNMENT = LEFT; private static final Alignment DEFAULT_ROW_ALIGNMENT = BASELINE; private static final Alignment DEFAULT_ROW_ALIGNMENT = BASELINE; private static final Group DEFAULT_COLUMN_GROUP = new Group(DEFAULT_SPAN, DEFAULT_COLUMN_ALIGNMENT); private static final Group DEFAULT_ROW_GROUP = new Group(DEFAULT_SPAN, DEFAULT_ROW_ALIGNMENT); private static final Spec DEFAULT_SPEC = FIXED; private static final int DEFAULT_SPEC_INDEX = 0; // Misc // Misc private static final Rect CONTAINER_BOUNDS = new Rect(0, 0, 2, 2); private static final Rect CONTAINER_BOUNDS = new Rect(0, 0, 2, 2); private static final Alignment[] COLUMN_ALIGNMENTS = { LEFT, CENTER, RIGHT }; private static final Alignment[] COLUMN_ALIGNMENTS = { LEFT, CENTER, RIGHT }; private static final Alignment[] ROW_ALIGNMENTS = { TOP, CENTER, BOTTOM }; private static final Alignment[] ROW_ALIGNMENTS = { TOP, CENTER, BOTTOM }; private static final Spec[] SPECS = { FIXED, CAN_SHRINK, CAN_STRETCH }; // TypedArray indices // TypedArray indices Loading @@ -1672,10 +1665,14 @@ public class GridLayout extends ViewGroup { private static final int COLUMN = styleable.GridLayout_Layout_layout_column; private static final int COLUMN = styleable.GridLayout_Layout_layout_column; private static final int COLUMN_SPAN = styleable.GridLayout_Layout_layout_columnSpan; private static final int COLUMN_SPAN = styleable.GridLayout_Layout_layout_columnSpan; private static final int WIDTH_SPEC = styleable.GridLayout_Layout_layout_widthSpec; private static final int COLUMN_FLEXIBILITY = styleable.GridLayout_Layout_layout_columnFlexibility; private static final int ROW = styleable.GridLayout_Layout_layout_row; private static final int ROW = styleable.GridLayout_Layout_layout_row; private static final int ROW_SPAN = styleable.GridLayout_Layout_layout_rowSpan; private static final int ROW_SPAN = styleable.GridLayout_Layout_layout_rowSpan; private static final int HEIGHT_SPEC = styleable.GridLayout_Layout_layout_heightSpec; private static final int ROW_FLEXIBILITY = styleable.GridLayout_Layout_layout_rowFlexibility; private static final int GRAVITY = styleable.GridLayout_Layout_layout_gravity; private static final int GRAVITY = styleable.GridLayout_Layout_layout_gravity; // Instance variables // Instance variables Loading @@ -1690,30 +1687,17 @@ public class GridLayout extends ViewGroup { * described by these layout parameters. * described by these layout parameters. */ */ public Group columnGroup; public Group columnGroup; /** * The proportional space that should be taken by the associated column group * during excess space distribution. */ public Spec widthSpec; /** * The proportional space that should be taken by the associated row group * during excess space distribution. */ public Spec heightSpec; // Constructors // Constructors private LayoutParams( private LayoutParams( int width, int height, int width, int height, int left, int top, int right, int bottom, int left, int top, int right, int bottom, Group rowGroup, Group columnGroup, Group rowGroup, Group columnGroup) { Spec widthSpec, Spec heightSpec) { super(width, height); super(width, height); setMargins(left, top, right, bottom); setMargins(left, top, right, bottom); this.rowGroup = rowGroup; this.rowGroup = rowGroup; this.columnGroup = columnGroup; this.columnGroup = columnGroup; this.heightSpec = heightSpec; this.widthSpec = widthSpec; } } /** /** Loading @@ -1727,14 +1711,15 @@ public class GridLayout extends ViewGroup { public LayoutParams(Group rowGroup, Group columnGroup) { public LayoutParams(Group rowGroup, Group columnGroup) { this(DEFAULT_WIDTH, DEFAULT_HEIGHT, this(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, rowGroup, columnGroup, DEFAULT_SPEC, DEFAULT_SPEC); rowGroup, columnGroup); } } /** /** * Constructs a new LayoutParams with default values as defined in {@link LayoutParams}. * Constructs a new LayoutParams with default values as defined in {@link LayoutParams}. */ */ public LayoutParams() { public LayoutParams() { this(DEFAULT_ROW_GROUP, DEFAULT_COLUMN_GROUP); this(new Group(DEFAULT_SPAN, DEFAULT_ROW_ALIGNMENT), new Group(DEFAULT_SPAN, DEFAULT_COLUMN_ALIGNMENT)); } } // Copying constructors // Copying constructors Loading @@ -1758,10 +1743,8 @@ public class GridLayout extends ViewGroup { */ */ public LayoutParams(LayoutParams that) { public LayoutParams(LayoutParams that) { super(that); super(that); this.columnGroup = that.columnGroup; this.columnGroup = new Group(that.columnGroup); this.rowGroup = that.rowGroup; this.rowGroup = new Group(that.rowGroup); this.widthSpec = that.widthSpec; this.heightSpec = that.heightSpec; } } // AttributeSet constructors // AttributeSet constructors Loading Loading @@ -1825,7 +1808,7 @@ public class GridLayout extends ViewGroup { // Gravity. For conversion from the static the integers defined in the Gravity class, // Gravity. For conversion from the static the integers defined in the Gravity class, // use Gravity.apply() to apply gravity to a view of zero size and see where it ends up. // use Gravity.apply() to apply gravity to a view of zero size and see where it ends up. private static Alignment getColumnAlignment(int gravity, int width) { private static Alignment getColAlignment(int gravity, int width) { Rect r = new Rect(0, 0, 0, 0); Rect r = new Rect(0, 0, 0, 0); Gravity.apply(gravity, 0, 0, CONTAINER_BOUNDS, r); Gravity.apply(gravity, 0, 0, CONTAINER_BOUNDS, r); Loading Loading @@ -1853,14 +1836,14 @@ public class GridLayout extends ViewGroup { int column = a.getInt(COLUMN, DEFAULT_COLUMN); int column = a.getInt(COLUMN, DEFAULT_COLUMN); int columnSpan = a.getInt(COLUMN_SPAN, DEFAULT_SPAN_SIZE); int columnSpan = a.getInt(COLUMN_SPAN, DEFAULT_SPAN_SIZE); Interval hSpan = new Interval(column, column + columnSpan); Interval hSpan = new Interval(column, column + columnSpan); this.columnGroup = new Group(hSpan, getColumnAlignment(gravity, width)); int hFlexibility = a.getInt(COLUMN_FLEXIBILITY, Group.DEFAULT_FLEXIBILITY); this.widthSpec = SPECS[a.getInt(WIDTH_SPEC, DEFAULT_SPEC_INDEX)]; this.columnGroup = new Group(hSpan, getColAlignment(gravity, width), hFlexibility); int row = a.getInt(ROW, DEFAULT_ROW); int row = a.getInt(ROW, DEFAULT_ROW); int rowSpan = a.getInt(ROW_SPAN, DEFAULT_SPAN_SIZE); int rowSpan = a.getInt(ROW_SPAN, DEFAULT_SPAN_SIZE); Interval vSpan = new Interval(row, row + rowSpan); Interval vSpan = new Interval(row, row + rowSpan); this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height)); int vFlexibility = a.getInt(ROW_FLEXIBILITY, Group.DEFAULT_FLEXIBILITY); this.heightSpec = SPECS[a.getInt(HEIGHT_SPEC, DEFAULT_SPEC_INDEX)]; this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height), vFlexibility); } finally { } finally { a.recycle(); a.recycle(); } } Loading @@ -1875,7 +1858,7 @@ public class GridLayout extends ViewGroup { * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity */ */ public void setGravity(int gravity) { public void setGravity(int gravity) { columnGroup = columnGroup.copyWriteAlignment(getColumnAlignment(gravity, width)); columnGroup = columnGroup.copyWriteAlignment(getColAlignment(gravity, width)); rowGroup = rowGroup.copyWriteAlignment(getRowAlignment(gravity, height)); rowGroup = rowGroup.copyWriteAlignment(getRowAlignment(gravity, height)); } } Loading Loading @@ -2051,7 +2034,7 @@ public class GridLayout extends ViewGroup { public int before; public int before; public int after; public int after; public boolean canStretch; public int flexibility; private Bounds() { private Bounds() { reset(); reset(); Loading @@ -2060,7 +2043,7 @@ public class GridLayout extends ViewGroup { protected void reset() { protected void reset() { before = Integer.MIN_VALUE; before = Integer.MIN_VALUE; after = Integer.MIN_VALUE; after = Integer.MIN_VALUE; canStretch = false; flexibility = UNDEFINED_FLEXIBILITY; } } protected void include(int before, int after) { protected void include(int before, int after) { Loading @@ -2069,9 +2052,14 @@ public class GridLayout extends ViewGroup { } } protected int size(boolean min) { protected int size(boolean min) { if (!min && canStretch) { if (!min) { // Note in the usual case, components don't define anything // leaving their flexibility is undefined and their stretchability // defined as if the CAN_STRETCH flag was false. if (canStretch(flexibility) && !isUndefined(flexibility)) { return MAX_SIZE; return MAX_SIZE; } } } return before + after; return before + after; } } Loading @@ -2079,14 +2067,11 @@ public class GridLayout extends ViewGroup { return before - alignment.getAlignmentValue(c, size); return before - alignment.getAlignmentValue(c, size); } } protected void include(View c, Group g, GridLayout gridLayout, Axis axis, LayoutParams lp) { protected void include(View c, Group group, GridLayout gridLayout, Axis axis) { Spec spec = axis.horizontal ? lp.widthSpec : lp.heightSpec; this.flexibility &= group.flexibility; if (spec == CAN_STRETCH) { canStretch = true; } int size = gridLayout.getMeasurementIncludingMargin(c, axis.horizontal); int size = gridLayout.getMeasurementIncludingMargin(c, axis.horizontal); // todo test this works correctly when the returned value is UNDEFINED // todo test this works correctly when the returned value is UNDEFINED int before = g.alignment.getAlignmentValue(c, size); int before = group.alignment.getAlignmentValue(c, size); include(before, size - before); include(before, size - before); } } Loading Loading @@ -2198,6 +2183,8 @@ public class GridLayout extends ViewGroup { * {@code span} and {@code alignment}. * {@code span} and {@code alignment}. */ */ public static class Group { public static class Group { private static final int DEFAULT_FLEXIBILITY = UNDEFINED_FLEXIBILITY; private static final Group GONE = new Group(Interval.GONE, Alignment.GONE); private static final Group GONE = new Group(Interval.GONE, Alignment.GONE); /** /** Loading @@ -2215,6 +2202,18 @@ public class GridLayout extends ViewGroup { */ */ public final Alignment alignment; public final Alignment alignment; /** * The flexibility field tells GridLayout how to derive minimum and maximum size * values for a component. Specifications are made with respect to a child's * 'measured size'. A child's measured size is, in turn, controlled by its * height and width layout parameters which either specify a size or, in * the case of {@link LayoutParams#WRAP_CONTENT WRAP_CONTENT}, defer to * the computed size of the component. * * @see GridLayout#CAN_STRETCH */ public int flexibility = DEFAULT_FLEXIBILITY; /** /** * Construct a new Group, {@code group}, where: * Construct a new Group, {@code group}, where: * <ul> * <ul> Loading @@ -2225,9 +2224,22 @@ public class GridLayout extends ViewGroup { * @param span the span * @param span the span * @param alignment the alignment * @param alignment the alignment */ */ Group(Interval span, Alignment alignment) { private Group(Interval span, Alignment alignment) { this.span = span; this.alignment = alignment; } private Group(Interval span, Alignment alignment, int flexibility) { this.span = span; this.span = span; this.alignment = alignment; this.alignment = alignment; this.flexibility = flexibility; } /* Copying constructor */ private Group(Group that) { this.span = that.span; this.alignment = that.alignment; this.flexibility = that.flexibility; } } /** /** Loading Loading @@ -2260,11 +2272,11 @@ public class GridLayout extends ViewGroup { } } private Group copyWriteSpan(Interval span) { private Group copyWriteSpan(Interval span) { return new Group(span, alignment); return new Group(span, alignment, flexibility); } } private Group copyWriteAlignment(Alignment alignment) { private Group copyWriteAlignment(Alignment alignment) { return new Group(span, alignment); return new Group(span, alignment, flexibility); } } /** /** Loading Loading @@ -2490,40 +2502,54 @@ public class GridLayout extends ViewGroup { } } }; }; /** private static boolean canStretch(int flexibility) { * Spec's tell GridLayout how to derive minimum and maximum size values for a return (flexibility & CAN_STRETCH) != 0; * component. Specifications are made with respect to a child's 'measured size'. } * A child's measured size is, in turn, controlled by its height and width * layout parameters which either specify a size or, in the case of private static boolean isUndefined(int flexibility) { * WRAP_CONTENT, defer to the computed size of the component. return (flexibility & UNDEFINED) != 0; */ public static abstract class Spec { } } /** /** * Indicates that a view requests precisely the size specified by its layout parameters. * Indicates that a view requests precisely the size specified by its layout parameters. * * * @see Spec * @see Group#flexibility * * @hide */ */ public static final Spec FIXED = new Spec() { public static final int FIXED = 0; }; /** /** * Indicates that a view's size should lie between its minimum and the size specified by * Indicates that a view's size should lie between its minimum and the size specified by * its layout parameters. * its layout parameters. * * * @see Spec * @see Group#flexibility * * @hide */ */ public static final Spec CAN_SHRINK = new Spec() { public static final int CAN_SHRINK = 1; }; /** /** * Indicates that a view's size should be greater than or equal to the size specified by * Indicates that a view's size should be greater than or equal to the size specified by * its layout parameters. * its layout parameters. * * * @see Spec * @see Group#flexibility */ */ public static final Spec CAN_STRETCH = new Spec() { public static final int CAN_STRETCH = 2; }; /** * Indicates that a view will ignore its measurement, and can take any size that is greater * than its minimum. * * @see Group#flexibility */ private static final int CAN_SHRINK_OR_STRETCH = CAN_SHRINK | CAN_STRETCH; /** * A default value for flexibility. * * @see Group#flexibility */ private static final int UNDEFINED_FLEXIBILITY = UNDEFINED | CAN_SHRINK | CAN_STRETCH; } }
core/res/res/layout/keyguard_screen_password_landscape.xml +8 −9 Original line number Original line Diff line number Diff line Loading @@ -24,15 +24,13 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:orientation="vertical" android:rowCount="11" android:rowCount="10" android:id="@+id/root" android:id="@+id/root" android:clipChildren="false"> android:clipChildren="false"> <!-- Column 0 --> <!-- Column 0 --> <Space android:height="20dip"/> <com.android.internal.widget.DigitalClock android:id="@+id/time" <com.android.internal.widget.DigitalClock android:id="@+id/time" android:layout_marginTop="16dip" android:layout_marginTop="8dip" android:layout_marginBottom="8dip" android:layout_marginBottom="8dip" android:layout_gravity="right"> android:layout_gravity="right"> Loading Loading @@ -120,7 +118,10 @@ android:layout_gravity="right" android:layout_gravity="right" /> /> <Space android:height="20dip"/> <Space android:layout_rowFlexibility="canStretch" android:layout_columnFlexibility="canStretch" /> <TextView <TextView android:id="@+id/carrier" android:id="@+id/carrier" Loading Loading @@ -156,15 +157,13 @@ /> /> <!-- Column 1 --> <!-- Column 1 --> <Space android:layout_widthSpec="canStretch" android:layout_rowSpan="11" /> <Space android:layout_width="32dip" android:layout_rowSpan="10" /> <!-- Column 2 - password entry field and PIN keyboard --> <!-- Column 2 - password entry field and PIN keyboard --> <LinearLayout <LinearLayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" android:orientation="vertical" android:layout_gravity="center|fill" android:layout_gravity="center|fill" android:layout_rowSpan="11"> android:layout_rowSpan="10"> <EditText android:id="@+id/passwordEntry" <EditText android:id="@+id/passwordEntry" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading
core/res/res/layout/keyguard_screen_tab_unlock_land.xml +9 −11 Original line number Original line Diff line number Diff line Loading @@ -24,15 +24,13 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:orientation="vertical" android:rowCount="10" android:rowCount="8" android:id="@+id/root" android:id="@+id/root" android:clipChildren="false"> android:clipChildren="false"> <!-- Column 0 --> <!-- Column 0 --> <Space android:height="20dip"/> <com.android.internal.widget.DigitalClock android:id="@+id/time" <com.android.internal.widget.DigitalClock android:id="@+id/time" android:layout_marginTop="16dip" android:layout_marginTop="8dip" android:layout_marginBottom="8dip" android:layout_marginBottom="8dip" android:layout_gravity="right"> android:layout_gravity="right"> Loading Loading @@ -120,7 +118,10 @@ android:layout_gravity="right" android:layout_gravity="right" /> /> <Space android:height="20dip"/> <Space android:layout_rowFlexibility="canStretch" android:layout_columnFlexibility="canStretch" /> <LinearLayout android:orientation="vertical" <LinearLayout android:orientation="vertical" android:layout_gravity="right" android:layout_gravity="right" Loading Loading @@ -169,17 +170,14 @@ </LinearLayout> </LinearLayout> <!-- Column 1 --> <!-- Column 1 --> <Space <Space android:layout_width="32dip" android:layout_rowSpan="8" /> android:width="20dip" android:layout_heightSpec="canStretch" android:layout_rowSpan="10" /> <!-- Column 2 --> <!-- Column 2 --> <com.android.internal.widget.multiwaveview.MultiWaveView <com.android.internal.widget.multiwaveview.MultiWaveView android:id="@+id/unlock_widget" android:id="@+id/unlock_widget" android:layout_width="300dip" android:layout_width="200dip" android:layout_height="match_parent" android:layout_height="match_parent" android:layout_rowSpan="10" android:layout_rowSpan="8" android:targetDrawables="@array/lockscreen_targets_when_silent" android:targetDrawables="@array/lockscreen_targets_when_silent" android:handleDrawable="@drawable/ic_lockscreen_handle" android:handleDrawable="@drawable/ic_lockscreen_handle" Loading
core/res/res/layout/keyguard_screen_unlock_landscape.xml +2 −14 Original line number Original line Diff line number Diff line Loading @@ -30,8 +30,6 @@ <!-- Column 0: Time, date and status --> <!-- Column 0: Time, date and status --> <com.android.internal.widget.DigitalClock android:id="@+id/time" <com.android.internal.widget.DigitalClock android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dip" android:layout_marginTop="8dip" android:layout_marginBottom="12dip" android:layout_marginBottom="12dip" android:layout_gravity="right"> android:layout_gravity="right"> Loading Loading @@ -66,8 +64,6 @@ <TextView <TextView android:id="@+id/date" android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:singleLine="true" android:ellipsize="marquee" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" Loading @@ -77,8 +73,6 @@ <TextView <TextView android:id="@+id/alarm_status" android:id="@+id/alarm_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:singleLine="true" android:ellipsize="marquee" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" Loading @@ -89,8 +83,6 @@ <TextView <TextView android:id="@+id/status1" android:id="@+id/status1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:singleLine="true" android:ellipsize="marquee" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" Loading @@ -100,10 +92,8 @@ <!-- TODO: remove hard coded height since layout_rowWeight doesn't seem to be working --> <!-- TODO: remove hard coded height since layout_rowWeight doesn't seem to be working --> <Space <Space android:layout_height="43dip" android:layout_rowFlexibility="canStretch" android:layout_gravity="fill" android:layout_columnFlexibility="canStretch" android:layout_heightSpec="canStretch" android:layout_widthSpec="canStretch" /> /> <TextView android:id="@+id/carrier" <TextView android:id="@+id/carrier" Loading @@ -117,8 +107,6 @@ <LinearLayout <LinearLayout style="?android:attr/buttonBarStyle" style="?android:attr/buttonBarStyle" android:orientation="vertical" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right"> android:layout_gravity="right"> <Button android:id="@+id/emergencyCallButton" <Button android:id="@+id/emergencyCallButton" Loading