FileDocCategorySizeDatePackage
ChangeScroll.javaAPI DocAndroid 5.1 API2991Thu Mar 12 22:22:10 GMT 2015android.transition

ChangeScroll

public class ChangeScroll extends android.transition.Transition
This transition captures the scroll properties of targets before and after the scene change and animates any changes.
hide

Fields Summary
private static final String
PROPNAME_SCROLL_X
private static final String
PROPNAME_SCROLL_Y
Constructors Summary
public ChangeScroll()


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

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

        captureValues(transitionValues);
    
public voidcaptureStartValues(android.transition.TransitionValues transitionValues)

        captureValues(transitionValues);
    
private voidcaptureValues(android.transition.TransitionValues transitionValues)

        transitionValues.values.put(PROPNAME_SCROLL_X, transitionValues.view.getScrollX());
        transitionValues.values.put(PROPNAME_SCROLL_Y, transitionValues.view.getScrollY());
    
public android.animation.AnimatorcreateAnimator(android.view.ViewGroup sceneRoot, android.transition.TransitionValues startValues, android.transition.TransitionValues endValues)

        if (startValues == null || endValues == null) {
            return null;
        }
        final View view = endValues.view;
        int startX = (Integer) startValues.values.get(PROPNAME_SCROLL_X);
        int endX = (Integer) endValues.values.get(PROPNAME_SCROLL_X);
        int startY = (Integer) startValues.values.get(PROPNAME_SCROLL_Y);
        int endY = (Integer) endValues.values.get(PROPNAME_SCROLL_Y);
        Animator scrollXAnimator = null;
        Animator scrollYAnimator = null;
        if (startX != endX) {
            view.setScrollX(startX);
            scrollXAnimator = ObjectAnimator.ofInt(view, "scrollX", startX, endX);
        }
        if (startY != endY) {
            view.setScrollY(startY);
            scrollYAnimator = ObjectAnimator.ofInt(view, "scrollY", startY, endY);
        }
        return TransitionUtils.mergeAnimators(scrollXAnimator, scrollYAnimator);