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-10458] Android: TableSection - header views are not sorted correc... #3033

Merged
merged 3 commits into from Oct 4, 2012

Conversation

krowley
Copy link
Contributor

@krowley krowley commented Sep 22, 2012

...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.

v = new TiTableViewHeaderItem(proxy.getActivity(), headerView);
v.setClassName(TableViewProxy.CLASSNAME_HEADERVIEW);
return v;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Contributor Author

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.

@rusticphilosopher
Copy link
Contributor

Code reviewed and comments left


private void setHeaderData(Item item)
{
if (headerView != null && headerView.getChildren() != null && item != null &&
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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
@rusticphilosopher
Copy link
Contributor

Code reviewed and functional test passed on both runtimes. Accepted

rusticphilosopher pushed a commit that referenced this pull request Oct 4, 2012
[TIMOB-10458] Android: TableSection - header views are not sorted correc...
@rusticphilosopher rusticphilosopher merged commit 98503ac into tidev:master Oct 4, 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

2 participants