Commit 20d6caf8 authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru Committed by android code review
Browse files

Merge "Fix issue #13366. Take account of stackFromBottom in computeVerticalScrollOffset()."

parents 0cf34218 bbf7b4cd
......@@ -2095,8 +2095,13 @@ public class GridView extends AbsListView {
int height = view.getHeight();
if (height > 0) {
final int numColumns = mNumColumns;
final int whichRow = mFirstPosition / numColumns;
final int rowCount = (mItemCount + numColumns - 1) / numColumns;
// In case of stackFromBottom the calculation of whichRow needs
// to take into account that counting from the top the first row
// might not be entirely filled.
final int oddItemsOnFirstRow = isStackFromBottom() ? ((rowCount * numColumns) -
mItemCount) : 0;
final int whichRow = (mFirstPosition + oddItemsOnFirstRow) / numColumns;
return Math.max(whichRow * 100 - (top * 100) / height +
(int) ((float) mScrollY / getHeight() * rowCount * 100), 0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment