use of android.animation.ValueAnimator in project android_frameworks_base by ResurrectionRemix.
the class KeyguardAffordanceView method getAnimatorToRadius.
private ValueAnimator getAnimatorToRadius(float circleRadius) {
ValueAnimator animator = ValueAnimator.ofFloat(mCircleRadius, circleRadius);
mCircleAnimator = animator;
mCircleStartValue = mCircleRadius;
mCircleWillBeHidden = circleRadius == 0.0f;
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mCircleRadius = (float) animation.getAnimatedValue();
updateIconColor();
invalidate();
}
});
animator.addListener(mCircleEndListener);
return animator;
}
use of android.animation.ValueAnimator in project android_frameworks_base by ResurrectionRemix.
the class DragDownHelper method cancelExpansion.
private void cancelExpansion() {
ValueAnimator anim = ValueAnimator.ofFloat(mLastHeight, 0);
anim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
anim.setDuration(SPRING_BACK_ANIMATION_LENGTH_MS);
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mDragDownCallback.setEmptyDragAmount((Float) animation.getAnimatedValue());
}
});
anim.start();
}
use of android.animation.ValueAnimator in project UltimateAndroid by cymcsg.
the class DefaultLayoutAnimator method transitionToFrame.
// @Override
public ValueAnimator transitionToFrame(final Rect of, final FreeFlowItem nf, final View v) {
ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
anim.setDuration(cellPositionTransitionAnimationDuration);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
try {
int itemWidth = of.width() + (int) ((nf.frame.width() - of.width()) * animation.getAnimatedFraction());
int itemHeight = of.height() + (int) ((nf.frame.height() - of.height()) * animation.getAnimatedFraction());
int widthSpec = MeasureSpec.makeMeasureSpec(itemWidth, MeasureSpec.EXACTLY);
int heightSpec = MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY);
v.measure(widthSpec, heightSpec);
Rect frame = new Rect();
Rect nff = nf.frame;
frame.left = (int) (of.left + (nff.left - of.left) * animation.getAnimatedFraction());
frame.top = (int) (of.top + (nff.top - of.top) * animation.getAnimatedFraction());
frame.right = frame.left + (int) (of.width() + (nff.width() - of.width()) * animation.getAnimatedFraction());
frame.bottom = frame.top + (int) (of.height() + (nff.height() - of.height()) * animation.getAnimatedFraction());
v.layout(frame.left, frame.top, frame.right, frame.bottom);
// v.layout(nf.frame.left, nf.frame.top, nf.frame.right,
// nf.frame.bottom);
// v.setAlpha((1 - alpha) * animation.getAnimatedFraction()
// + alpha);
} catch (NullPointerException e) {
Logs.e(TAG, "Nullpointer exception");
e.printStackTrace();
animation.cancel();
}
}
});
anim.setInterpolator(new DecelerateInterpolator(2.0f));
return anim;
}
use of android.animation.ValueAnimator in project android_packages_apps_Launcher2 by CyanogenMod.
the class DragLayer method fadeOutDragView.
private void fadeOutDragView() {
mFadeOutAnim = new ValueAnimator();
mFadeOutAnim.setDuration(150);
mFadeOutAnim.setFloatValues(0f, 1f);
mFadeOutAnim.removeAllUpdateListeners();
mFadeOutAnim.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
final float percent = (Float) animation.getAnimatedValue();
float alpha = 1 - percent;
mDropView.setAlpha(alpha);
}
});
mFadeOutAnim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animation) {
if (mDropView != null) {
mDragController.onDeferredEndDrag(mDropView);
}
mDropView = null;
invalidate();
}
});
mFadeOutAnim.start();
}
use of android.animation.ValueAnimator in project android_packages_apps_Launcher2 by CyanogenMod.
the class DragView method crossFade.
public void crossFade(int duration) {
ValueAnimator va = LauncherAnimUtils.ofFloat(0f, 1f);
va.setDuration(duration);
va.setInterpolator(new DecelerateInterpolator(1.5f));
va.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mCrossFadeProgress = animation.getAnimatedFraction();
}
});
va.start();
}
Aggregations