FileDocCategorySizeDatePackage
ChangeClipBounds.javaAPI DocAndroid 5.1 API3513Thu Mar 12 22:22:10 GMT 2015android.transition

ChangeClipBounds

public class ChangeClipBounds extends Transition
ChangeClipBounds captures the {@link android.view.View#getClipBounds()} before and after the scene change and animates those changes during the transition.

Fields Summary
private static final String
TAG
private static final String
PROPNAME_CLIP
private static final String
PROPNAME_BOUNDS
private static final String[]
sTransitionProperties
Constructors Summary
public ChangeClipBounds()


      
public ChangeClipBounds(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
Methods Summary
public voidcaptureEndValues(TransitionValues transitionValues)

        captureValues(transitionValues);
    
public voidcaptureStartValues(TransitionValues transitionValues)

        captureValues(transitionValues);
    
private voidcaptureValues(TransitionValues values)

        View view = values.view;
        if (view.getVisibility() == View.GONE) {
            return;
        }

        Rect clip = view.getClipBounds();
        values.values.put(PROPNAME_CLIP, clip);
        if (clip == null) {
            Rect bounds = new Rect(0, 0, view.getWidth(), view.getHeight());
            values.values.put(PROPNAME_BOUNDS, bounds);
        }
    
public android.animation.AnimatorcreateAnimator(android.view.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) {
            return null; // No animation required since there is no clip.
        }

        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);
    
public java.lang.String[]getTransitionProperties()

        return sTransitionProperties;