FileDocCategorySizeDatePackage
Slide.javaAPI DocAndroid 5.1 API9627Thu Mar 12 22:22:10 GMT 2015android.transition

Slide

public class Slide extends Visibility
This transition tracks changes to the visibility of target views in the start and end scenes and moves views in or out from one of the edges of the scene. Visibility is determined by both the {@link View#setVisibility(int)} state of the view as well as whether it is parented in the current view hierarchy. Disappearing Views are limited as described in {@link Visibility#onDisappear(android.view.ViewGroup, TransitionValues, int, TransitionValues, int)}.

Fields Summary
private static final String
TAG
private static final android.animation.TimeInterpolator
sDecelerate
private static final android.animation.TimeInterpolator
sAccelerate
private static final String
PROPNAME_SCREEN_POSITION
private CalculateSlide
mSlideCalculator
private int
mSlideEdge
private static final CalculateSlide
sCalculateLeft
private static final CalculateSlide
sCalculateStart
private static final CalculateSlide
sCalculateTop
private static final CalculateSlide
sCalculateRight
private static final CalculateSlide
sCalculateEnd
private static final CalculateSlide
sCalculateBottom
Constructors Summary
public Slide()
Constructor using the default {@link Gravity#BOTTOM} slide edge direction.


                  
      
        setSlideEdge(Gravity.BOTTOM);
    
public Slide(int slideEdge)
Constructor using the provided slide edge direction.

        setSlideEdge(slideEdge);
    
public Slide(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Slide);
        int edge = a.getInt(R.styleable.Slide_slideEdge, Gravity.BOTTOM);
        a.recycle();
        setSlideEdge(edge);
    
Methods Summary
public voidcaptureEndValues(TransitionValues transitionValues)

        super.captureEndValues(transitionValues);
        captureValues(transitionValues);
    
public voidcaptureStartValues(TransitionValues transitionValues)

        super.captureStartValues(transitionValues);
        captureValues(transitionValues);
    
private voidcaptureValues(TransitionValues transitionValues)

        View view = transitionValues.view;
        int[] position = new int[2];
        view.getLocationOnScreen(position);
        transitionValues.values.put(PROPNAME_SCREEN_POSITION, position);
    
public intgetSlideEdge()
Returns the edge that Views appear and disappear from.

return
the edge of the scene to use for Views appearing and disappearing. One of {@link android.view.Gravity#LEFT}, {@link android.view.Gravity#TOP}, {@link android.view.Gravity#RIGHT}, {@link android.view.Gravity#BOTTOM}, {@link android.view.Gravity#START}, {@link android.view.Gravity#END}.
attr
ref android.R.styleable#Slide_slideEdge

        return mSlideEdge;
    
public android.animation.AnimatoronAppear(android.view.ViewGroup sceneRoot, android.view.View view, TransitionValues startValues, TransitionValues endValues)

        if (endValues == null) {
            return null;
        }
        int[] position = (int[]) endValues.values.get(PROPNAME_SCREEN_POSITION);
        float endX = view.getTranslationX();
        float endY = view.getTranslationY();
        float startX = mSlideCalculator.getGoneX(sceneRoot, view);
        float startY = mSlideCalculator.getGoneY(sceneRoot, view);
        return TranslationAnimationCreator
                .createAnimation(view, endValues, position[0], position[1],
                        startX, startY, endX, endY, sDecelerate);
    
public android.animation.AnimatoronDisappear(android.view.ViewGroup sceneRoot, android.view.View view, TransitionValues startValues, TransitionValues endValues)

        if (startValues == null) {
            return null;
        }
        int[] position = (int[]) startValues.values.get(PROPNAME_SCREEN_POSITION);
        float startX = view.getTranslationX();
        float startY = view.getTranslationY();
        float endX = mSlideCalculator.getGoneX(sceneRoot, view);
        float endY = mSlideCalculator.getGoneY(sceneRoot, view);
        return TranslationAnimationCreator
                .createAnimation(view, startValues, position[0], position[1],
                        startX, startY, endX, endY, sAccelerate);
    
public voidsetSlideEdge(int slideEdge)
Change the edge that Views appear and disappear from.

param
slideEdge The edge of the scene to use for Views appearing and disappearing. One of {@link android.view.Gravity#LEFT}, {@link android.view.Gravity#TOP}, {@link android.view.Gravity#RIGHT}, {@link android.view.Gravity#BOTTOM}, {@link android.view.Gravity#START}, {@link android.view.Gravity#END}.
attr
ref android.R.styleable#Slide_slideEdge

        switch (slideEdge) {
            case Gravity.LEFT:
                mSlideCalculator = sCalculateLeft;
                break;
            case Gravity.TOP:
                mSlideCalculator = sCalculateTop;
                break;
            case Gravity.RIGHT:
                mSlideCalculator = sCalculateRight;
                break;
            case Gravity.BOTTOM:
                mSlideCalculator = sCalculateBottom;
                break;
            case Gravity.START:
                mSlideCalculator = sCalculateStart;
                break;
            case Gravity.END:
                mSlideCalculator = sCalculateEnd;
                break;
            default:
                throw new IllegalArgumentException("Invalid slide direction");
        }
        mSlideEdge = slideEdge;
        SidePropagation propagation = new SidePropagation();
        propagation.setSide(slideEdge);
        setPropagation(propagation);