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-7836: Allow fill behavior for horiztonal and veritcal layouts #1659

Merged
merged 6 commits into from Mar 15, 2012

Conversation

ayeung
Copy link
Contributor

@ayeung ayeung commented Mar 13, 2012

https://jira.appcelerator.org/browse/TIMOB-7836

The composite layout spec changed the expected behavior in this bug. This PR is to achieve parity with iOS.

To test, please test the two cases in the Jira ticket and make sure the behavior is the same in both iOS and android.

This also fixes https://jira.appcelerator.org/browse/TIMOB-7837. We need to test for party in this jira ticket as well.

@ayeung
Copy link
Contributor Author

ayeung commented Mar 14, 2012

Forgot to add a drillbit test to this. Will update this PR with drillbit tests soon.

@@ -316,7 +316,7 @@ protected void constrainChild(View child, int width, int wMode, int height, int
childDimension = p.optionWidth.getAsPixels(this);
}
} else {
if (p.autoFillsWidth && !isHorizontalArrangement()) {
if (p.autoFillsWidth) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not see code where width is undefined and can not be calculated from pins (follow auto behavior) or auto where the default auto behavior if fill. Are these flags set up somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some code clean up to make the logic more clear. I renamed two methods to calculateHeightFromPins() and calculateWidthFromPins() inside onLayout() which takes care of the calculation. We essentially do the calculation for fill/size in constrainChild() and then we determine if we want to use those calculations in calculateHeightFromPins(). If we can't calculate from the pins, then we use the default size/fill behavior (passed in as measuredHeight).

@hieupham007
Copy link
Contributor

No additional comments. Please address Vishal's comment

@ayeung
Copy link
Contributor Author

ayeung commented Mar 15, 2012

I added comments to make the code more clear. I also added a drillbit test. When doing functional testing, please run the ui.layout test in drillbit.

// Set auto width/height to false to trigger undefined behavior
layoutParams.autoWidth = false;
layoutParams.autoHeight = false;
// Don't use fill or size by default (this is to trigger undefined behavior)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "undefined" behavior? You should add a definition or a link if its already documented somewhere.

@hieupham007
Copy link
Contributor

Code reviewed. Please address comments.

@vishalduggal
Copy link
Contributor

Code Reviewed. ACCEPTED

@ayeung
Copy link
Contributor Author

ayeung commented Mar 15, 2012

Code updated. Please review again.

@hieupham007
Copy link
Contributor

Code reviewed and functionally tested. Request accepted

vishalduggal added a commit that referenced this pull request Mar 15, 2012
TIMOB-7836: Allow fill behavior for horiztonal and veritcal layouts
@vishalduggal vishalduggal merged commit eea3f63 into tidev:master Mar 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants