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

Commit 5e66021c authored by Alan Viverette's avatar Alan Viverette
Browse files

Add auto-scrolling in ListPopupWindow drag-to-open mode

BUG: 9437139
Change-Id: I836c60b48b31d0a5cc32eef903da9dc0b9b9d8a5
parent 6b223c6a
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.AccelerateDecelerateInterpolator;

import com.android.internal.widget.AutoScrollHelper.AbsListViewAutoScroller;

import java.util.Locale;

/**
@@ -1276,8 +1278,6 @@ public class ListPopupWindow {
     * passed to the drop down in this mode; the list only looks focused.</p>
     */
    private static class DropDownListView extends ListView {
        private static final String TAG = ListPopupWindow.TAG + ".DropDownListView";

        /** Duration in milliseconds of the drag-to-open click animation. */
        private static final long CLICK_ANIM_DURATION = 150;

@@ -1339,6 +1339,9 @@ public class ListPopupWindow {
        /** Current drag-to-open click animation, if any. */
        private Animator mClickAnimation;

        /** Helper for drag-to-open auto scrolling. */
        private AbsListViewAutoScroller mScrollHelper;

        /**
         * <p>Creates a new list view wrapper.</p>
         *
@@ -1399,6 +1402,17 @@ public class ListPopupWindow {
                clearPressedItem();
            }

            // Manage automatic scrolling.
            if (handledEvent) {
                if (mScrollHelper == null) {
                    mScrollHelper = new AbsListViewAutoScroller(this);
                }
                mScrollHelper.setEnabled(true);
                mScrollHelper.onTouch(this, event);
            } else if (mScrollHelper != null) {
                mScrollHelper.setEnabled(false);
            }

            return handledEvent;
        }

+768 −0

File added.

Preview size limit exceeded, changes collapsed.