Loading api/current.xml +26 −0 Original line number Diff line number Diff line Loading @@ -225144,6 +225144,19 @@ <parameter name="filterText" type="java.lang.String"> </parameter> </method> <method name="setFriction" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="friction" type="float"> </parameter> </method> <method name="setItemChecked" return="void" abstract="false" Loading Loading @@ -238705,6 +238718,19 @@ <parameter name="newY" type="int"> </parameter> </method> <method name="setFriction" return="void" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="friction" type="float"> </parameter> </method> <method name="startScroll" return="void" abstract="false" core/java/android/widget/AbsListView.java +17 −19 Original line number Diff line number Diff line Loading @@ -2965,7 +2965,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int firstPos = mFirstPosition; final int lastPos = firstPos + getChildCount() - 1; int viewTravelCount = 0; int viewTravelCount; if (position <= firstPos) { viewTravelCount = firstPos - position + 1; mMode = MOVE_UP_POS; Loading Loading @@ -2998,7 +2998,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int firstPos = mFirstPosition; final int lastPos = firstPos + getChildCount() - 1; int viewTravelCount = 0; int viewTravelCount; if (position <= firstPos) { final int boundPosFromLast = lastPos - boundPosition; if (boundPosFromLast < 1) { Loading Loading @@ -3059,7 +3059,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int childCount = getChildCount(); final int lastPos = firstPos + childCount - 1; int viewTravelCount = 0; int viewTravelCount; if (position < firstPos) { viewTravelCount = firstPos - position; } else if (position > lastPos) { Loading Loading @@ -3248,6 +3248,20 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } } /** * The amount of friction applied to flings. The default value * is {@link ViewConfiguration#getScrollFriction}. * * @return A scalar dimensionless value representing the coefficient of * friction. */ public void setFriction(float friction) { if (mFlingRunnable == null) { mFlingRunnable = new FlingRunnable(); } mFlingRunnable.mScroller.setFriction(friction); } /** * Smoothly scroll to the specified adapter position. The view will * scroll such that the indicated position is displayed. Loading Loading @@ -3582,22 +3596,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te */ abstract int findMotionRow(int y); /** * Find the row closest to y. This row will be used as the motion row when scrolling. * * @param y Where the user touched * @return The position of the first (or only) item in the row closest to y */ int findClosestMotionRow(int y) { final int childCount = getChildCount(); if (childCount == 0) { return INVALID_POSITION; } final int motionRow = findMotionRow(y); return motionRow != INVALID_POSITION ? motionRow : mFirstPosition + childCount - 1; } /** * Causes all the views to be rebuilt and redrawn. */ Loading core/java/android/widget/Scroller.java +22 −6 Original line number Diff line number Diff line Loading @@ -63,7 +63,8 @@ public class Scroller { private static final int SCROLL_MODE = 0; private static final int FLING_MODE = 1; private final float mDeceleration; private float mDeceleration; private final float mPpi; /** * Create a Scroller with the default duration and interpolator. Loading @@ -79,11 +80,26 @@ public class Scroller { public Scroller(Context context, Interpolator interpolator) { mFinished = true; mInterpolator = interpolator; float ppi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = SensorManager.GRAVITY_EARTH // g (m/s^2) mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); } /** * The amount of friction applied to flings. The default value * is {@link ViewConfiguration#getScrollFriction}. * * @return A scalar dimensionless value representing the coefficient of * friction. */ public final void setFriction(float friction) { computeDeceleration(friction); } private float computeDeceleration(float friction) { return SensorManager.GRAVITY_EARTH // g (m/s^2) * 39.37f // inch/meter * ppi // pixels per inch * ViewConfiguration.getScrollFriction(); * mPpi // pixels per inch * friction; } /** Loading Loading
api/current.xml +26 −0 Original line number Diff line number Diff line Loading @@ -225144,6 +225144,19 @@ <parameter name="filterText" type="java.lang.String"> </parameter> </method> <method name="setFriction" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="friction" type="float"> </parameter> </method> <method name="setItemChecked" return="void" abstract="false" Loading Loading @@ -238705,6 +238718,19 @@ <parameter name="newY" type="int"> </parameter> </method> <method name="setFriction" return="void" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="friction" type="float"> </parameter> </method> <method name="startScroll" return="void" abstract="false"
core/java/android/widget/AbsListView.java +17 −19 Original line number Diff line number Diff line Loading @@ -2965,7 +2965,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int firstPos = mFirstPosition; final int lastPos = firstPos + getChildCount() - 1; int viewTravelCount = 0; int viewTravelCount; if (position <= firstPos) { viewTravelCount = firstPos - position + 1; mMode = MOVE_UP_POS; Loading Loading @@ -2998,7 +2998,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int firstPos = mFirstPosition; final int lastPos = firstPos + getChildCount() - 1; int viewTravelCount = 0; int viewTravelCount; if (position <= firstPos) { final int boundPosFromLast = lastPos - boundPosition; if (boundPosFromLast < 1) { Loading Loading @@ -3059,7 +3059,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int childCount = getChildCount(); final int lastPos = firstPos + childCount - 1; int viewTravelCount = 0; int viewTravelCount; if (position < firstPos) { viewTravelCount = firstPos - position; } else if (position > lastPos) { Loading Loading @@ -3248,6 +3248,20 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } } /** * The amount of friction applied to flings. The default value * is {@link ViewConfiguration#getScrollFriction}. * * @return A scalar dimensionless value representing the coefficient of * friction. */ public void setFriction(float friction) { if (mFlingRunnable == null) { mFlingRunnable = new FlingRunnable(); } mFlingRunnable.mScroller.setFriction(friction); } /** * Smoothly scroll to the specified adapter position. The view will * scroll such that the indicated position is displayed. Loading Loading @@ -3582,22 +3596,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te */ abstract int findMotionRow(int y); /** * Find the row closest to y. This row will be used as the motion row when scrolling. * * @param y Where the user touched * @return The position of the first (or only) item in the row closest to y */ int findClosestMotionRow(int y) { final int childCount = getChildCount(); if (childCount == 0) { return INVALID_POSITION; } final int motionRow = findMotionRow(y); return motionRow != INVALID_POSITION ? motionRow : mFirstPosition + childCount - 1; } /** * Causes all the views to be rebuilt and redrawn. */ Loading
core/java/android/widget/Scroller.java +22 −6 Original line number Diff line number Diff line Loading @@ -63,7 +63,8 @@ public class Scroller { private static final int SCROLL_MODE = 0; private static final int FLING_MODE = 1; private final float mDeceleration; private float mDeceleration; private final float mPpi; /** * Create a Scroller with the default duration and interpolator. Loading @@ -79,11 +80,26 @@ public class Scroller { public Scroller(Context context, Interpolator interpolator) { mFinished = true; mInterpolator = interpolator; float ppi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = SensorManager.GRAVITY_EARTH // g (m/s^2) mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); } /** * The amount of friction applied to flings. The default value * is {@link ViewConfiguration#getScrollFriction}. * * @return A scalar dimensionless value representing the coefficient of * friction. */ public final void setFriction(float friction) { computeDeceleration(friction); } private float computeDeceleration(float friction) { return SensorManager.GRAVITY_EARTH // g (m/s^2) * 39.37f // inch/meter * ppi // pixels per inch * ViewConfiguration.getScrollFriction(); * mPpi // pixels per inch * friction; } /** Loading