Closed
Bug 798683
Opened 12 years ago
Closed 11 years ago
Replace getChildCount() calls on ListView
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 22
People
(Reporter: bnicholson, Assigned: gbrown)
References
Details
Attachments
(1 file)
8.72 KB,
patch
|
bnicholson
:
review+
|
Details | Diff | Splinter Review |
In several places in our code (especially robocop tests), we call getChildCount() on a ListView to determine how many children it has. Problem is, this method is from ViewGroup and returns the number of items in the View, not the number of items in the entire list. ListViews destroy and reuse views as they come into view, so getChildCount() is really just the number of *visible* views. To count the number of children from the adapter, we should consider changing list.getChildCount() to list.getAdapter().getCount() where applicable. I ran into this when running testAllPagesView on my Galaxy S. With the keyboard up, only 4 entries in the AwesomeScreen are visible, so this assertion was failing: http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/testAllPagesTab.java.in#61
Comment 1•12 years ago
|
||
You're right. I missed that in my patch review. Wes wrote the tests, CC'ing him.
Reporter | ||
Comment 2•12 years ago
|
||
A number of our tests are probably failing because of this bug. I'll see if I can fix them.
Assignee: nobody → bnicholson
Reporter | ||
Updated•12 years ago
|
Assignee | ||
Comment 3•11 years ago
|
||
Is this what you had in mind? There are a few remaining getChildCount() calls, but on ViewGroups. https://tbpl.mozilla.org/?tree=Try&rev=df4b8aa6e0f5
Reporter | ||
Comment 4•11 years ago
|
||
Comment on attachment 717553 [details] [diff] [review] replace getChildCount() calls on ListView Yeah, looks good to me. Hopefully this will help.
Attachment #717553 -
Flags: review?(bnicholson) → review+
Assignee | ||
Comment 5•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/5228ec314dc9
Comment 6•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5228ec314dc9
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Updated•3 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•