Search in sources :

Example 46 with RenderNodeAnimator

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

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

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

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

Example 48 with RenderNodeAnimator

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

the class MainActivity method onItemClick.

@Override
public void onItemClick(final AdapterView<?> adapterView, View clickedView, int clickedPosition, long clickedId) {
    int topPosition = adapterView.getFirstVisiblePosition();
    int dy = adapterView.getHeight();
    for (int i = 0; i < adapterView.getChildCount(); i++) {
        int pos = topPosition + i;
        View child = adapterView.getChildAt(i);
        float delta = (pos - clickedPosition) * 1.1f;
        if (delta == 0)
            delta = -1;
        RenderNodeAnimator animator = new RenderNodeAnimator(RenderNodeAnimator.TRANSLATION_Y, dy * delta);
        animator.setDuration(DURATION);
        if (child == clickedView)
            logTranslationY(clickedView);
        animator.setTarget(child);
        animator.start();
        if (child == clickedView)
            logTranslationY(clickedView);
    }
    //mHandler.postDelayed(mLaunchActivity, (long) (DURATION * .4));
    mLaunchActivity.run();
}
Also used : RenderNodeAnimator(android.view.RenderNodeAnimator) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 49 with RenderNodeAnimator

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

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

Example 50 with RenderNodeAnimator

use of android.view.RenderNodeAnimator in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartButtonRipple 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(mAlphaExitInterpolator);
    opacityAnim.addListener(mAnimatorListener);
    opacityAnim.setTarget(mTargetView);
    opacityAnim.start();
    mRunningAnimations.add(opacityAnim);
    invalidateSelf();
}
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