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

Commit 4884c642 authored by Adam Powell's avatar Adam Powell
Browse files

Add AbsListView#fling

ScrollViews can programmatically fling from public API and now
ListViews/GridViews can too. This helps support applications that wish
to propagate flings across scrolling containers as part of nested
scrolling.

Bug 15538504

Change-Id: I0318c6717c7fb8788a006f96c8f8170556dd8b9e
parent fb7d2c4c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37498,6 +37498,7 @@ package android.widget {
    method public void clearChoices();
    method public void clearTextFilter();
    method public void deferNotifyDataSetChanged();
    method public void fling(int);
    method public int getCacheColorHint();
    method public int getCheckedItemCount();
    method public long[] getCheckedItemIds();
+16 −0
Original line number Diff line number Diff line
@@ -3996,6 +3996,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        return super.onGenericMotionEvent(event);
    }

    /**
     * Initiate a fling with the given velocity.
     *
     * <p>Applications can use this method to manually initiate a fling as if the user
     * initiated it via touch interaction.</p>
     *
     * @param velocityY Vertical velocity in pixels per second
     */
    public void fling(int velocityY) {
        if (mFlingRunnable == null) {
            mFlingRunnable = new FlingRunnable();
        }
        reportScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
        mFlingRunnable.start(-velocityY);
    }

    @Override
    public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
        return ((nestedScrollAxes & SCROLL_AXIS_VERTICAL) != 0);