FileDocCategorySizeDatePackage
SlideKitkat.javaAPI DocAndroid 5.1 API11240Thu Mar 12 22:22:56 GMT 2015android.support.v17.leanback.transition

SlideKitkat

public class SlideKitkat extends android.transition.Visibility
Slide distance toward/from a edge. This is a limited Slide implementation for KitKat without propagation support.
hide

Fields Summary
private static final String
TAG
private static final android.animation.TimeInterpolator
sDecelerate
private static final android.animation.TimeInterpolator
sAccelerate
private int
mSlideEdge
private CalculateSlide
mSlideCalculator
private static final CalculateSlide
sCalculateLeft
private static final CalculateSlide
sCalculateTop
private static final CalculateSlide
sCalculateRight
private static final CalculateSlide
sCalculateBottom
private static final CalculateSlide
sCalculateStart
private static final CalculateSlide
sCalculateEnd
Constructors Summary
public SlideKitkat()


      
        setSlideEdge(Gravity.BOTTOM);
    
public SlideKitkat(android.content.Context context, android.util.AttributeSet attrs)

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.lbSlide);
        int edge = a.getInt(R.styleable.lbSlide_lb_slideEdge, Gravity.BOTTOM);
        setSlideEdge(edge);
        long duration = a.getInt(R.styleable.lbSlide_android_duration, -1);
        if (duration >= 0) {
            setDuration(duration);
        }
        long startDelay = a.getInt(R.styleable.lbSlide_android_startDelay, -1);
        if (startDelay > 0) {
            setStartDelay(startDelay);
        }
        final int resID = a.getResourceId(R.styleable.lbSlide_android_interpolator, 0);
        if (resID > 0) {
            setInterpolator(AnimationUtils.loadInterpolator(context, resID));
        }
        a.recycle();
    
Methods Summary
private android.animation.AnimatorcreateAnimation(android.view.View view, android.util.Property property, float start, float end, float terminalValue, android.animation.TimeInterpolator interpolator, int finalVisibility)

        float[] startPosition = (float[]) view.getTag(R.id.lb_slide_transition_value);
        if (startPosition != null) {
            start = View.TRANSLATION_Y == property ? startPosition[1] : startPosition[0];
            view.setTag(R.id.lb_slide_transition_value, null);
        }
        final ObjectAnimator anim = ObjectAnimator.ofFloat(view, property, start, end);

        SlideAnimatorListener listener = new SlideAnimatorListener(view, property, terminalValue, end,
                finalVisibility);
        anim.addListener(listener);
        anim.addPauseListener(listener);
        anim.setInterpolator(interpolator);
        return anim;
    
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}.

        return mSlideEdge;
    
public android.animation.AnimatoronAppear(android.view.ViewGroup sceneRoot, android.transition.TransitionValues startValues, int startVisibility, android.transition.TransitionValues endValues, int endVisibility)

        View view = (endValues != null) ? endValues.view : null;
        if (view == null) {
            return null;
        }
        float end = mSlideCalculator.getHere(view);
        float start = mSlideCalculator.getGone(view);
        return createAnimation(view, mSlideCalculator.getProperty(), start, end, end, sDecelerate,
                View.VISIBLE);
    
public android.animation.AnimatoronDisappear(android.view.ViewGroup sceneRoot, android.transition.TransitionValues startValues, int startVisibility, android.transition.TransitionValues endValues, int endVisibility)

        View view = (startValues != null) ? startValues.view : null;
        if (view == null) {
            return null;
        }
        float start = mSlideCalculator.getHere(view);
        float end = mSlideCalculator.getGone(view);

        return createAnimation(view, mSlideCalculator.getProperty(), start, end, start,
                sAccelerate, View.INVISIBLE);
    
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}.

        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;