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

Commit 0046bd8e authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 3192412 - ListView doesn't reportScrollStateChange properly

for programmatic scrolls

Allow for onScrollStateChanged implementations that end up changing
scroll state again.

Change-Id: I53105f5be708bacc0d3ec8e76ba1cc22f4131467
parent af376a54
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2893,8 +2893,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
    void reportScrollStateChange(int newState) {
        if (newState != mLastScrollState) {
            if (mOnScrollListener != null) {
                mOnScrollListener.onScrollStateChanged(this, newState);
                mLastScrollState = newState;
                mOnScrollListener.onScrollStateChanged(this, newState);
            }
        }
    }
@@ -3431,12 +3431,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
    public void smoothScrollBy(int distance, int duration) {
        if (mFlingRunnable == null) {
            mFlingRunnable = new FlingRunnable();
        } else {
            mFlingRunnable.endFling();
        }
        // No sense starting to scroll if we're not going anywhere
        if (distance != 0) {
            reportScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
            mFlingRunnable.startScroll(distance, duration);
        } else {
            mFlingRunnable.endFling();
        }
    }