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

Commit bbf7b4cd authored by Pieter-Jan Vandormael's avatar Pieter-Jan Vandormael
Browse files

Fix issue #13366. Take account of stackFromBottom in


computeVerticalScrollOffset().

Change-Id: I743708ef1ac05e358840f37010de36b7d0c6a346
Signed-off-by: default avatarPieter-Jan Vandormael <ezelspinguin@gmail.com>
parent 0cf34218
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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);
            }