Loading core/java/android/widget/AbsListView.java +24 −16 Original line number Diff line number Diff line Loading @@ -617,6 +617,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te private int mTouchSlop; private float mDensityScale; private float mScrollFactor; private InputConnection mDefInputConnection; private InputConnectionWrapper mPublicInputConnection; Loading Loading @@ -874,6 +876,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final ViewConfiguration configuration = ViewConfiguration.get(mContext); mTouchSlop = configuration.getScaledTouchSlop(); mScrollFactor = configuration.getScaledScrollFactor(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); Loading Loading @@ -4206,21 +4209,26 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te @Override public boolean onGenericMotionEvent(MotionEvent event) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: if (mTouchMode == TOUCH_MODE_REST) { final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL); if (vscroll != 0) { final int delta = (int) (vscroll * getVerticalScrollFactor()); final float axisValue; if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_VSCROLL); } else if (event.isFromSource(InputDevice.SOURCE_ROTARY_ENCODER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_SCROLL); } else { axisValue = 0; } final int delta = Math.round(axisValue * mScrollFactor); if (delta != 0) { if (!trackMotionScroll(delta, delta)) { return true; } } } break; case MotionEvent.ACTION_BUTTON_PRESS: if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { int actionButton = event.getActionButton(); if ((actionButton == MotionEvent.BUTTON_STYLUS_PRIMARY || actionButton == MotionEvent.BUTTON_SECONDARY) Loading @@ -4230,8 +4238,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te removeCallbacks(mPendingCheckForTap); } } break; } break; } return super.onGenericMotionEvent(event); Loading core/java/android/widget/HorizontalScrollView.java +29 −21 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ public class HorizontalScrollView extends FrameLayout { private int mOverscrollDistance; private int mOverflingDistance; private float mScrollFactor; /** * ID of the active pointer. This is used to retain consistency during * drags/flings if multiple pointers are used. Loading Loading @@ -222,6 +224,7 @@ public class HorizontalScrollView extends FrameLayout { mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); mScrollFactor = configuration.getScaledScrollFactor(); } @Override Loading Loading @@ -724,18 +727,24 @@ public class HorizontalScrollView extends FrameLayout { @Override public boolean onGenericMotionEvent(MotionEvent event) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: { if (!mIsBeingDragged) { final float hscroll; final float axisValue; if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) { hscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL); axisValue = -event.getAxisValue(MotionEvent.AXIS_VSCROLL); } else { axisValue = event.getAxisValue(MotionEvent.AXIS_HSCROLL); } } else if (event.isFromSource(InputDevice.SOURCE_ROTARY_ENCODER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_SCROLL); } else { hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL); axisValue = 0; } if (hscroll != 0) { final int delta = (int) (hscroll * getHorizontalScrollFactor()); final int delta = Math.round(axisValue * mScrollFactor); if (delta != 0) { final int range = getScrollRange(); int oldScrollX = mScrollX; int newScrollX = oldScrollX + delta; Loading @@ -752,7 +761,6 @@ public class HorizontalScrollView extends FrameLayout { } } } } return super.onGenericMotionEvent(event); } Loading core/java/android/widget/ScrollView.java +29 −21 Original line number Diff line number Diff line Loading @@ -135,6 +135,8 @@ public class ScrollView extends FrameLayout { private int mOverscrollDistance; private int mOverflingDistance; private int mScrollFactor; /** * ID of the active pointer. This is used to retain consistency during * drags/flings if multiple pointers are used. Loading Loading @@ -248,6 +250,7 @@ public class ScrollView extends FrameLayout { mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); mScrollFactor = configuration.getScaledScrollFactor(); } @Override Loading Loading @@ -782,13 +785,19 @@ public class ScrollView extends FrameLayout { @Override public boolean onGenericMotionEvent(MotionEvent event) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: { if (!mIsBeingDragged) { final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL); if (vscroll != 0) { final int delta = (int) (vscroll * getVerticalScrollFactor()); case MotionEvent.ACTION_SCROLL: final float axisValue; if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_VSCROLL); } else if (event.isFromSource(InputDevice.SOURCE_ROTARY_ENCODER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_SCROLL); } else { axisValue = 0; } final int delta = Math.round(axisValue * mScrollFactor); if (delta != 0) { final int range = getScrollRange(); int oldScrollY = mScrollY; int newScrollY = oldScrollY - delta; Loading @@ -802,10 +811,9 @@ public class ScrollView extends FrameLayout { return true; } } break; } } } } return super.onGenericMotionEvent(event); } Loading Loading
core/java/android/widget/AbsListView.java +24 −16 Original line number Diff line number Diff line Loading @@ -617,6 +617,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te private int mTouchSlop; private float mDensityScale; private float mScrollFactor; private InputConnection mDefInputConnection; private InputConnectionWrapper mPublicInputConnection; Loading Loading @@ -874,6 +876,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final ViewConfiguration configuration = ViewConfiguration.get(mContext); mTouchSlop = configuration.getScaledTouchSlop(); mScrollFactor = configuration.getScaledScrollFactor(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); Loading Loading @@ -4206,21 +4209,26 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te @Override public boolean onGenericMotionEvent(MotionEvent event) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: if (mTouchMode == TOUCH_MODE_REST) { final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL); if (vscroll != 0) { final int delta = (int) (vscroll * getVerticalScrollFactor()); final float axisValue; if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_VSCROLL); } else if (event.isFromSource(InputDevice.SOURCE_ROTARY_ENCODER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_SCROLL); } else { axisValue = 0; } final int delta = Math.round(axisValue * mScrollFactor); if (delta != 0) { if (!trackMotionScroll(delta, delta)) { return true; } } } break; case MotionEvent.ACTION_BUTTON_PRESS: if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { int actionButton = event.getActionButton(); if ((actionButton == MotionEvent.BUTTON_STYLUS_PRIMARY || actionButton == MotionEvent.BUTTON_SECONDARY) Loading @@ -4230,8 +4238,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te removeCallbacks(mPendingCheckForTap); } } break; } break; } return super.onGenericMotionEvent(event); Loading
core/java/android/widget/HorizontalScrollView.java +29 −21 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ public class HorizontalScrollView extends FrameLayout { private int mOverscrollDistance; private int mOverflingDistance; private float mScrollFactor; /** * ID of the active pointer. This is used to retain consistency during * drags/flings if multiple pointers are used. Loading Loading @@ -222,6 +224,7 @@ public class HorizontalScrollView extends FrameLayout { mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); mScrollFactor = configuration.getScaledScrollFactor(); } @Override Loading Loading @@ -724,18 +727,24 @@ public class HorizontalScrollView extends FrameLayout { @Override public boolean onGenericMotionEvent(MotionEvent event) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: { if (!mIsBeingDragged) { final float hscroll; final float axisValue; if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) { hscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL); axisValue = -event.getAxisValue(MotionEvent.AXIS_VSCROLL); } else { axisValue = event.getAxisValue(MotionEvent.AXIS_HSCROLL); } } else if (event.isFromSource(InputDevice.SOURCE_ROTARY_ENCODER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_SCROLL); } else { hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL); axisValue = 0; } if (hscroll != 0) { final int delta = (int) (hscroll * getHorizontalScrollFactor()); final int delta = Math.round(axisValue * mScrollFactor); if (delta != 0) { final int range = getScrollRange(); int oldScrollX = mScrollX; int newScrollX = oldScrollX + delta; Loading @@ -752,7 +761,6 @@ public class HorizontalScrollView extends FrameLayout { } } } } return super.onGenericMotionEvent(event); } Loading
core/java/android/widget/ScrollView.java +29 −21 Original line number Diff line number Diff line Loading @@ -135,6 +135,8 @@ public class ScrollView extends FrameLayout { private int mOverscrollDistance; private int mOverflingDistance; private int mScrollFactor; /** * ID of the active pointer. This is used to retain consistency during * drags/flings if multiple pointers are used. Loading Loading @@ -248,6 +250,7 @@ public class ScrollView extends FrameLayout { mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); mScrollFactor = configuration.getScaledScrollFactor(); } @Override Loading Loading @@ -782,13 +785,19 @@ public class ScrollView extends FrameLayout { @Override public boolean onGenericMotionEvent(MotionEvent event) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: { if (!mIsBeingDragged) { final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL); if (vscroll != 0) { final int delta = (int) (vscroll * getVerticalScrollFactor()); case MotionEvent.ACTION_SCROLL: final float axisValue; if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_VSCROLL); } else if (event.isFromSource(InputDevice.SOURCE_ROTARY_ENCODER)) { axisValue = event.getAxisValue(MotionEvent.AXIS_SCROLL); } else { axisValue = 0; } final int delta = Math.round(axisValue * mScrollFactor); if (delta != 0) { final int range = getScrollRange(); int oldScrollY = mScrollY; int newScrollY = oldScrollY - delta; Loading @@ -802,10 +811,9 @@ public class ScrollView extends FrameLayout { return true; } } break; } } } } return super.onGenericMotionEvent(event); } Loading