am 8ae85003: Merge "Update scrollbars to match Material spec" into lmp-mr1-dev
* commit '8ae8500365e71c59cbe96f600371391ac8d245b8': Update scrollbars to match Material spec
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
|
Before Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 84 B |
|
Before Width: | Height: | Size: 114 B |
|
Before Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 82 B |
|
Before Width: | Height: | Size: 108 B |
|
Before Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 87 B |
|
Before Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 89 B |
|
Before Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 148 B |
|
Before Width: | Height: | Size: 181 B |
@@ -16,11 +16,17 @@
|
||||
|
||||
<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>
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
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>
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
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>
|
||||
|
||||
@@ -397,6 +397,9 @@
|
||||
<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>
|
||||
|
||||
|
||||
@@ -2126,5 +2126,6 @@
|
||||
<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>
|
||||
|
||||