setOnScrollListener(this); setFadingEdgeLength(0); setFrictionIfSupported(ViewConfiguration.getScrollFriction() * mFriction);
protected void setUpListView() { setCacheColorHint(0); setDivider(null); setItemsCanFocus(true); setFastScrollEnabled(false); setVerticalScrollBarEnabled(false); setOnScrollListener(this); setFadingEdgeLength(0); setFrictionIfSupported(ViewConfiguration.getScrollFriction() * mFriction); }
protected void setUpListView() { // Transparent background on scroll setCacheColorHint(0); // No dividers setDivider(null); // Items are clickable setItemsCanFocus(true); // The thumb gets in the way, so disable it setFastScrollEnabled(false); setVerticalScrollBarEnabled(false); setOnScrollListener(this); setFadingEdgeLength(0); // Make the scrolling behavior nicer setFriction(ViewConfiguration.getScrollFriction() * mFriction); }
/** * set the friction of scroller, it will effect the scroller's acceleration when fling * @param friction default is ViewConfiguration.get(mContext).getScrollFriction() * if setFriction(2 * ViewConfiguration.get(mContext).getScrollFriction()), * the friction will be twice as much as before */ public void setFriction(float friction){ if(friction <= 0) throw new IllegalArgumentException("you should set a a positive float friction, now friction is " + friction); mFriction = ViewConfiguration.get(getContext()).getScrollFriction() / friction; }
assertEquals(3000, ViewConfiguration.getZoomControlsTimeout()); assertEquals(500, ViewConfiguration.getGlobalActionKeyTimeout()); assertThat(ViewConfiguration.getScrollFriction()).isEqualTo(0.015f);
private void reset() { this.isOutside = false; this.mFrictionCoeff = 1; this.mBounceDuration = 0; this.mBounceDistance = 0; this.mOriginalDuration = 0; this.mOriginalDistance = 0; this.mFlingFriction = ViewConfiguration.getScrollFriction() * mFlingFrictionRatio; }
private void reset() { this.isOutside = false; this.mFrictionCoeff = 1; this.mBounceDuration = 0; this.mBounceDistance = 0; this.mOriginalDuration = 0; this.mOriginalDistance = 0; this.mFlingFriction = ViewConfiguration.getScrollFriction() * mFlingFrictionRatio; }
private void reset() { this.isOutside = false; this.mFrictionCoeff = 1; this.mBounceDuration = 0; this.mBounceDistance = 0; this.mOriginalDuration = 0; this.mOriginalDistance = 0; this.mFlingFriction = ViewConfiguration.getScrollFriction() * mFlingFrictionRatio; }
private double getSplineDeceleration(double velocity) { return Math.log(INFLEXION * Math.abs(velocity) / (ViewConfiguration.getScrollFriction() * deceleration)); }
public double getG(int velocityY) { return Math.log(0.35f * Math.abs(velocityY) / (ViewConfiguration.getScrollFriction() * SensorManager.GRAVITY_EARTH * 39.37f // inch/meter * (context.getResources().getDisplayMetrics().density * 160.0f) * 0.84f)); } ///-----------------------------------------------------------------//
private double getSplineFlingDistance(double velocity) { velocity = Math.abs(velocity); final double l = getSplineDeceleration(velocity); final double decelMinusOne = DECELERATION_RATE - 1.0; return ViewConfiguration.getScrollFriction() * deceleration * Math.exp(DECELERATION_RATE / decelMinusOne * l); }
public double getSplineFlingDistance(int velocityY) { final double l = getG(velocityY); final double decelMinusOne = (float) (Math.log(0.78) / Math.log(0.9)) - 1.0; return ViewConfiguration.getScrollFriction() * (SensorManager.GRAVITY_EARTH // g (m/s^2) * 39.37f // inch/meter * (context.getResources().getDisplayMetrics().density * 160.0f) * 0.84f) * Math.exp((float) (Math.log(0.78) / Math.log(0.9)) / decelMinusOne * l); }
/** * Create a Scroller with the specified interpolator. If the interpolator is * null, the default (viscous) interpolator will be used. Specify whether or * not to support progressive "flywheel" behavior in flinging. */ public LauncherScroller(Context context, Interpolator interpolator, boolean flywheel) { mFinished = true; mInterpolator = interpolator; mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning }
/** * Create a Scroller with the specified interpolator. If the interpolator is * null, the default (viscous) interpolator will be used. Specify whether or * not to support progressive "flywheel" behavior in flinging. */ public LauncherScroller(Context context, Interpolator interpolator, boolean flywheel) { mFinished = true; mInterpolator = interpolator; mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning }
/** * Create a Scroller with the specified interpolator. If the interpolator is * null, the default (viscous) interpolator will be used. Specify whether or * not to support progressive "flywheel" behavior in flinging. */ public LauncherScroller(Context context, Interpolator interpolator, boolean flywheel) { mFinished = true; mInterpolator = interpolator; mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning }
/** * Create a Scroller with the specified interpolator. If the interpolator is * null, the default (viscous) interpolator will be used. Specify whether or * not to support progressive "flywheel" behavior in flinging. */ private LauncherScroller(Context context, Interpolator interpolator, boolean flywheel) { mFinished = true; mInterpolator = interpolator; mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning }
/** * Create a Scroller with the specified interpolator. If the interpolator is * null, the default (viscous) interpolator will be used. Specify whether or * not to support progressive "flywheel" behavior in flinging. */ public LauncherScroller(Context context, Interpolator interpolator, boolean flywheel) { mFinished = true; mInterpolator = interpolator; mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning }
/** * Create a Scroller with the specified interpolator. If the interpolator is * null, the default (viscous) interpolator will be used. Specify whether or * not to support progressive "flywheel" behavior in flinging. */ public Scroller(Context context, Interpolator interpolator, boolean flywheel) { mFinished = true; if (interpolator == null) { mInterpolator = new ViscousFluidInterpolator(); } else { mInterpolator = interpolator; } mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning }
protected void setUpListView() { // Transparent background on scroll setCacheColorHint(0); // No dividers setDivider(null); // Items are clickable setItemsCanFocus(true); // The thumb gets in the way, so disable it setFastScrollEnabled(false); setVerticalScrollBarEnabled(false); setOnScrollListener(this); setFadingEdgeLength(0); // Make the scrolling behavior nicer setFriction(ViewConfiguration.getScrollFriction() * mFriction); }
protected void setUpListView() { // Transparent background on scroll setCacheColorHint(0); // No dividers setDivider(null); // Items are clickable setItemsCanFocus(true); // The thumb gets in the way, so disable it setFastScrollEnabled(false); setVerticalScrollBarEnabled(false); setOnScrollListener(this); setFadingEdgeLength(0); // Make the scrolling behavior nicer setFriction(ViewConfiguration.getScrollFriction() * mFriction); }