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

Commit 7e897aa6 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Show FastScroller thumb on mouse-over"

parents db983e9a a709b37e
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -3783,6 +3783,15 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        super.requestDisallowInterceptTouchEvent(disallowIntercept);
        super.requestDisallowInterceptTouchEvent(disallowIntercept);
    }
    }


    @Override
    public boolean onInterceptHoverEvent(MotionEvent event) {
        if (mFastScroller != null && mFastScroller.onInterceptHoverEvent(event)) {
            return true;
        }

        return super.onInterceptHoverEvent(event);
    }

    @Override
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        int action = ev.getAction();
        int action = ev.getAction();
+25 −5
Original line number Original line Diff line number Diff line
@@ -300,8 +300,7 @@ class FastScroller {
        getSectionsFromIndexer();
        getSectionsFromIndexer();
        refreshDrawablePressedState();
        refreshDrawablePressedState();
        setScrollbarPosition(mList.getVerticalScrollbarPosition());
        setScrollbarPosition(mList.getVerticalScrollbarPosition());

        postAutoHide();
        mList.postDelayed(mDeferHide, FADE_TIMEOUT);
    }
    }


    /**
    /**
@@ -346,7 +345,7 @@ class FastScroller {
        if (alwaysShow) {
        if (alwaysShow) {
            setState(STATE_VISIBLE);
            setState(STATE_VISIBLE);
        } else if (mState == STATE_VISIBLE) {
        } else if (mState == STATE_VISIBLE) {
            mList.postDelayed(mDeferHide, FADE_TIMEOUT);
            postAutoHide();
        }
        }
    }
    }


@@ -708,6 +707,11 @@ class FastScroller {
        mDecorAnimation.start();
        mDecorAnimation.start();
    }
    }


    private void postAutoHide() {
        mList.removeCallbacks(mDeferHide);
        mList.postDelayed(mDeferHide, FADE_TIMEOUT);
    }

    private boolean isLongList(int visibleItemCount, int totalItemCount) {
    private boolean isLongList(int visibleItemCount, int totalItemCount) {
        // Are there enough pages to require fast scroll? Recompute only if
        // Are there enough pages to require fast scroll? Recompute only if
        // total count changes.
        // total count changes.
@@ -738,7 +742,7 @@ class FastScroller {
            // Show the thumb, if necessary, and set up auto-fade.
            // Show the thumb, if necessary, and set up auto-fade.
            if (mState != STATE_DRAGGING) {
            if (mState != STATE_DRAGGING) {
                setState(STATE_VISIBLE);
                setState(STATE_VISIBLE);
                mList.postDelayed(mDeferHide, FADE_TIMEOUT);
                postAutoHide();
            }
            }
        }
        }
    }
    }
@@ -1161,6 +1165,22 @@ class FastScroller {
        return false;
        return false;
    }
    }


    public boolean onInterceptHoverEvent(MotionEvent ev) {
        if (!mEnabled) {
            return false;
        }

        final int actionMasked = ev.getActionMasked();
        if ((actionMasked == MotionEvent.ACTION_HOVER_ENTER
                || actionMasked == MotionEvent.ACTION_HOVER_MOVE) && mState == STATE_NONE
                && isPointInside(ev.getX(), ev.getY())) {
            setState(STATE_VISIBLE);
            postAutoHide();
        }

        return false;
    }

    public boolean onTouchEvent(MotionEvent me) {
    public boolean onTouchEvent(MotionEvent me) {
        if (!mEnabled) {
        if (!mEnabled) {
            return false;
            return false;
@@ -1197,7 +1217,7 @@ class FastScroller {
                    }
                    }


                    setState(STATE_VISIBLE);
                    setState(STATE_VISIBLE);
                    mList.postDelayed(mDeferHide, FADE_TIMEOUT);
                    postAutoHide();


                    return true;
                    return true;
                }
                }