Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25221] Android: Fixed vertical/composite layout regression caused by [TIMOB-25173] fix. #9403

Merged
merged 2 commits into from
Sep 7, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child.getVisibility() != View.GONE) {
constrainChild(child, w, wMode, h, hMode, wRemain, h - maxHeight);
int hRemain = isDefaultArrangement() ? h : (h - maxHeight);
constrainChild(child, w, wMode, h, hMode, wRemain, hRemain);
}

int childWidth = child.getMeasuredWidth();
Expand Down Expand Up @@ -463,9 +464,9 @@ private int calculateWidthFromPins(
{
int width = measuredWidth;

// Layout's "width" property takes priority over left/center/right pin properties.
// Note: Ignore the auto-fill and auto-size settings here. Pins takes priority over them.
if (params.optionWidth != null) {
// We only calculate width based on pins if Titanium's JavaScript "width" property is null.
// If JavaScript "width" property is set, then "left" and "right" properties are used as padding.
if ((params.optionWidth != null) || params.autoFillsWidth || params.sizeOrFillWidthEnabled) {
return width;
}

Expand All @@ -486,16 +487,16 @@ private int calculateWidthFromPins(
return width;
}

// Try to calculate width from "top", "center", or "bottom" pins.
// Try to calculate height from "top", "center", or "bottom" pins.
// If we can't calculate from pins or we don't need to, then return the measured height.
private int calculateHeightFromPins(
LayoutParams params, int parentTop, int parentBottom, int parentHeight, int measuredHeight)
{
int height = measuredHeight;

// Layout's "height" property takes priority over top/center/bottom pin properties.
// Note: Ignore the auto-fill and auto-size settings here. Pins takes priority over them.
if (params.optionHeight != null) {
// We only calculate height based on pins if Titanium's JavaScript "height" property is null.
// If JavaScript "height" property is set, then "top" and "bottom" properties are used as padding.
if ((params.optionHeight != null) || params.autoFillsHeight || params.sizeOrFillHeightEnabled) {
return height;
}

Expand Down