Translate extends Visibility { @SuppressWarnings("UnnecessaryLocalVariable") @Nullable public static Animator createAnimator( @NonNull final Transition transition, @NonNull final View view, @NonNull final TransitionValues transitionValues, final int viewX, final int viewY, final float startX, final float startY, final float endX, final float endY ) { if (!TransitionUtils.isViewAttachedToWindow(view)) { return null; } float animationStartX = startX; float animationStartY = startY; final float animationEndX = endX; final float animationEndY = endY; final float viewEndX = view.getTranslationX(); final float viewEndY = view.getTranslationY(); final int[] startPosition = (int[]) transitionValues.view.getTag(R.id.ui_transition_tag_position); if (startPosition != null) { animationStartX = startPosition[0] - viewX + viewEndX; animationStartY = startPosition[1] - viewY + viewEndY; } if (animationStartX == animationEndX && animationStartY == animationEndY) { return null; } view.setTranslationX(animationStartX); view.setTranslationY(animationStartY); final int viewStartX = viewX + Math.round(startX - viewEndX); final int viewStartY = viewY + Math.round(startY - viewEndY); final Path path = new Path(); path.moveTo(animationStartX, animationStartY); path.lineTo(animationEndX, animationEndY); final ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.TRANSLATION_X, View.TRANSLATION_Y, path); final TransitionAnimatorListener listener = new TransitionAnimatorListener( view, transitionValues.view, viewStartX, viewStartY, viewEndX, viewEndY ); transition.addListener(listener); animator.addListener(listener); animator.addPauseListener(listener); animator.setInterpolator(INTERPOLATOR); return animator; } Translate();  Translate(@TranslateMode final int mode);  Translate(@NonNull final Context context, @Nullable final AttributeSet attrs); @SuppressWarnings("UnnecessaryLocalVariable") @Nullable static Animator createAnimator(
			@NonNull final Transition transition,
			@NonNull final View view,
			@NonNull final TransitionValues transitionValues,
			final int viewX,
			final int viewY,
			final float startX,
			final float startY,
			final float endX,
			final float endY
	); void setTranslationXDelta(final float xDelta); float getTranslationXDelta(); void setTranslationYDelta(final float yDelta); float getTranslationYDelta(); void setTranslationXRelativity(@Description.ValueRelativity final int xRelativity); @Description.ValueRelativity int getTranslationXRelativity(); void setTranslationYRelativity(@Description.ValueRelativity final int yRelativity); @Description.ValueRelativity int getTranslationYRelativity(); @Override void captureStartValues(@NonNull final TransitionValues transitionValues); @Override void captureEndValues(@NonNull final TransitionValues transitionValues); @Override @Nullable Animator onAppear(
			@NonNull final ViewGroup sceneRoot,
			@NonNull final View view,
			@Nullable final TransitionValues startValues,
			@Nullable final TransitionValues endValues
	); @Override @Nullable Animator onDisappear(
			@NonNull final ViewGroup sceneRoot,
			@NonNull final View view,
			@Nullable final TransitionValues startValues,
			@Nullable final TransitionValues endValues
	); static final TimeInterpolator INTERPOLATOR; static final DeltaResolver DELTA_RESOLVER; }
@Test public void testCreateAnimator() { final Translate translate = new Translate(); final View view = createViewAttachedToWindow(); final TransitionValues values = new TransitionValues(); values.view = view; assertThatAnimatorForViewIsValid(Translate.createAnimator( translate, view, values, 0, 0, 0f, 0f, 100f, 100f ), view); }
@Test public void testCreateAnimatorWithKnownLocationOnScreen() { final Translate translate = new Translate(); final View view = createViewAttachedToWindow(); view.setTag(R.id.ui_transition_tag_position, new int[]{50, 50}); final TransitionValues values = new TransitionValues(); values.view = view; assertThatAnimatorForViewIsValid(Translate.createAnimator( translate, view, values, 0, 0, 0f, 0f, 100f, 100f ), view); }
@Test public void testCreateAnimatorForTranslationChangedOnlyAlongXAxis() { final Translate translate = new Translate(); final View view = createViewAttachedToWindow(); final TransitionValues values = new TransitionValues(); values.view = view; assertThatAnimatorForViewIsValid(Translate.createAnimator( translate, view, values, 0, 0, 0f, 0f, 100f, 0f ), view); }
@Test public void testCreateAnimatorForTranslationChangedOnlyAlongYAxis() { final Translate translate = new Translate(); final View view = createViewAttachedToWindow(); final TransitionValues values = new TransitionValues(); values.view = view; assertThatAnimatorForViewIsValid(Translate.createAnimator( translate, view, values, 0, 0, 0f, 0f, 0f, 100f ), view); }
@Test public void testCreateAnimatorForZeroTranslationDeltas() { final Translate translate = new Translate(); final View view = new View(context); final TransitionValues values = new TransitionValues(); values.view = view; assertThat(Translate.createAnimator( translate, view, values, 0, 0, 0f, 0f, 0f, 0f ), is(nullValue())); }
@Test public void testCreateAnimatorWithViewNotAttachedToWindow() { assertThat(Translate.createAnimator( new Translate(), createViewNotAttachedToWindow(), new TransitionValues(), 0, 0, 0f, 0f, 0f, 0f ), is(nullValue())); }