Merge change 6241 into donut
* changes: Fixes #1444844. Set a maximum fling velocity in scrollable views.
This commit is contained in:
@ -139718,6 +139718,21 @@
|
|||||||
<parameter name="units" type="int">
|
<parameter name="units" type="int">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="computeCurrentVelocity"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="units" type="int">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="maxVelocity" type="float">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="getXVelocity"
|
<method name="getXVelocity"
|
||||||
return="float"
|
return="float"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -144121,6 +144136,17 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="getMaximumFlingVelocity"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="true"
|
||||||
|
final="false"
|
||||||
|
deprecated="deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
<method name="getMinimumFlingVelocity"
|
<method name="getMinimumFlingVelocity"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -144187,6 +144213,17 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="getScaledMaximumFlingVelocity"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
<method name="getScaledMinimumFlingVelocity"
|
<method name="getScaledMinimumFlingVelocity"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
|
@ -198,6 +198,7 @@ public class GestureDetector {
|
|||||||
private int mTouchSlopSquare;
|
private int mTouchSlopSquare;
|
||||||
private int mDoubleTapSlopSquare;
|
private int mDoubleTapSlopSquare;
|
||||||
private int mMinimumFlingVelocity;
|
private int mMinimumFlingVelocity;
|
||||||
|
private int mMaximumFlingVelocity;
|
||||||
|
|
||||||
private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout();
|
private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout();
|
||||||
private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout();
|
private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout();
|
||||||
@ -361,11 +362,13 @@ public class GestureDetector {
|
|||||||
doubleTapSlop = ViewConfiguration.getDoubleTapSlop();
|
doubleTapSlop = ViewConfiguration.getDoubleTapSlop();
|
||||||
//noinspection deprecation
|
//noinspection deprecation
|
||||||
mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
|
mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
|
||||||
|
mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
|
||||||
} else {
|
} else {
|
||||||
final ViewConfiguration configuration = ViewConfiguration.get(context);
|
final ViewConfiguration configuration = ViewConfiguration.get(context);
|
||||||
touchSlop = configuration.getScaledTouchSlop();
|
touchSlop = configuration.getScaledTouchSlop();
|
||||||
doubleTapSlop = configuration.getScaledDoubleTapSlop();
|
doubleTapSlop = configuration.getScaledDoubleTapSlop();
|
||||||
mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
|
mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
|
||||||
|
mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||||
}
|
}
|
||||||
mTouchSlopSquare = touchSlop * touchSlop;
|
mTouchSlopSquare = touchSlop * touchSlop;
|
||||||
mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
|
mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
|
||||||
@ -505,7 +508,7 @@ public class GestureDetector {
|
|||||||
|
|
||||||
// A fling must travel the minimum tap distance
|
// A fling must travel the minimum tap distance
|
||||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||||
velocityTracker.computeCurrentVelocity(1000);
|
velocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
|
||||||
final float velocityY = velocityTracker.getYVelocity();
|
final float velocityY = velocityTracker.getYVelocity();
|
||||||
final float velocityX = velocityTracker.getXVelocity();
|
final float velocityX = velocityTracker.getXVelocity();
|
||||||
|
|
||||||
|
@ -166,6 +166,16 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Equivalent to invoking {@link #computeCurrentVelocity(int, float)} with a maximum
|
||||||
|
* velocity of Float.MAX_VALUE.
|
||||||
|
*
|
||||||
|
* @see #computeCurrentVelocity(int, float)
|
||||||
|
*/
|
||||||
|
public void computeCurrentVelocity(int units) {
|
||||||
|
computeCurrentVelocity(units, Float.MAX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the current velocity based on the points that have been
|
* Compute the current velocity based on the points that have been
|
||||||
* collected. Only call this when you actually want to retrieve velocity
|
* collected. Only call this when you actually want to retrieve velocity
|
||||||
@ -175,8 +185,11 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
|
|||||||
*
|
*
|
||||||
* @param units The units you would like the velocity in. A value of 1
|
* @param units The units you would like the velocity in. A value of 1
|
||||||
* provides pixels per millisecond, 1000 provides pixels per second, etc.
|
* provides pixels per millisecond, 1000 provides pixels per second, etc.
|
||||||
|
* @param maxVelocity The maximum velocity that can be computed by this method.
|
||||||
|
* This value must be declared in the same unit as the units parameter. This value
|
||||||
|
* must be positive.
|
||||||
*/
|
*/
|
||||||
public void computeCurrentVelocity(int units) {
|
public void computeCurrentVelocity(int units, float maxVelocity) {
|
||||||
final float[] pastX = mPastX;
|
final float[] pastX = mPastX;
|
||||||
final float[] pastY = mPastY;
|
final float[] pastY = mPastY;
|
||||||
final long[] pastTime = mPastTime;
|
final long[] pastTime = mPastTime;
|
||||||
@ -210,8 +223,8 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
|
|||||||
if (accumY == 0) accumY = vel;
|
if (accumY == 0) accumY = vel;
|
||||||
else accumY = (accumY + vel) * .5f;
|
else accumY = (accumY + vel) * .5f;
|
||||||
}
|
}
|
||||||
mXVelocity = accumX;
|
mXVelocity = accumX < 0.0f ? Math.max(accumX, -maxVelocity) : Math.min(accumX, maxVelocity);
|
||||||
mYVelocity = accumY;
|
mYVelocity = accumY < 0.0f ? Math.max(accumY, -maxVelocity) : Math.min(accumY, maxVelocity);
|
||||||
|
|
||||||
if (localLOGV) Log.v(TAG, "Y velocity=" + mYVelocity +" X velocity="
|
if (localLOGV) Log.v(TAG, "Y velocity=" + mYVelocity +" X velocity="
|
||||||
+ mXVelocity + " N=" + N);
|
+ mXVelocity + " N=" + N);
|
||||||
|
@ -107,6 +107,11 @@ public class ViewConfiguration {
|
|||||||
*/
|
*/
|
||||||
private static final int MINIMUM_FLING_VELOCITY = 50;
|
private static final int MINIMUM_FLING_VELOCITY = 50;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum velocity to initiate a fling, as measured in pixels per second
|
||||||
|
*/
|
||||||
|
private static final int MAXIMUM_FLING_VELOCITY = 4000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum size of View's drawing cache, expressed in bytes. This size
|
* The maximum size of View's drawing cache, expressed in bytes. This size
|
||||||
* should be at least equal to the size of the screen in ARGB888 format.
|
* should be at least equal to the size of the screen in ARGB888 format.
|
||||||
@ -122,6 +127,7 @@ public class ViewConfiguration {
|
|||||||
private final int mEdgeSlop;
|
private final int mEdgeSlop;
|
||||||
private final int mFadingEdgeLength;
|
private final int mFadingEdgeLength;
|
||||||
private final int mMinimumFlingVelocity;
|
private final int mMinimumFlingVelocity;
|
||||||
|
private final int mMaximumFlingVelocity;
|
||||||
private final int mScrollbarSize;
|
private final int mScrollbarSize;
|
||||||
private final int mTouchSlop;
|
private final int mTouchSlop;
|
||||||
private final int mDoubleTapSlop;
|
private final int mDoubleTapSlop;
|
||||||
@ -139,6 +145,7 @@ public class ViewConfiguration {
|
|||||||
mEdgeSlop = EDGE_SLOP;
|
mEdgeSlop = EDGE_SLOP;
|
||||||
mFadingEdgeLength = FADING_EDGE_LENGTH;
|
mFadingEdgeLength = FADING_EDGE_LENGTH;
|
||||||
mMinimumFlingVelocity = MINIMUM_FLING_VELOCITY;
|
mMinimumFlingVelocity = MINIMUM_FLING_VELOCITY;
|
||||||
|
mMaximumFlingVelocity = MAXIMUM_FLING_VELOCITY;
|
||||||
mScrollbarSize = SCROLL_BAR_SIZE;
|
mScrollbarSize = SCROLL_BAR_SIZE;
|
||||||
mTouchSlop = TOUCH_SLOP;
|
mTouchSlop = TOUCH_SLOP;
|
||||||
mDoubleTapSlop = DOUBLE_TAP_SLOP;
|
mDoubleTapSlop = DOUBLE_TAP_SLOP;
|
||||||
@ -164,6 +171,7 @@ public class ViewConfiguration {
|
|||||||
mEdgeSlop = (int) (density * EDGE_SLOP + 0.5f);
|
mEdgeSlop = (int) (density * EDGE_SLOP + 0.5f);
|
||||||
mFadingEdgeLength = (int) (density * FADING_EDGE_LENGTH + 0.5f);
|
mFadingEdgeLength = (int) (density * FADING_EDGE_LENGTH + 0.5f);
|
||||||
mMinimumFlingVelocity = (int) (density * MINIMUM_FLING_VELOCITY + 0.5f);
|
mMinimumFlingVelocity = (int) (density * MINIMUM_FLING_VELOCITY + 0.5f);
|
||||||
|
mMaximumFlingVelocity = (int) (density * MAXIMUM_FLING_VELOCITY + 0.5f);
|
||||||
mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
|
mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
|
||||||
mTouchSlop = (int) (density * TOUCH_SLOP + 0.5f);
|
mTouchSlop = (int) (density * TOUCH_SLOP + 0.5f);
|
||||||
mDoubleTapSlop = (int) (density * DOUBLE_TAP_SLOP + 0.5f);
|
mDoubleTapSlop = (int) (density * DOUBLE_TAP_SLOP + 0.5f);
|
||||||
@ -366,6 +374,23 @@ public class ViewConfiguration {
|
|||||||
return mMinimumFlingVelocity;
|
return mMinimumFlingVelocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Maximum velocity to initiate a fling, as measured in pixels per second.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link #getScaledMaximumFlingVelocity()} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static int getMaximumFlingVelocity() {
|
||||||
|
return MAXIMUM_FLING_VELOCITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Maximum velocity to initiate a fling, as measured in pixels per second.
|
||||||
|
*/
|
||||||
|
public int getScaledMaximumFlingVelocity() {
|
||||||
|
return mMaximumFlingVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum drawing cache size expressed in bytes.
|
* The maximum drawing cache size expressed in bytes.
|
||||||
*
|
*
|
||||||
|
@ -237,6 +237,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
* Helper class to get velocity for fling
|
* Helper class to get velocity for fling
|
||||||
*/
|
*/
|
||||||
VelocityTracker mVelocityTracker;
|
VelocityTracker mVelocityTracker;
|
||||||
|
private int mMaximumFling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Touch mode
|
* Touch mode
|
||||||
@ -676,7 +677,8 @@ public class WebView extends AbsoluteLayout
|
|||||||
setClickable(true);
|
setClickable(true);
|
||||||
setLongClickable(true);
|
setLongClickable(true);
|
||||||
|
|
||||||
final int slop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
final ViewConfiguration configuration = ViewConfiguration.get(getContext());
|
||||||
|
final int slop = configuration.getScaledTouchSlop();
|
||||||
mTouchSlopSquare = slop * slop;
|
mTouchSlopSquare = slop * slop;
|
||||||
mMinLockSnapReverseDistance = slop;
|
mMinLockSnapReverseDistance = slop;
|
||||||
final float density = getContext().getResources().getDisplayMetrics().density;
|
final float density = getContext().getResources().getDisplayMetrics().density;
|
||||||
@ -692,6 +694,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
DEFAULT_MIN_ZOOM_SCALE = 0.25f * density;
|
DEFAULT_MIN_ZOOM_SCALE = 0.25f * density;
|
||||||
mMaxZoomScale = DEFAULT_MAX_ZOOM_SCALE;
|
mMaxZoomScale = DEFAULT_MAX_ZOOM_SCALE;
|
||||||
mMinZoomScale = DEFAULT_MIN_ZOOM_SCALE;
|
mMinZoomScale = DEFAULT_MIN_ZOOM_SCALE;
|
||||||
|
mMaximumFling = configuration.getScaledMaximumFlingVelocity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */void updateDefaultZoomDensity(int zoomDensity) {
|
/* package */void updateDefaultZoomDensity(int zoomDensity) {
|
||||||
@ -4157,7 +4160,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
int maxX = Math.max(computeHorizontalScrollRange() - getViewWidth(), 0);
|
int maxX = Math.max(computeHorizontalScrollRange() - getViewWidth(), 0);
|
||||||
int maxY = Math.max(computeVerticalScrollRange() - getViewHeight(), 0);
|
int maxY = Math.max(computeVerticalScrollRange() - getViewHeight(), 0);
|
||||||
|
|
||||||
mVelocityTracker.computeCurrentVelocity(1000);
|
mVelocityTracker.computeCurrentVelocity(1000, mMaximumFling);
|
||||||
int vx = (int) mVelocityTracker.getXVelocity();
|
int vx = (int) mVelocityTracker.getXVelocity();
|
||||||
int vy = (int) mVelocityTracker.getYVelocity();
|
int vy = (int) mVelocityTracker.getYVelocity();
|
||||||
|
|
||||||
|
@ -438,6 +438,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
private InputConnectionWrapper mPublicInputConnection;
|
private InputConnectionWrapper mPublicInputConnection;
|
||||||
|
|
||||||
private Runnable mClearScrollingCache;
|
private Runnable mClearScrollingCache;
|
||||||
|
private int mMinimumVelocity;
|
||||||
|
private int mMaximumVelocity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface definition for a callback to be invoked when the list or grid
|
* Interface definition for a callback to be invoked when the list or grid
|
||||||
@ -549,7 +551,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
setAlwaysDrawnWithCacheEnabled(false);
|
setAlwaysDrawnWithCacheEnabled(false);
|
||||||
setScrollingCacheEnabled(true);
|
setScrollingCacheEnabled(true);
|
||||||
|
|
||||||
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
|
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
|
||||||
|
mTouchSlop = configuration.getScaledTouchSlop();
|
||||||
|
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
|
||||||
|
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||||
mDensityScale = getContext().getResources().getDisplayMetrics().density;
|
mDensityScale = getContext().getResources().getDisplayMetrics().density;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2058,12 +2063,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
break;
|
break;
|
||||||
case TOUCH_MODE_SCROLL:
|
case TOUCH_MODE_SCROLL:
|
||||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||||
velocityTracker.computeCurrentVelocity(1000);
|
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
|
||||||
int initialVelocity = (int)velocityTracker.getYVelocity();
|
final int initialVelocity = (int) velocityTracker.getYVelocity();
|
||||||
|
if (Math.abs(initialVelocity) > mMinimumVelocity && (getChildCount() > 0)) {
|
||||||
if ((Math.abs(initialVelocity) >
|
|
||||||
ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity()) &&
|
|
||||||
(getChildCount() > 0)) {
|
|
||||||
if (mFlingRunnable == null) {
|
if (mFlingRunnable == null) {
|
||||||
mFlingRunnable = new FlingRunnable();
|
mFlingRunnable = new FlingRunnable();
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,8 @@ public class HorizontalScrollView extends FrameLayout {
|
|||||||
private boolean mSmoothScrollingEnabled = true;
|
private boolean mSmoothScrollingEnabled = true;
|
||||||
|
|
||||||
private int mTouchSlop;
|
private int mTouchSlop;
|
||||||
|
private int mMinimumVelocity;
|
||||||
|
private int mMaximumVelocity;
|
||||||
|
|
||||||
public HorizontalScrollView(Context context) {
|
public HorizontalScrollView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@ -179,7 +181,10 @@ public class HorizontalScrollView extends FrameLayout {
|
|||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
|
||||||
|
mTouchSlop = configuration.getScaledTouchSlop();
|
||||||
|
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
|
||||||
|
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -477,12 +482,10 @@ public class HorizontalScrollView extends FrameLayout {
|
|||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||||
velocityTracker.computeCurrentVelocity(1000);
|
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
|
||||||
int initialVelocity = (int) velocityTracker.getXVelocity();
|
int initialVelocity = (int) velocityTracker.getXVelocity();
|
||||||
|
|
||||||
if ((Math.abs(initialVelocity) >
|
if ((Math.abs(initialVelocity) > mMinimumVelocity) && getChildCount() > 0) {
|
||||||
ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity()) &&
|
|
||||||
getChildCount() > 0) {
|
|
||||||
fling(-initialVelocity);
|
fling(-initialVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +115,8 @@ public class ScrollView extends FrameLayout {
|
|||||||
private boolean mSmoothScrollingEnabled = true;
|
private boolean mSmoothScrollingEnabled = true;
|
||||||
|
|
||||||
private int mTouchSlop;
|
private int mTouchSlop;
|
||||||
|
private int mMinimumVelocity;
|
||||||
|
private int mMaximumVelocity;
|
||||||
|
|
||||||
public ScrollView(Context context) {
|
public ScrollView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@ -180,7 +182,10 @@ public class ScrollView extends FrameLayout {
|
|||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
|
||||||
|
mTouchSlop = configuration.getScaledTouchSlop();
|
||||||
|
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
|
||||||
|
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -478,12 +483,10 @@ public class ScrollView extends FrameLayout {
|
|||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||||
velocityTracker.computeCurrentVelocity(1000);
|
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
|
||||||
int initialVelocity = (int) velocityTracker.getYVelocity();
|
int initialVelocity = (int) velocityTracker.getYVelocity();
|
||||||
|
|
||||||
if ((Math.abs(initialVelocity) >
|
if ((Math.abs(initialVelocity) > mMinimumVelocity) && getChildCount() > 0) {
|
||||||
ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity()) &&
|
|
||||||
getChildCount() > 0) {
|
|
||||||
fling(-initialVelocity);
|
fling(-initialVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user