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

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

Merge "Update scrollbars to match Material spec" into lmp-mr1-dev

parents 69fe1e8e 7d5bcd79
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -106,6 +106,9 @@ class FastScroller {
     */
    private final int[] mPreviewResId = new int[2];

    /** The minimum touch target size in pixels. */
    private final int mMinimumTouchTarget;

    /**
     * Padding in pixels around the preview text. Applied as layout margins to
     * the preview text and padding to the preview image.
@@ -254,6 +257,9 @@ class FastScroller {
        mPrimaryText = createPreviewTextView(context);
        mSecondaryText = createPreviewTextView(context);

        mMinimumTouchTarget = listView.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.fast_scroller_minimum_touch_target);

        setStyle(styleResId);

        final ViewGroupOverlay overlay = listView.getOverlay();
@@ -1474,10 +1480,18 @@ class FastScroller {
    }

    private boolean isPointInsideX(float x) {
        final float offset = mThumbImage.getTranslationX();
        final float left = mThumbImage.getLeft() + offset;
        final float right = mThumbImage.getRight() + offset;

        // Apply the minimum touch target size.
        final float targetSizeDiff = mMinimumTouchTarget - (right - left);
        final float adjust = targetSizeDiff > 0 ? targetSizeDiff : 0;

        if (mLayoutFromRight) {
            return x >= mThumbImage.getLeft();
            return x >= mThumbImage.getLeft() - adjust;
        } else {
            return x <= mThumbImage.getRight();
            return x <= mThumbImage.getRight() + adjust;
        }
    }

@@ -1485,7 +1499,12 @@ class FastScroller {
        final float offset = mThumbImage.getTranslationY();
        final float top = mThumbImage.getTop() + offset;
        final float bottom = mThumbImage.getBottom() + offset;
        return y >= top && y <= bottom;

        // Apply the minimum touch target size.
        final float targetSizeDiff = mMinimumTouchTarget - (bottom - top);
        final float adjust = targetSizeDiff > 0 ? targetSizeDiff / 2 : 0;

        return y >= (top - adjust) && y <= (bottom + adjust);
    }

    /**
−167 B
Loading image diff...
−84 B
Loading image diff...
−114 B
Loading image diff...
−123 B
Loading image diff...
Loading