Search in sources :

Example 36 with RenderNodeAnimator

use of android.view.RenderNodeAnimator in project android_frameworks_base by AOSPA.

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 37 with RenderNodeAnimator

use of android.view.RenderNodeAnimator in project android_frameworks_base by AOSPA.

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 38 with RenderNodeAnimator

use of android.view.RenderNodeAnimator in project android_frameworks_base by crdroidandroid.

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 39 with RenderNodeAnimator

use of android.view.RenderNodeAnimator in project android_frameworks_base by crdroidandroid.

the class KeyguardAffordanceView method getRtAnimatorToRadius.

private Animator getRtAnimatorToRadius(float circleRadius) {
    RenderNodeAnimator animator = new RenderNodeAnimator(mHwCircleRadius, circleRadius);
    animator.setTarget(this);
    return animator;
}
Also used : RenderNodeAnimator(android.view.RenderNodeAnimator)

Example 40 with RenderNodeAnimator

use of android.view.RenderNodeAnimator in project android_frameworks_base by ResurrectionRemix.

the class LockPatternView method startRtAlphaAnimation.

private void startRtAlphaAnimation(CellState cellState, float endAlpha, long delay, long duration, Interpolator interpolator, Animator.AnimatorListener listener) {
    RenderNodeAnimator animator = new RenderNodeAnimator(cellState.hwPaint, RenderNodeAnimator.PAINT_ALPHA, (int) (endAlpha * 255));
    animator.setDuration(duration);
    animator.setStartDelay(delay);
    animator.setInterpolator(interpolator);
    animator.setTarget(this);
    animator.addListener(listener);
    animator.start();
}
Also used : RenderNodeAnimator(android.view.RenderNodeAnimator)

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