Split scroll factor into a 2d float.
Test: Existing unit tests, manual sanity check.
BUG=35764483
Change-Id: If6ac121452698747e1f8bc9d4ec0111bb881d4d4
(cherry picked from commit e9956c5c65)
This commit is contained in:
@@ -45995,6 +45995,7 @@ package android.view {
|
||||
method public static deprecated int getEdgeSlop();
|
||||
method public static deprecated int getFadingEdgeLength();
|
||||
method public static deprecated long getGlobalActionKeyTimeout();
|
||||
method public float getScaledHorizontalScrollFactor();
|
||||
method public static int getJumpTapTimeout();
|
||||
method public static int getKeyRepeatDelay();
|
||||
method public static int getKeyRepeatTimeout();
|
||||
@@ -46013,7 +46014,6 @@ package android.view {
|
||||
method public int getScaledOverscrollDistance();
|
||||
method public int getScaledPagingTouchSlop();
|
||||
method public int getScaledScrollBarSize();
|
||||
method public int getScaledScrollFactor();
|
||||
method public int getScaledTouchSlop();
|
||||
method public int getScaledWindowTouchSlop();
|
||||
method public static int getScrollBarFadeDuration();
|
||||
@@ -46022,6 +46022,7 @@ package android.view {
|
||||
method public static float getScrollFriction();
|
||||
method public static int getTapTimeout();
|
||||
method public static deprecated int getTouchSlop();
|
||||
method public float getScaledVerticalScrollFactor();
|
||||
method public static deprecated int getWindowTouchSlop();
|
||||
method public static long getZoomControlsTimeout();
|
||||
method public boolean hasPermanentMenuKey();
|
||||
|
||||
@@ -374,6 +374,10 @@ package android.view {
|
||||
method protected void initializeScrollbars(android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
public class ViewConfiguration {
|
||||
method public int getScaledScrollFactor();
|
||||
}
|
||||
|
||||
public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
|
||||
field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
|
||||
}
|
||||
|
||||
@@ -49450,6 +49450,7 @@ package android.view {
|
||||
method public static deprecated int getEdgeSlop();
|
||||
method public static deprecated int getFadingEdgeLength();
|
||||
method public static deprecated long getGlobalActionKeyTimeout();
|
||||
method public float getScaledHorizontalScrollFactor();
|
||||
method public static int getJumpTapTimeout();
|
||||
method public static int getKeyRepeatDelay();
|
||||
method public static int getKeyRepeatTimeout();
|
||||
@@ -49468,7 +49469,6 @@ package android.view {
|
||||
method public int getScaledOverscrollDistance();
|
||||
method public int getScaledPagingTouchSlop();
|
||||
method public int getScaledScrollBarSize();
|
||||
method public int getScaledScrollFactor();
|
||||
method public int getScaledTouchSlop();
|
||||
method public int getScaledWindowTouchSlop();
|
||||
method public static int getScrollBarFadeDuration();
|
||||
@@ -49477,6 +49477,7 @@ package android.view {
|
||||
method public static float getScrollFriction();
|
||||
method public static int getTapTimeout();
|
||||
method public static deprecated int getTouchSlop();
|
||||
method public float getScaledVerticalScrollFactor();
|
||||
method public static deprecated int getWindowTouchSlop();
|
||||
method public static long getZoomControlsTimeout();
|
||||
method public boolean hasPermanentMenuKey();
|
||||
|
||||
@@ -368,6 +368,10 @@ package android.view {
|
||||
method protected void initializeScrollbars(android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
public class ViewConfiguration {
|
||||
method public int getScaledScrollFactor();
|
||||
}
|
||||
|
||||
public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
|
||||
field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
|
||||
}
|
||||
|
||||
@@ -46372,6 +46372,7 @@ package android.view {
|
||||
method public static deprecated int getEdgeSlop();
|
||||
method public static deprecated int getFadingEdgeLength();
|
||||
method public static deprecated long getGlobalActionKeyTimeout();
|
||||
method public float getScaledHorizontalScrollFactor();
|
||||
method public static int getHoverTooltipHideShortTimeout();
|
||||
method public static int getHoverTooltipHideTimeout();
|
||||
method public static int getHoverTooltipShowTimeout();
|
||||
@@ -46394,7 +46395,6 @@ package android.view {
|
||||
method public int getScaledOverscrollDistance();
|
||||
method public int getScaledPagingTouchSlop();
|
||||
method public int getScaledScrollBarSize();
|
||||
method public int getScaledScrollFactor();
|
||||
method public int getScaledTouchSlop();
|
||||
method public int getScaledWindowTouchSlop();
|
||||
method public static int getScrollBarFadeDuration();
|
||||
@@ -46403,6 +46403,7 @@ package android.view {
|
||||
method public static float getScrollFriction();
|
||||
method public static int getTapTimeout();
|
||||
method public static deprecated int getTouchSlop();
|
||||
method public float getScaledVerticalScrollFactor();
|
||||
method public static deprecated int getWindowTouchSlop();
|
||||
method public static long getZoomControlsTimeout();
|
||||
method public boolean hasPermanentMenuKey();
|
||||
|
||||
@@ -374,6 +374,10 @@ package android.view {
|
||||
method protected void initializeScrollbars(android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
public class ViewConfiguration {
|
||||
method public int getScaledScrollFactor();
|
||||
}
|
||||
|
||||
public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
|
||||
field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
|
||||
}
|
||||
|
||||
@@ -232,10 +232,16 @@ public class ViewConfiguration {
|
||||
private static final int OVERFLING_DISTANCE = 6;
|
||||
|
||||
/**
|
||||
* Amount to scroll in response to a {@link MotionEvent#ACTION_SCROLL} event, in dips per
|
||||
* axis value.
|
||||
* Amount to scroll in response to a horizontal {@link MotionEvent#ACTION_SCROLL} event,
|
||||
* in dips per axis value.
|
||||
*/
|
||||
private static final int SCROLL_FACTOR = 64;
|
||||
private static final float HORIZONTAL_SCROLL_FACTOR = 64;
|
||||
|
||||
/**
|
||||
* Amount to scroll in response to a vertical {@link MotionEvent#ACTION_SCROLL} event,
|
||||
* in dips per axis value.
|
||||
*/
|
||||
private static final float VERTICAL_SCROLL_FACTOR = 64;
|
||||
|
||||
/**
|
||||
* Default duration to hide an action mode for.
|
||||
@@ -289,7 +295,8 @@ public class ViewConfiguration {
|
||||
private final int mOverflingDistance;
|
||||
private final boolean mFadingMarqueeEnabled;
|
||||
private final long mGlobalActionsKeyTimeout;
|
||||
private final int mScrollFactor;
|
||||
private final float mVerticalScrollFactor;
|
||||
private final float mHorizontalScrollFactor;
|
||||
|
||||
private boolean sHasPermanentMenuKey;
|
||||
private boolean sHasPermanentMenuKeySet;
|
||||
@@ -319,7 +326,8 @@ public class ViewConfiguration {
|
||||
mOverflingDistance = OVERFLING_DISTANCE;
|
||||
mFadingMarqueeEnabled = true;
|
||||
mGlobalActionsKeyTimeout = GLOBAL_ACTIONS_KEY_TIMEOUT;
|
||||
mScrollFactor = SCROLL_FACTOR;
|
||||
mHorizontalScrollFactor = HORIZONTAL_SCROLL_FACTOR;
|
||||
mVerticalScrollFactor = VERTICAL_SCROLL_FACTOR;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,8 +414,11 @@ public class ViewConfiguration {
|
||||
com.android.internal.R.dimen.config_viewMaxFlingVelocity);
|
||||
mGlobalActionsKeyTimeout = res.getInteger(
|
||||
com.android.internal.R.integer.config_globalActionsKeyTimeout);
|
||||
mScrollFactor = res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.config_scrollFactor);
|
||||
|
||||
mHorizontalScrollFactor = res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.config_horizontalScrollFactor);
|
||||
mVerticalScrollFactor = res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.config_verticalScrollFactor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -730,9 +741,27 @@ public class ViewConfiguration {
|
||||
/**
|
||||
* @return Amount to scroll in response to a {@link MotionEvent#ACTION_SCROLL} event. Multiply
|
||||
* this by the event's axis value to obtain the number of pixels to be scrolled.
|
||||
*
|
||||
* @removed
|
||||
*/
|
||||
public int getScaledScrollFactor() {
|
||||
return mScrollFactor;
|
||||
return (int) mVerticalScrollFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Amount to scroll in response to a horizontal {@link MotionEvent#ACTION_SCROLL} event.
|
||||
* Multiply this by the event's axis value to obtain the number of pixels to be scrolled.
|
||||
*/
|
||||
public float getScaledHorizontalScrollFactor() {
|
||||
return mHorizontalScrollFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Amount to scroll in response to a vertical {@link MotionEvent#ACTION_SCROLL} event.
|
||||
* Multiply this by the event's axis value to obtain the number of pixels to be scrolled.
|
||||
*/
|
||||
public float getScaledVerticalScrollFactor() {
|
||||
return mVerticalScrollFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -618,7 +618,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
private int mTouchSlop;
|
||||
private float mDensityScale;
|
||||
|
||||
private float mScrollFactor;
|
||||
private float mVerticalScrollFactor;
|
||||
|
||||
private InputConnection mDefInputConnection;
|
||||
private InputConnectionWrapper mPublicInputConnection;
|
||||
@@ -877,7 +877,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
|
||||
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
|
||||
mTouchSlop = configuration.getScaledTouchSlop();
|
||||
mScrollFactor = configuration.getScaledScrollFactor();
|
||||
mVerticalScrollFactor = configuration.getScaledVerticalScrollFactor();
|
||||
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
|
||||
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||
mOverscrollDistance = configuration.getScaledOverscrollDistance();
|
||||
@@ -4225,7 +4225,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
axisValue = 0;
|
||||
}
|
||||
|
||||
final int delta = Math.round(axisValue * mScrollFactor);
|
||||
final int delta = Math.round(axisValue * mVerticalScrollFactor);
|
||||
if (delta != 0) {
|
||||
if (!trackMotionScroll(delta, delta)) {
|
||||
return true;
|
||||
|
||||
@@ -129,7 +129,7 @@ public class HorizontalScrollView extends FrameLayout {
|
||||
private int mOverscrollDistance;
|
||||
private int mOverflingDistance;
|
||||
|
||||
private float mScrollFactor;
|
||||
private float mHorizontalScrollFactor;
|
||||
|
||||
/**
|
||||
* ID of the active pointer. This is used to retain consistency during
|
||||
@@ -224,7 +224,7 @@ public class HorizontalScrollView extends FrameLayout {
|
||||
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||
mOverscrollDistance = configuration.getScaledOverscrollDistance();
|
||||
mOverflingDistance = configuration.getScaledOverflingDistance();
|
||||
mScrollFactor = configuration.getScaledScrollFactor();
|
||||
mHorizontalScrollFactor = configuration.getScaledHorizontalScrollFactor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -743,7 +743,7 @@ public class HorizontalScrollView extends FrameLayout {
|
||||
axisValue = 0;
|
||||
}
|
||||
|
||||
final int delta = Math.round(axisValue * mScrollFactor);
|
||||
final int delta = Math.round(axisValue * mHorizontalScrollFactor);
|
||||
if (delta != 0) {
|
||||
final int range = getScrollRange();
|
||||
int oldScrollX = mScrollX;
|
||||
|
||||
@@ -135,7 +135,7 @@ public class ScrollView extends FrameLayout {
|
||||
private int mOverscrollDistance;
|
||||
private int mOverflingDistance;
|
||||
|
||||
private int mScrollFactor;
|
||||
private float mVerticalScrollFactor;
|
||||
|
||||
/**
|
||||
* ID of the active pointer. This is used to retain consistency during
|
||||
@@ -250,7 +250,7 @@ public class ScrollView extends FrameLayout {
|
||||
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||
mOverscrollDistance = configuration.getScaledOverscrollDistance();
|
||||
mOverflingDistance = configuration.getScaledOverflingDistance();
|
||||
mScrollFactor = configuration.getScaledScrollFactor();
|
||||
mVerticalScrollFactor = configuration.getScaledVerticalScrollFactor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -796,7 +796,7 @@ public class ScrollView extends FrameLayout {
|
||||
axisValue = 0;
|
||||
}
|
||||
|
||||
final int delta = Math.round(axisValue * mScrollFactor);
|
||||
final int delta = Math.round(axisValue * mVerticalScrollFactor);
|
||||
if (delta != 0) {
|
||||
final int range = getScrollRange();
|
||||
int oldScrollY = mScrollY;
|
||||
@@ -1875,7 +1875,7 @@ public class ScrollView extends FrameLayout {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HorizontalScrollView.SavedState{"
|
||||
return "ScrollView.SavedState{"
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " scrollPosition=" + scrollPosition + "}";
|
||||
}
|
||||
|
||||
@@ -1880,8 +1880,16 @@
|
||||
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. -->
|
||||
<!-- Distance that should be scrolled, per axis value, in response to a horizontal
|
||||
{@link MotionEvent#ACTION_SCROLL} event. -->
|
||||
<dimen name="config_horizontalScrollFactor">64dp</dimen>
|
||||
|
||||
<!-- Distance that should be scrolled, per axis value, in response to a vertical
|
||||
{@link MotionEvent#ACTION_SCROLL} event. -->
|
||||
<dimen name="config_verticalScrollFactor">64dp</dimen>
|
||||
|
||||
<!-- Obsolete. Distance that should be scrolled, per axis value, in response to a
|
||||
{@link MotionEvent#ACTION_SCROLL} event. -->
|
||||
<dimen name="config_scrollFactor">64dp</dimen>
|
||||
|
||||
<!-- Maximum number of grid columns permitted in the ResolverActivity
|
||||
|
||||
@@ -434,6 +434,8 @@
|
||||
<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_horizontalScrollFactor" />
|
||||
<java-symbol type="dimen" name="config_verticalScrollFactor" />
|
||||
<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" />
|
||||
|
||||
Reference in New Issue
Block a user