/** * updates the view rotation depending on the given touch position, also * takes the starting angle into consideration * * @param x * @param y */ public void updateGestureRotation(float x, float y) { mChart.setRotationAngle(mChart.getAngleForPoint(x, y) - mStartAngle); }
/** * Applys a spin animation to the Chart. * * @param durationmillis * @param fromangle * @param toangle */ @SuppressLint("NewApi") public void spin(int durationmillis, float fromangle, float toangle, EasingFunction easing) { setRotationAngle(fromangle); ObjectAnimator spinAnimator = ObjectAnimator.ofFloat(this, "rotationAngle", fromangle, toangle); spinAnimator.setDuration(durationmillis); spinAnimator.setInterpolator(easing); spinAnimator.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { postInvalidate(); } }); spinAnimator.start(); } }
public void computeScroll() { if (mDecelerationAngularVelocity == 0.f) return; // There's no deceleration in progress final long currentTime = AnimationUtils.currentAnimationTimeMillis(); mDecelerationAngularVelocity *= mChart.getDragDecelerationFrictionCoef(); final float timeInterval = (float) (currentTime - mDecelerationLastTime) / 1000.f; mChart.setRotationAngle(mChart.getRotationAngle() + mDecelerationAngularVelocity * timeInterval); mDecelerationLastTime = currentTime; if (Math.abs(mDecelerationAngularVelocity) >= 0.001) Utils.postInvalidateOnAnimation(mChart); // This causes computeScroll to fire, recommended for this by Google else stopDeceleration(); }
/** * updates the view rotation depending on the given touch position, also * takes the starting angle into consideration * * @param x * @param y */ public void updateGestureRotation(float x, float y) { mChart.setRotationAngle(mChart.getAngleForPoint(x, y) - mStartAngle); }
/** * updates the view rotation depending on the given touch position, also * takes the starting angle into consideration * * @param x * @param y */ public void updateGestureRotation(float x, float y) { mChart.setRotationAngle(mChart.getAngleForPoint(x, y) - mStartAngle); }
/** * updates the view rotation depending on the given touch position, also * takes the starting angle into consideration * * @param x * @param y */ public void updateGestureRotation(float x, float y) { mChart.setRotationAngle(mChart.getAngleForPoint(x, y) - mStartAngle); }
/** * updates the view rotation depending on the given touch position, also * takes the starting angle into consideration * * @param x * @param y */ public void updateGestureRotation(float x, float y) { mChart.setRotationAngle(mChart.getAngleForPoint(x, y) - mStartAngle); }
/** * Applys a spin animation to the Chart. * * @param durationmillis * @param fromangle * @param toangle */ @SuppressLint("NewApi") public void spin(int durationmillis, float fromangle, float toangle, EasingFunction easing) { if (android.os.Build.VERSION.SDK_INT < 11) return; setRotationAngle(fromangle); ObjectAnimator spinAnimator = ObjectAnimator.ofFloat(this, "rotationAngle", fromangle, toangle); spinAnimator.setDuration(durationmillis); spinAnimator.setInterpolator(easing); spinAnimator.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { postInvalidate(); } }); spinAnimator.start(); } }
/** * Applys a spin animation to the Chart. * * @param durationmillis * @param fromangle * @param toangle */ @SuppressLint("NewApi") public void spin(int durationmillis, float fromangle, float toangle, Easing.EasingOption easing) { if (android.os.Build.VERSION.SDK_INT < 11) return; setRotationAngle(fromangle); ObjectAnimator spinAnimator = ObjectAnimator.ofFloat(this, "rotationAngle", fromangle, toangle); spinAnimator.setDuration(durationmillis); spinAnimator.setInterpolator(Easing.getEasingFunctionFromOption(easing)); spinAnimator.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { postInvalidate(); } }); spinAnimator.start(); } }
/** * Applys a spin animation to the Chart. * * @param durationmillis * @param fromangle * @param toangle */ @SuppressLint("NewApi") public void spin(int durationmillis, float fromangle, float toangle, Easing.EasingOption easing) { if (android.os.Build.VERSION.SDK_INT < 11) return; setRotationAngle(fromangle); ObjectAnimator spinAnimator = ObjectAnimator.ofFloat(this, "rotationAngle", fromangle, toangle); spinAnimator.setDuration(durationmillis); spinAnimator.setInterpolator(Easing.getEasingFunctionFromOption(easing)); spinAnimator.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { postInvalidate(); } }); spinAnimator.start(); } }
public void computeScroll() { if (mDecelerationAngularVelocity == 0.f) return; // There's no deceleration in progress final long currentTime = AnimationUtils.currentAnimationTimeMillis(); mDecelerationAngularVelocity *= mChart.getDragDecelerationFrictionCoef(); final float timeInterval = (float) (currentTime - mDecelerationLastTime) / 1000.f; mChart.setRotationAngle(mChart.getRotationAngle() + mDecelerationAngularVelocity * timeInterval); mDecelerationLastTime = currentTime; if (Math.abs(mDecelerationAngularVelocity) >= 0.001) Utils.postInvalidateOnAnimation(mChart); // This causes computeScroll to fire, recommended for this by Google else stopDeceleration(); }
public void computeScroll() { if (mDecelerationAngularVelocity == 0.f) return; // There's no deceleration in progress final long currentTime = AnimationUtils.currentAnimationTimeMillis(); mDecelerationAngularVelocity *= mChart.getDragDecelerationFrictionCoef(); final float timeInterval = (float) (currentTime - mDecelerationLastTime) / 1000.f; mChart.setRotationAngle(mChart.getRotationAngle() + mDecelerationAngularVelocity * timeInterval); mDecelerationLastTime = currentTime; if (Math.abs(mDecelerationAngularVelocity) >= 0.001) Utils.postInvalidateOnAnimation(mChart); // This causes computeScroll to fire, recommended for this by Google else stopDeceleration(); }
public void computeScroll() { if (mDecelerationAngularVelocity == 0.f) return; // There's no deceleration in progress final long currentTime = AnimationUtils.currentAnimationTimeMillis(); mDecelerationAngularVelocity *= mChart.getDragDecelerationFrictionCoef(); final float timeInterval = (float) (currentTime - mDecelerationLastTime) / 1000.f; mChart.setRotationAngle(mChart.getRotationAngle() + mDecelerationAngularVelocity * timeInterval); mDecelerationLastTime = currentTime; if (Math.abs(mDecelerationAngularVelocity) >= 0.001) Utils.postInvalidateOnAnimation(mChart); // This causes computeScroll to fire, recommended for this by Google else stopDeceleration(); }
public void computeScroll() { if (mDecelerationAngularVelocity == 0.f) { return; // There's no deceleration in progress } final long currentTime = AnimationUtils.currentAnimationTimeMillis(); mDecelerationAngularVelocity *= mChart.getDragDecelerationFrictionCoef(); final float timeInterval = (float) (currentTime - mDecelerationLastTime) / 1000.f; mChart.setRotationAngle(mChart.getRotationAngle() + mDecelerationAngularVelocity * timeInterval); mDecelerationLastTime = currentTime; if (Math.abs(mDecelerationAngularVelocity) >= 0.001) { Utils.postInvalidateOnAnimation(mChart); // This causes computeScroll to fire, recommended for this by Google } else { stopDeceleration(); } }