Search in sources :

Example 1 with RenderNodeAnimator

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();
}
Also used : RenderNodeAnimator(android.view.RenderNodeAnimator)

Example 2 with RenderNodeAnimator

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);
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) RenderNodeAnimator(android.view.RenderNodeAnimator) Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ValueAnimator(android.animation.ValueAnimator) RenderNodeAnimator(android.view.RenderNodeAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 3 with RenderNodeAnimator

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();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) RenderNodeAnimator(android.view.RenderNodeAnimator) Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ValueAnimator(android.animation.ValueAnimator) RenderNodeAnimator(android.view.RenderNodeAnimator)

Example 4 with RenderNodeAnimator

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();
}
Also used : RenderNodeAnimator(android.view.RenderNodeAnimator)

Example 5 with RenderNodeAnimator

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();
    }
}
Also used : RenderNodeAnimator(android.view.RenderNodeAnimator) Paint(android.graphics.Paint)

Aggregations

RenderNodeAnimator (android.view.RenderNodeAnimator)67 Paint (android.graphics.Paint)15 Animator (android.animation.Animator)10 ObjectAnimator (android.animation.ObjectAnimator)10 ValueAnimator (android.animation.ValueAnimator)10 ViewPropertyAnimator (android.view.ViewPropertyAnimator)10 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 View (android.view.View)4 AdapterView (android.widget.AdapterView)4 ListView (android.widget.ListView)4