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-9386: Android: Implement conditional horizontal layout wrapping #2368

Merged
merged 12 commits into from Jun 18, 2012

Conversation

ayeung
Copy link
Contributor

@ayeung ayeung commented Jun 11, 2012

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

This PR adds a flag to enable/disable wrapping in horizontal layout. It also changes the behavior of horizontal layout with wrap to bring it in parity with iOS.

For testing, please run the new drillbit tests, and also run the test cases attached to TIMOB-9386 and TIMOB-9575.

This ticket also resolves https://jira.appcelerator.org/browse/TIMOB-8980.

@ayeung
Copy link
Contributor Author

ayeung commented Jun 11, 2012

Added additional drillbit tests for horizontal layout with no wrap. This should be ready for CR/FR.

@negupta
Copy link
Contributor

negupta commented Jun 13, 2012

@ayeung - we need to document this behavior as part of this PR as well.

@ayeung
Copy link
Contributor Author

ayeung commented Jun 13, 2012

Added docs for new horizontal layout with wrap behavior

@rusticphilosopher
Copy link
Contributor

Review in progress

@@ -497,17 +499,26 @@ protected void onLayout(boolean changed, int l, int t, int r, int b)

// Try to calculate width/height from pins, and default to measured width/height. We have to do this in
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment should be changed to reflect the code changes

@rusticphilosopher
Copy link
Contributor

Code reviewed and single comment left. Functional review run and first test in ticket looks ok but the behavior looks odd to me for the second test case. WIll follow up with Allen regarding expected behavior.

@mstepanov
Copy link
Contributor

MobileWeb horizontal warp PR #2408

@rusticphilosopher
Copy link
Contributor

functional test failed when running test attached in the comments. layout of the 3rd row is not correct - already spoke to Allen about this and he is looking into it. Hold for fix.

On Android, the first row is centered vertically in the parent view, and
successive rows are placed below the first row as on iOS. However, the `top`
and `bottom` values are interpreted relative to the parent view.
When the wrap property is disabled, the behavior is identical to a vertical layout,
Copy link
Contributor

Choose a reason for hiding this comment

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

property can not be disabled. Should read when wrap property is set to false.

@vishalduggal
Copy link
Contributor

IOS and mobileWeb have now defined the property as horizontalWrap. Android should do the same before this PR is merged.

successive rows are placed below the first row as on iOS. However, the `top`
and `bottom` values are interpreted relative to the parent view.
When the wrap property is disabled, the behavior is identical to a vertical layout,
except children are laid out horizontally from left to right, _in rows_.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be in rows when wrap is false. It's a single row. Something like this maybe?

If the `wrap` property is false, the behavior is more equivalent to a vertical layout. Children are laid or horizontally from left to right in a single row. The `left` and `right` properties are used as padding between the children, and the `top` and `bottom` properties are used to position the children vertically.

@vishalduggal
Copy link
Contributor

I have concerns with the test cases attached in TIMOB-9386. If this PR is merged in the present state then please clarify the questions raised in the ticket.

@ayeung
Copy link
Contributor Author

ayeung commented Jun 16, 2012

Updated PR to have fill behavior for test case 3, as per talk with vishal.

@vishalduggal could you take a look at this again to see if I'm missing anything?
@arthurevans @DizzyMonkey This is ready for re-review.

exists in the current row, it is wrapped to a new row. The height of each row
is equal to the maximum height of the children in that row.
* `horizontal`. Horizontal layouts have different behavior depending on whether wrapping
is enabled. Wrapping is enabled by default (the `wrap` property is `true`).

Copy link
Contributor

Choose a reason for hiding this comment

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

horizontalWrap property

the children in that row.

Wrapping behavior is available on iOS, Android and Mobile Web (Release 2.1.0 and later).
When the wrap property is set to true, the first row is placed at the top of the
Copy link
Contributor

Choose a reason for hiding this comment

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

horizontalWrap property

@arthurevans
Copy link
Contributor

Doc needs to be updated for the new property name. Have iOS and Mobile Web also updated this property name?
Made one other minor doc suggestion.

Ran validate and docgen, everything was clean except for these points.

@vishalduggal
Copy link
Contributor

Docs reviewed for IOS. ACCEPTED

@arthurevans
Copy link
Contributor

Docs reviewed, validate and docgen passed.

I have concerns about the TIMOB-9575 fix, stated in that bug. In my opinion the iOS and Mobile Web fix is inconsistent with our other layout logic, and we "fixed" parity by making Android behave the same way.

@negupta
Copy link
Contributor

negupta commented Jun 18, 2012

Arthur - Can you please explain the inconsistency and what should be the correct behavior?

@arthurevans
Copy link
Contributor

In composite layout, a child with no top/bottom positioning pins will be centered. In a horizontal layout with no wrap, a child with no top/bottom positioning pins will be centered. In horizontal layout with wrap, a child with no top/bottom positioning pins is top-aligned in its row.

I don't understand why we would do this. And if the interpretation of top/bottom pins is completely different in "wrap" mode, then we need to document how they behave.

@rusticphilosopher
Copy link
Contributor

Code reviewed and functional test passed. docgen and validate passed. Accepted

rusticphilosopher pushed a commit that referenced this pull request Jun 18, 2012
TIMOB-9386: Android: Implement conditional horizontal layout wrapping
@rusticphilosopher rusticphilosopher merged commit c789494 into tidev:master Jun 18, 2012
@arthurevans
Copy link
Contributor

Forgot to approve officially, but talked to Opie and Max and I think my concerns were unfounded and we're doing the right thing. Accepted.

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

6 participants