use of android.view.RenderNodeAnimator in project platform_frameworks_base by android.
the class KeyButtonRipple method exitHardware.
private void exitHardware() {
mPaintProp = CanvasProperty.createPaint(getRipplePaint());
final RenderNodeAnimator opacityAnim = new RenderNodeAnimator(mPaintProp, RenderNodeAnimator.PAINT_ALPHA, 0);
opacityAnim.setDuration(ANIMATION_DURATION_FADE);
opacityAnim.setInterpolator(Interpolators.ALPHA_OUT);
opacityAnim.addListener(mAnimatorListener);
opacityAnim.setTarget(mTargetView);
opacityAnim.start();
mRunningAnimations.add(opacityAnim);
invalidateSelf();
}
use of android.view.RenderNodeAnimator in project platform_frameworks_base by android.
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 platform_frameworks_base by android.
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();
}
use of android.view.RenderNodeAnimator in project platform_frameworks_base by android.
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 platform_frameworks_base by android.
the class KeyguardAffordanceView method startRtAlphaFadeIn.
/**
* Fades in the Circle on the RenderThread. It's used when finishing the circle when it had
* alpha 0 in the beginning.
*/
private void startRtAlphaFadeIn() {
if (mCircleRadius == 0 && mPreviewView == null) {
Paint modifiedPaint = new Paint(mCirclePaint);
modifiedPaint.setColor(mCircleColor);
modifiedPaint.setAlpha(0);
mHwCirclePaint = CanvasProperty.createPaint(modifiedPaint);
RenderNodeAnimator animator = new RenderNodeAnimator(mHwCirclePaint, RenderNodeAnimator.PAINT_ALPHA, 255);
animator.setTarget(this);
animator.setInterpolator(Interpolators.ALPHA_IN);
animator.setDuration(250);
animator.start();
}
}
Aggregations