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-10458] Android: TableSection - header views are not sorted correc... #3033
Conversation
v = new TiTableViewHeaderItem(proxy.getActivity(), headerView); | ||
v.setClassName(TableViewProxy.CLASSNAME_HEADERVIEW); | ||
return v; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return was removed here because it bypassed setRowData(). With the fix,
setRowData() is necessary to populate the data for a TiTableViewHeaderItem.
Code reviewed and comments left |
|
||
private void setHeaderData(Item item) | ||
{ | ||
if (headerView != null && headerView.getChildren() != null && item != null && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am more concerned about the assumption that children array has >0 elements. If headerView is null then an exception will be thrown before we get to this point. headerView.getChildren().get(0) assumes there are children and checking for getChildren() != null just makes sure that the array itself is not null, not that it actually contains anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should I code it to protect against this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For checking against out of bounds on an array?
if (array.length > 0) {
// do stuff with array[0]
} else {
// log error and do other stuff since array[0] doesn't exist
}
…rectly -- Add more checking to prevent exceptions
Code reviewed and functional test passed on both runtimes. Accepted |
[TIMOB-10458] Android: TableSection - header views are not sorted correc...
...tly
This fixes the problem where table section header views weren't
getting their data set on re-use in getView().
Needs review by Opie -- Thanks.