Skip to content

Commit 3617933

Browse files
Philip MilneAndroid (Google) Code Review
authored andcommitted
Merge " Update to fix for bug 5393156" into ics-mr1
2 parents 2272602 + 6b24864 commit 3617933

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/java/android/widget/GridLayout.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,16 +867,18 @@ private void measureChildrenWithMargins(int widthSpec, int heightSpec, boolean f
867867
if (firstPass) {
868868
measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, lp.height);
869869
} else {
870-
Spec spec = (orientation == HORIZONTAL) ? lp.columnSpec : lp.rowSpec;
870+
boolean horizontal = (orientation == HORIZONTAL);
871+
Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
871872
if (spec.alignment == FILL) {
872873
Interval span = spec.span;
873-
Axis axis = (orientation == HORIZONTAL) ? horizontalAxis : verticalAxis;
874+
Axis axis = horizontal ? horizontalAxis : verticalAxis;
874875
int[] locations = axis.getLocations();
875-
int size = locations[span.max] - locations[span.min];
876-
if (orientation == HORIZONTAL) {
877-
measureChildWithMargins2(c, widthSpec, heightSpec, size, lp.height);
876+
int cellSize = locations[span.max] - locations[span.min];
877+
int viewSize = cellSize - getTotalMargin(c, horizontal);
878+
if (horizontal) {
879+
measureChildWithMargins2(c, widthSpec, heightSpec, viewSize, lp.height);
878880
} else {
879-
measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, size);
881+
measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, viewSize);
880882
}
881883
}
882884
}

0 commit comments

Comments
 (0)