Slidepublic 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 void | captureEndValues(TransitionValues transitionValues)
super.captureEndValues(transitionValues);
captureValues(transitionValues);
| public void | captureStartValues(TransitionValues transitionValues)
super.captureStartValues(transitionValues);
captureValues(transitionValues);
| private void | captureValues(TransitionValues transitionValues)
View view = transitionValues.view;
int[] position = new int[2];
view.getLocationOnScreen(position);
transitionValues.values.put(PROPNAME_SCREEN_POSITION, position);
| public int | getSlideEdge()Returns the edge that Views appear and disappear from.
return mSlideEdge;
| public android.animation.Animator | onAppear(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.Animator | onDisappear(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 void | setSlideEdge(int slideEdge)Change the edge that Views appear and disappear from.
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);
|
|