*/
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.
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();
}
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;
}
}
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);
}
/**
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
- <bitmap android:src="@drawable/fastscroll_thumb_mtrl_alpha"
- android:tint="?attr/colorControlActivated" />
+ <shape android:tint="?attr/colorControlActivated"
+ android:shape="rectangle">
+ <solid android:color="@color/white" />
+ <size android:width="8dp" android:height="48dp" />
+ </shape>
</item>
<item>
- <bitmap android:src="@drawable/fastscroll_thumb_mtrl_alpha"
- android:tint="?attr/colorControlNormal" />
+ <shape android:tint="?attr/colorControlNormal"
+ android:shape="rectangle">
+ <solid android:color="@color/white" />
+ <size android:width="8dp" android:height="48dp" />
+ </shape>
</item>
</selector>
limitations under the License.
-->
-<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/fastscroll_track_mtrl_alpha"
- android:tint="?attr/colorControlNormal" />
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:tint="?attr/colorControlNormal"
+ android:shape="rectangle">
+ <solid android:color="#21ffffff" />
+ <size android:width="8dp" />
+</shape>
limitations under the License.
-->
-<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/scrollbar_handle_mtrl_alpha"
- android:tint="?attr/colorControlNormal" />
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:tint="?attr/colorControlNormal"
+ android:shape="rectangle">
+ <solid android:color="#42ffffff" />
+ <size android:width="4dp" />
+</shape>
<dimen name="datepicker_header_height">30dp</dimen>
<dimen name="datepicker_header_text_size">14dp</dimen>
+ <!-- Minimum size of the fast scroller thumb's touch target. -->
+ <dimen name="fast_scroller_minimum_touch_target">48dp</dimen>
+
<!-- width of ImmersiveModeConfirmation (-1 for match_parent) -->
<dimen name="immersive_mode_cling_width">-1px</dimen>
<java-symbol type="string" name="android_system_label" />
<java-symbol type="string" name="system_error_wipe_data" />
<java-symbol type="string" name="system_error_manufacturer" />
+ <java-symbol type="dimen" name="fast_scroller_minimum_touch_target" />
</resources>