FileDocCategorySizeDatePackage
QSDetailClipper.javaAPI DocAndroid 5.1 API3413Thu Mar 12 22:22:42 GMT 2015com.android.systemui.qs

QSDetailClipper

public class QSDetailClipper extends Object
Helper for quick settings detail panel clip animations.

Fields Summary
private final android.view.View
mDetail
private final android.graphics.drawable.TransitionDrawable
mBackground
private android.animation.Animator
mAnimator
private final Runnable
mReverseBackground
private final android.animation.AnimatorListenerAdapter
mVisibleOnStart
private final android.animation.AnimatorListenerAdapter
mGoneOnEnd
Constructors Summary
public QSDetailClipper(android.view.View detail)

        mDetail = detail;
        mBackground = (TransitionDrawable) detail.getBackground();
    
Methods Summary
public voidanimateCircularClip(int x, int y, boolean in, android.animation.Animator.AnimatorListener listener)

        if (mAnimator != null) {
            mAnimator.cancel();
        }
        final int w = mDetail.getWidth() - x;
        final int h = mDetail.getHeight() - y;
        int r = (int) Math.ceil(Math.sqrt(x * x + y * y));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + y * y)));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + h * h)));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(x * x + h * h)));
        if (in) {
            mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, 0, r);
        } else {
            mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, r, 0);
        }
        mAnimator.setDuration((long)(mAnimator.getDuration() * 1.5));
        if (listener != null) {
            mAnimator.addListener(listener);
        }
        if (in) {
            mBackground.startTransition((int)(mAnimator.getDuration() * 0.6));
            mAnimator.addListener(mVisibleOnStart);
        } else {
            mDetail.postDelayed(mReverseBackground, (long)(mAnimator.getDuration() * 0.65));
            mAnimator.addListener(mGoneOnEnd);
        }
        mAnimator.start();