Make scrollbarSize in Material Design theme configurable
1. Introduce config_scrollbarSize, default value=4dp 2. Use it to define android:scrollbarSize in themes. 3. Remove the explicit size from the MD scrollbar thumb shape. Bug: 35432058 Test: android.cts.view.ViewTest#testScrollbarSize Change-Id: Ia97b8f34ae1b9296ca2afcf62ff5bde55f70a63e
This commit is contained in:
@@ -35,7 +35,7 @@ public class ViewConfiguration {
|
||||
* Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in
|
||||
* dips
|
||||
*/
|
||||
private static final int SCROLL_BAR_SIZE = 10;
|
||||
private static final int SCROLL_BAR_SIZE = 4;
|
||||
|
||||
/**
|
||||
* Duration of the fade when scrollbars fade away in milliseconds
|
||||
@@ -346,7 +346,8 @@ public class ViewConfiguration {
|
||||
|
||||
mEdgeSlop = (int) (sizeAndDensity * EDGE_SLOP + 0.5f);
|
||||
mFadingEdgeLength = (int) (sizeAndDensity * FADING_EDGE_LENGTH + 0.5f);
|
||||
mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
|
||||
mScrollbarSize = res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.config_scrollbarSize);
|
||||
mDoubleTapSlop = (int) (sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
|
||||
mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
|
||||
|
||||
|
||||
@@ -19,7 +19,4 @@
|
||||
android:shape="rectangle">
|
||||
<solid
|
||||
android:color="#84ffffff" />
|
||||
<size
|
||||
android:width="4dp"
|
||||
android:height="4dp" />
|
||||
</shape>
|
||||
|
||||
@@ -1873,6 +1873,10 @@
|
||||
<!-- Amount of time in ms the user needs to press the relevant key to bring up the global actions dialog -->
|
||||
<integer name="config_globalActionsKeyTimeout">500</integer>
|
||||
|
||||
<!-- Default width of a vertical scrollbar and height of a horizontal scrollbar.
|
||||
Takes effect only if the scrollbar drawables have no intrinsic size. -->
|
||||
<dimen name="config_scrollbarSize">4dp</dimen>
|
||||
|
||||
<!-- Distance that should be scrolled in response to a {@link MotionEvent#ACTION_SCROLL event}
|
||||
with an axis value of 1. -->
|
||||
<dimen name="config_scrollFactor">64dp</dimen>
|
||||
|
||||
@@ -428,6 +428,7 @@
|
||||
<java-symbol type="dimen" name="config_viewConfigurationTouchSlop" />
|
||||
<java-symbol type="dimen" name="config_viewMinFlingVelocity" />
|
||||
<java-symbol type="dimen" name="config_viewMaxFlingVelocity" />
|
||||
<java-symbol type="dimen" name="config_scrollbarSize" />
|
||||
<java-symbol type="dimen" name="config_scrollFactor" />
|
||||
<java-symbol type="dimen" name="default_app_widget_padding_bottom" />
|
||||
<java-symbol type="dimen" name="default_app_widget_padding_left" />
|
||||
|
||||
@@ -214,7 +214,7 @@ please see themes_device_defaults.xml.
|
||||
<!-- Scrollbar attributes -->
|
||||
<item name="scrollbarFadeDuration">250</item>
|
||||
<item name="scrollbarDefaultDelayBeforeFade">400</item>
|
||||
<item name="scrollbarSize">10dp</item>
|
||||
<item name="scrollbarSize">@dimen/config_scrollbarSize</item>
|
||||
<item name="scrollbarThumbHorizontal">@drawable/scrollbar_handle_material</item>
|
||||
<item name="scrollbarThumbVertical">@drawable/config_scrollbarThumbVertical</item>
|
||||
<item name="scrollbarTrackHorizontal">@null</item>
|
||||
@@ -583,7 +583,7 @@ please see themes_device_defaults.xml.
|
||||
<!-- Scrollbar attributes -->
|
||||
<item name="scrollbarFadeDuration">250</item>
|
||||
<item name="scrollbarDefaultDelayBeforeFade">400</item>
|
||||
<item name="scrollbarSize">10dp</item>
|
||||
<item name="scrollbarSize">@dimen/config_scrollbarSize</item>
|
||||
<item name="scrollbarThumbHorizontal">@drawable/scrollbar_handle_material</item>
|
||||
<item name="scrollbarThumbVertical">@drawable/config_scrollbarThumbVertical</item>
|
||||
<item name="scrollbarTrackHorizontal">@null</item>
|
||||
|
||||
Reference in New Issue
Block a user