Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fce51d58 authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru Committed by Android Git Automerger
Browse files

am 98e955d2: am 20d6caf8: Merge "Fix issue #13366. Take account of...

am 98e955d2: am 20d6caf8: Merge "Fix issue #13366. Take account of stackFromBottom in computeVerticalScrollOffset()."

* commit '98e955d2':
  Fix issue #13366. Take account of stackFromBottom in computeVerticalScrollOffset().
parents 81f58c20 98e955d2
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -2217,8 +2217,13 @@ public class GridView extends AbsListView {
            int height = view.getHeight();
            int height = view.getHeight();
            if (height > 0) {
            if (height > 0) {
                final int numColumns = mNumColumns;
                final int numColumns = mNumColumns;
                final int whichRow = mFirstPosition / numColumns;
                final int rowCount = (mItemCount + numColumns - 1) / 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 +
                return Math.max(whichRow * 100 - (top * 100) / height +
                        (int) ((float) mScrollY / getHeight() * rowCount * 100), 0);
                        (int) ((float) mScrollY / getHeight() * rowCount * 100), 0);
            }
            }