diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index 06bb32c1a3ec3..fe143dec89008 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -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); } /** diff --git a/core/res/res/drawable-hdpi/fastscroll_thumb_mtrl_alpha.png b/core/res/res/drawable-hdpi/fastscroll_thumb_mtrl_alpha.png deleted file mode 100644 index 2000422dd0f4a..0000000000000 Binary files a/core/res/res/drawable-hdpi/fastscroll_thumb_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/fastscroll_track_mtrl_alpha.9.png b/core/res/res/drawable-hdpi/fastscroll_track_mtrl_alpha.9.png deleted file mode 100644 index 61ef6f6bf071b..0000000000000 Binary files a/core/res/res/drawable-hdpi/fastscroll_track_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrollbar_handle_mtrl_alpha.9.png b/core/res/res/drawable-hdpi/scrollbar_handle_mtrl_alpha.9.png deleted file mode 100644 index a5166f2a911cf..0000000000000 Binary files a/core/res/res/drawable-hdpi/scrollbar_handle_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-ldpi/fastscroll_thumb_mtrl_alpha.png b/core/res/res/drawable-ldpi/fastscroll_thumb_mtrl_alpha.png deleted file mode 100644 index c901730b55ce3..0000000000000 Binary files a/core/res/res/drawable-ldpi/fastscroll_thumb_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-ldpi/fastscroll_track_mtrl_alpha.9.png b/core/res/res/drawable-ldpi/fastscroll_track_mtrl_alpha.9.png deleted file mode 100644 index 833dac9445d9b..0000000000000 Binary files a/core/res/res/drawable-ldpi/fastscroll_track_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-ldpi/scrollbar_handle_mtrl_alpha.9.png b/core/res/res/drawable-ldpi/scrollbar_handle_mtrl_alpha.9.png deleted file mode 100644 index 3e301ef7363df..0000000000000 Binary files a/core/res/res/drawable-ldpi/scrollbar_handle_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/fastscroll_thumb_mtrl_alpha.png b/core/res/res/drawable-mdpi/fastscroll_thumb_mtrl_alpha.png deleted file mode 100644 index 4984f9c045638..0000000000000 Binary files a/core/res/res/drawable-mdpi/fastscroll_thumb_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/fastscroll_track_mtrl_alpha.9.png b/core/res/res/drawable-mdpi/fastscroll_track_mtrl_alpha.9.png deleted file mode 100644 index 404180821c403..0000000000000 Binary files a/core/res/res/drawable-mdpi/fastscroll_track_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrollbar_handle_mtrl_alpha.9.png b/core/res/res/drawable-mdpi/scrollbar_handle_mtrl_alpha.9.png deleted file mode 100644 index 1834b2e9606a4..0000000000000 Binary files a/core/res/res/drawable-mdpi/scrollbar_handle_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/fastscroll_thumb_mtrl_alpha.png b/core/res/res/drawable-xhdpi/fastscroll_thumb_mtrl_alpha.png deleted file mode 100644 index 9534f78363cf1..0000000000000 Binary files a/core/res/res/drawable-xhdpi/fastscroll_thumb_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/fastscroll_track_mtrl_alpha.9.png b/core/res/res/drawable-xhdpi/fastscroll_track_mtrl_alpha.9.png deleted file mode 100644 index 02f017483acc2..0000000000000 Binary files a/core/res/res/drawable-xhdpi/fastscroll_track_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrollbar_handle_mtrl_alpha.9.png b/core/res/res/drawable-xhdpi/scrollbar_handle_mtrl_alpha.9.png deleted file mode 100644 index 3c816c7d3ee92..0000000000000 Binary files a/core/res/res/drawable-xhdpi/scrollbar_handle_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/fastscroll_thumb_mtrl_alpha.png b/core/res/res/drawable-xxhdpi/fastscroll_thumb_mtrl_alpha.png deleted file mode 100644 index 55a73e744aae2..0000000000000 Binary files a/core/res/res/drawable-xxhdpi/fastscroll_thumb_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/fastscroll_track_mtrl_alpha.9.png b/core/res/res/drawable-xxhdpi/fastscroll_track_mtrl_alpha.9.png deleted file mode 100644 index be64a94a8b0c4..0000000000000 Binary files a/core/res/res/drawable-xxhdpi/fastscroll_track_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrollbar_handle_mtrl_alpha.9.png b/core/res/res/drawable-xxhdpi/scrollbar_handle_mtrl_alpha.9.png deleted file mode 100644 index c1c0622112e9c..0000000000000 Binary files a/core/res/res/drawable-xxhdpi/scrollbar_handle_mtrl_alpha.9.png and /dev/null differ diff --git a/core/res/res/drawable/fastscroll_thumb_material.xml b/core/res/res/drawable/fastscroll_thumb_material.xml index 1288f0d08e676..4e8ccc70ba616 100644 --- a/core/res/res/drawable/fastscroll_thumb_material.xml +++ b/core/res/res/drawable/fastscroll_thumb_material.xml @@ -16,11 +16,17 @@ - + + + + - + + + + diff --git a/core/res/res/drawable/fastscroll_track_material.xml b/core/res/res/drawable/fastscroll_track_material.xml index 60f79b1a2655a..7882b0542ee83 100644 --- a/core/res/res/drawable/fastscroll_track_material.xml +++ b/core/res/res/drawable/fastscroll_track_material.xml @@ -14,6 +14,9 @@ limitations under the License. --> - + + + + diff --git a/core/res/res/drawable/scrollbar_handle_material.xml b/core/res/res/drawable/scrollbar_handle_material.xml index a241428c899d8..1b3bb9b6fd754 100644 --- a/core/res/res/drawable/scrollbar_handle_material.xml +++ b/core/res/res/drawable/scrollbar_handle_material.xml @@ -14,6 +14,9 @@ limitations under the License. --> - + + + + diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index b4e033c9bb481..3f840ab7a99de 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -397,6 +397,9 @@ 30dp 14dp + + 48dp + -1px diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index cbc379b2a26dd..a91119f3103f4 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2126,5 +2126,6 @@ +