SlideKitkat.java revision 2f97594742886d045ca1ce409ebc6e6e780452f6
12f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu/* 22f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Copyright (C) 2014 The Android Open Source Project 32f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * 42f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Licensed under the Apache License, Version 2.0 (the "License"); 52f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * you may not use this file except in compliance with the License. 62f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * You may obtain a copy of the License at 72f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * 82f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * http://www.apache.org/licenses/LICENSE-2.0 92f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * 102f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Unless required by applicable law or agreed to in writing, software 112f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * distributed under the License is distributed on an "AS IS" BASIS, 122f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 132f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * See the License for the specific language governing permissions and 142f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * limitations under the License. 152f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu */ 162f97594742886d045ca1ce409ebc6e6e780452f6Dake Gupackage android.support.v17.leanback.app; 172f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 182f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.animation.Animator; 192f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.animation.AnimatorListenerAdapter; 202f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.animation.AnimatorSet; 212f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.animation.ObjectAnimator; 222f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.animation.TimeInterpolator; 232f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.animation.ValueAnimator; 242f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.graphics.Rect; 252f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.util.Log; 262f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.util.Property; 272f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.view.View; 282f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.view.ViewGroup; 292f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.view.animation.AccelerateInterpolator; 302f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.view.animation.DecelerateInterpolator; 312f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.transition.Visibility; 322f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.transition.Transition; 332f97594742886d045ca1ce409ebc6e6e780452f6Dake Guimport android.transition.TransitionValues; 342f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 352f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu/** 362f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Slide distance toward/from a edge. The direction and distance are determined by 372f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * {@link SlideCallback}. 382f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu */ 392f97594742886d045ca1ce409ebc6e6e780452f6Dake Guclass Slide extends Visibility { 402f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static final String TAG = "Slide"; 412f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 422f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu /** 432f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Move Views in or out of the left edge of the scene. 442f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * @see #setSlideEdge(int) 452f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu */ 462f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public static final int LEFT = 0; 472f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 482f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu /** 492f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Move Views in or out of the top edge of the scene. 502f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * @see #setSlideEdge(int) 512f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu */ 522f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public static final int TOP = 1; 532f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 542f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu /** 552f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Move Views in or out of the right edge of the scene. 562f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * @see #setSlideEdge(int) 572f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu */ 582f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public static final int RIGHT = 2; 592f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 602f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu /** 612f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * Move Views in or out of the bottom edge of the scene. This is the 622f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * default slide direction. 632f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu * @see #setSlideEdge(int) 642f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu */ 652f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public static final int BOTTOM = 3; 662f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 672f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static final TimeInterpolator sDecelerate = new DecelerateInterpolator(); 682f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static final TimeInterpolator sAccelerate = new AccelerateInterpolator(); 692f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 702f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private int[] mTempLoc = new int[2]; 712f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu SlideCallback mCallback; 722f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private int[] mTempEdge = new int[1]; 732f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private float[] mTempDistance = new float[1]; 742f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 752f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private interface CalculateSlide { 762f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu /** Returns the translation value for view when it out of the scene */ 772f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu float getGone(float slide, View view); 782f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 792f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu /** Returns the translation value for view when it is in the scene */ 802f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu float getHere(View view); 812f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 822f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu /** Returns the property to animate translation */ 832f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu Property<View, Float> getProperty(); 842f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 852f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 862f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static abstract class CalculateSlideHorizontal implements CalculateSlide { 872f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 882f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public float getHere(View view) { 892f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return view.getTranslationX(); 902f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 912f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 922f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 932f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public Property<View, Float> getProperty() { 942f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return View.TRANSLATION_X; 952f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 962f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 972f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 982f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static abstract class CalculateSlideVertical implements CalculateSlide { 992f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1002f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public float getHere(View view) { 1012f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return view.getTranslationY(); 1022f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1032f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1042f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1052f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public Property<View, Float> getProperty() { 1062f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return View.TRANSLATION_Y; 1072f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1082f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1092f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1102f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static final CalculateSlide sCalculateLeft = new CalculateSlideHorizontal() { 1112f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1122f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public float getGone(float distance, View view) { 1132f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return view.getTranslationX() - distance; 1142f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1152f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu }; 1162f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1172f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static final CalculateSlide sCalculateTop = new CalculateSlideVertical() { 1182f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1192f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public float getGone(float distance, View view) { 1202f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return view.getTranslationY() - distance; 1212f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1222f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu }; 1232f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1242f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static final CalculateSlide sCalculateRight = new CalculateSlideHorizontal() { 1252f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1262f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public float getGone(float distance, View view) { 1272f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return view.getTranslationX() + distance; 1282f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1292f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu }; 1302f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1312f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static final CalculateSlide sCalculateBottom = new CalculateSlideVertical() { 1322f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1332f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public float getGone(float distance, View view) { 1342f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return view.getTranslationY() + distance; 1352f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1362f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu }; 1372f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1382f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public Slide() { 1392f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1402f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1412f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public void setCallback(SlideCallback callback) { 1422f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mCallback = callback; 1432f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1442f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1452f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private CalculateSlide getSlideEdge(int slideEdge) { 1462f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu switch (slideEdge) { 1472f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu case LEFT: 1482f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return sCalculateLeft; 1492f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu case TOP: 1502f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return sCalculateTop; 1512f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu case RIGHT: 1522f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return sCalculateRight; 1532f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu case BOTTOM: 1542f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return sCalculateBottom; 1552f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu default: 1562f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu throw new IllegalArgumentException("Invalid slide direction"); 1572f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1582f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1592f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1602f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private Animator createAnimation(final View view, Property<View, Float> property, 1612f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu float start, float end, float terminalValue, TimeInterpolator interpolator) { 1622f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu view.setTranslationY(start); 1632f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu if (start == end) { 1642f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return null; 1652f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1662f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu final ObjectAnimator anim = ObjectAnimator.ofFloat(view, property, start, end); 1672f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1682f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu SlideAnimatorListener listener = new SlideAnimatorListener(view, terminalValue, end); 1692f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu anim.addListener(listener); 1702f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu anim.addPauseListener(listener); 1712f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu anim.setInterpolator(interpolator); 1722f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return anim; 1732f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1742f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1752f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1762f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public Animator onAppear(ViewGroup sceneRoot, 1772f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu TransitionValues startValues, int startVisibility, 1782f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu TransitionValues endValues, int endVisibility) { 1792f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu View view = (endValues != null) ? endValues.view : null; 1802f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu if (view == null) { 1812f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return null; 1822f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1832f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu if (mCallback == null || !mCallback.getSlide(view, true, mTempEdge, mTempDistance)) { 1842f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return null; 1852f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1862f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu final CalculateSlide slideCalculator = getSlideEdge(mTempEdge[0]); 1872f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu float end = slideCalculator.getHere(view); 1882f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu float start = slideCalculator.getGone(mTempDistance[0], view); 1892f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return createAnimation(view, slideCalculator.getProperty(), start, end, end, sDecelerate); 1902f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 1912f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 1922f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 1932f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public Animator onDisappear(ViewGroup sceneRoot, 1942f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu TransitionValues startValues, int startVisibility, 1952f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu TransitionValues endValues, int endVisibility) { 1962f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu View view = (startValues != null) ? startValues.view : null; 1972f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu if (view == null) { 1982f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return null; 1992f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2002f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu if (mCallback == null || !mCallback.getSlide(view, false, mTempEdge, mTempDistance)) { 2012f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return null; 2022f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2032f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu final CalculateSlide slideCalculator = getSlideEdge(mTempEdge[0]); 2042f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu float start = slideCalculator.getHere(view); 2052f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu float end = slideCalculator.getGone(mTempDistance[0], view); 2062f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 2072f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu return createAnimation(view, slideCalculator.getProperty(), start, end, start, 2082f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu sAccelerate); 2092f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2102f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 2112f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private static class SlideAnimatorListener extends AnimatorListenerAdapter { 2122f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private boolean mCanceled = false; 2132f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private float mPausedY; 2142f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private final View mView; 2152f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private final float mEndY; 2162f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu private final float mTerminalY; 2172f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 2182f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public SlideAnimatorListener(View view, float terminalY, float endY) { 2192f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mView = view; 2202f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mTerminalY = terminalY; 2212f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mEndY = endY; 2222f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2232f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 2242f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 2252f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public void onAnimationCancel(Animator animator) { 2262f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mView.setTranslationY(mTerminalY); 2272f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mCanceled = true; 2282f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2292f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 2302f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 2312f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public void onAnimationEnd(Animator animator) { 2322f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu if (!mCanceled) { 2332f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mView.setTranslationY(mTerminalY); 2342f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2352f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2362f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 2372f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 2382f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public void onAnimationPause(Animator animator) { 2392f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mPausedY = mView.getTranslationY(); 2402f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mView.setTranslationY(mEndY); 2412f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2422f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu 2432f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu @Override 2442f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu public void onAnimationResume(Animator animator) { 2452f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu mView.setTranslationY(mPausedY); 2462f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2472f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu } 2482f97594742886d045ca1ce409ebc6e6e780452f6Dake Gu}