Search in sources :

Example 6 with RectEvaluator

use of android.animation.RectEvaluator in project android_frameworks_base by DirtyUnicorns.

the class ChangeClipBounds method createAnimator.

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (startValues == null || endValues == null || !startValues.values.containsKey(PROPNAME_CLIP) || !endValues.values.containsKey(PROPNAME_CLIP)) {
        return null;
    }
    Rect start = (Rect) startValues.values.get(PROPNAME_CLIP);
    Rect end = (Rect) endValues.values.get(PROPNAME_CLIP);
    if (start == null && end == null) {
        // No animation required since there is no clip.
        return null;
    }
    if (start == null) {
        start = (Rect) startValues.values.get(PROPNAME_BOUNDS);
    } else if (end == null) {
        end = (Rect) endValues.values.get(PROPNAME_BOUNDS);
    }
    if (start.equals(end)) {
        return null;
    }
    endValues.view.setClipBounds(start);
    RectEvaluator evaluator = new RectEvaluator(new Rect());
    return ObjectAnimator.ofObject(endValues.view, "clipBounds", evaluator, start, end);
}
Also used : Rect(android.graphics.Rect) RectEvaluator(android.animation.RectEvaluator)

Aggregations

RectEvaluator (android.animation.RectEvaluator)6 Rect (android.graphics.Rect)6 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 AnimatorSet (android.animation.AnimatorSet)1 ObjectAnimator (android.animation.ObjectAnimator)1 ValueAnimator (android.animation.ValueAnimator)1 Bitmap (android.graphics.Bitmap)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 SurfaceView (android.view.SurfaceView)1 TextureView (android.view.TextureView)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ViewOverlay (android.view.ViewOverlay)1 Nullable (androidx.annotation.Nullable)1