use of android.view.RenderNodeAnimator in project android_frameworks_base by crdroidandroid.
the class KeyguardAffordanceView method startRtCircleFadeOut.
private void startRtCircleFadeOut(long duration) {
RenderNodeAnimator animator = new RenderNodeAnimator(mHwCirclePaint, RenderNodeAnimator.PAINT_ALPHA, 0);
animator.setDuration(duration);
animator.setInterpolator(Interpolators.ALPHA_OUT);
animator.setTarget(this);
animator.start();
}
use of android.view.RenderNodeAnimator in project android_frameworks_base by crdroidandroid.
the class KeyButtonRipple method enterHardware.
private void enterHardware() {
cancelAnimations();
mDrawingHardwareGlow = true;
setExtendStart(CanvasProperty.createFloat(getExtendSize() / 2));
final RenderNodeAnimator startAnim = new RenderNodeAnimator(getExtendStart(), getExtendSize() / 2 - GLOW_MAX_SCALE_FACTOR * getRippleSize() / 2);
startAnim.setDuration(ANIMATION_DURATION_SCALE);
startAnim.setInterpolator(mInterpolator);
startAnim.addListener(mAnimatorListener);
startAnim.setTarget(mTargetView);
setExtendEnd(CanvasProperty.createFloat(getExtendSize() / 2));
final RenderNodeAnimator endAnim = new RenderNodeAnimator(getExtendEnd(), getExtendSize() / 2 + GLOW_MAX_SCALE_FACTOR * getRippleSize() / 2);
endAnim.setDuration(ANIMATION_DURATION_SCALE);
endAnim.setInterpolator(mInterpolator);
endAnim.addListener(mAnimatorListener);
endAnim.setTarget(mTargetView);
if (isHorizontal()) {
mTopProp = CanvasProperty.createFloat(0f);
mBottomProp = CanvasProperty.createFloat(getBounds().height());
mRxProp = CanvasProperty.createFloat(getBounds().height() / 2);
mRyProp = CanvasProperty.createFloat(getBounds().height() / 2);
} else {
mLeftProp = CanvasProperty.createFloat(0f);
mRightProp = CanvasProperty.createFloat(getBounds().width());
mRxProp = CanvasProperty.createFloat(getBounds().width() / 2);
mRyProp = CanvasProperty.createFloat(getBounds().width() / 2);
}
mGlowScale = GLOW_MAX_SCALE_FACTOR;
mGlowAlpha = GLOW_MAX_ALPHA;
mRipplePaint = getRipplePaint();
mRipplePaint.setAlpha((int) (mGlowAlpha * 255));
mPaintProp = CanvasProperty.createPaint(mRipplePaint);
startAnim.start();
endAnim.start();
mRunningAnimations.add(startAnim);
mRunningAnimations.add(endAnim);
invalidateSelf();
}
use of android.view.RenderNodeAnimator in project android_frameworks_base by crdroidandroid.
the class RippleBackground method createHardwareExit.
@Override
protected RenderNodeAnimatorSet createHardwareExit(Paint p) {
final RenderNodeAnimatorSet set = new RenderNodeAnimatorSet();
final int targetAlpha = p.getAlpha();
final int currentAlpha = (int) (mOpacity * targetAlpha + 0.5f);
p.setAlpha(currentAlpha);
mPropPaint = CanvasProperty.createPaint(p);
mPropRadius = CanvasProperty.createFloat(mTargetRadius);
mPropX = CanvasProperty.createFloat(0);
mPropY = CanvasProperty.createFloat(0);
final int fastEnterDuration = mIsBounded ? (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST) : 0;
// Linear exit after enter is completed.
final RenderNodeAnimator exit = new RenderNodeAnimator(mPropPaint, RenderNodeAnimator.PAINT_ALPHA, 0);
exit.setInterpolator(LINEAR_INTERPOLATOR);
exit.setDuration(OPACITY_EXIT_DURATION);
if (fastEnterDuration > 0) {
exit.setStartDelay(fastEnterDuration);
exit.setStartValue(targetAlpha);
}
set.add(exit);
// Linear "fast" enter based on current opacity.
if (fastEnterDuration > 0) {
final RenderNodeAnimator enter = new RenderNodeAnimator(mPropPaint, RenderNodeAnimator.PAINT_ALPHA, targetAlpha);
enter.setInterpolator(LINEAR_INTERPOLATOR);
enter.setDuration(fastEnterDuration);
set.add(enter);
}
return set;
}
use of android.view.RenderNodeAnimator in project android_frameworks_base by crdroidandroid.
the class AppearAnimationUtils method createAnimation.
@Override
public void createAnimation(final View view, long delay, long duration, float translationY, boolean appearing, Interpolator interpolator, final Runnable endRunnable) {
if (view != null) {
view.setAlpha(appearing ? 0f : 1.0f);
view.setTranslationY(appearing ? translationY : 0);
Animator alphaAnim;
float targetAlpha = appearing ? 1f : 0f;
if (view.isHardwareAccelerated()) {
RenderNodeAnimator alphaAnimRt = new RenderNodeAnimator(RenderNodeAnimator.ALPHA, targetAlpha);
alphaAnimRt.setTarget(view);
alphaAnim = alphaAnimRt;
} else {
alphaAnim = ObjectAnimator.ofFloat(view, View.ALPHA, view.getAlpha(), targetAlpha);
}
alphaAnim.setInterpolator(interpolator);
alphaAnim.setDuration(duration);
alphaAnim.setStartDelay(delay);
if (view.hasOverlappingRendering()) {
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
}
if (endRunnable != null) {
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
endRunnable.run();
}
});
}
alphaAnim.start();
startTranslationYAnimation(view, delay, duration, appearing ? 0 : translationY, interpolator);
}
}
use of android.view.RenderNodeAnimator in project android_frameworks_base by AOSPA.
the class AppearAnimationUtils method startTranslationYAnimation.
public static void startTranslationYAnimation(View view, long delay, long duration, float endTranslationY, Interpolator interpolator) {
Animator translationAnim;
if (view.isHardwareAccelerated()) {
RenderNodeAnimator translationAnimRt = new RenderNodeAnimator(RenderNodeAnimator.TRANSLATION_Y, endTranslationY);
translationAnimRt.setTarget(view);
translationAnim = translationAnimRt;
} else {
translationAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, view.getTranslationY(), endTranslationY);
}
translationAnim.setInterpolator(interpolator);
translationAnim.setDuration(duration);
translationAnim.setStartDelay(delay);
translationAnim.start();
}
Aggregations