Loading api/current.xml +1 −1 Original line number Diff line number Diff line Loading @@ -260231,7 +260231,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="arg0" type="T"> <parameter name="t" type="T"> </parameter> </method> </interface> core/java/android/widget/AdapterViewAnimator.java +1 −0 Original line number Diff line number Diff line Loading @@ -787,6 +787,7 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> // We do the former in case mAdapter is null, and hence setDisplayedChild won't // set mWhichChild mWhichChild = ss.whichChild; setDisplayedChild(mWhichChild); } Loading core/java/android/widget/StackView.java +51 −26 Original line number Diff line number Diff line Loading @@ -194,7 +194,21 @@ public class StackView extends AdapterViewAnimator { /** * Animate the views between different relative indexes within the {@link AdapterViewAnimator} */ void animateViewForTransition(int fromIndex, int toIndex, View view) { void animateViewForTransition(int fromIndex, int toIndex, final View view) { ObjectAnimator alphaOa = null; ObjectAnimator oldAlphaOa = null; // If there is currently an alpha animation on this view, we need // to know about it, and may need to cancel it so as not to interfere with // a new alpha animation. Object tag = view.getTag(com.android.internal.R.id.viewAlphaAnimation); if (tag instanceof WeakReference<?>) { Object obj = ((WeakReference<?>) tag).get(); if (obj instanceof ObjectAnimator) { oldAlphaOa = (ObjectAnimator) obj; } } if (fromIndex == -1 && toIndex == NUM_ACTIVE_VIEWS -1) { // Fade item in if (view.getAlpha() == 1) { Loading @@ -206,9 +220,12 @@ public class StackView extends AdapterViewAnimator { view.setTranslationY(0); view.setVisibility(VISIBLE); ObjectAnimator fadeIn = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f); fadeIn.setDuration(FADE_IN_ANIMATION_DURATION); fadeIn.start(); alphaOa = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f); alphaOa.setDuration(FADE_IN_ANIMATION_DURATION); if (oldAlphaOa != null) oldAlphaOa.cancel(); alphaOa.start(); view.setTagInternal(com.android.internal.R.id.viewAlphaAnimation, new WeakReference<ObjectAnimator>(alphaOa)); } else if (fromIndex == 0 && toIndex == 1) { // Slide item in view.setVisibility(VISIBLE); Loading @@ -216,39 +233,45 @@ public class StackView extends AdapterViewAnimator { int duration = Math.round(mStackSlider.getDurationForNeutralPosition(mYVelocity)); StackSlider animationSlider = new StackSlider(mStackSlider); animationSlider.setView(view); PropertyValuesHolder slideInY = PropertyValuesHolder.ofFloat("YProgress", 0.0f); PropertyValuesHolder slideInX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, ObjectAnimator slideIn = ObjectAnimator.ofPropertyValuesHolder(animationSlider, slideInX, slideInY); pa.setDuration(duration); pa.setInterpolator(new LinearInterpolator()); pa.start(); slideIn.setDuration(duration); slideIn.setInterpolator(new LinearInterpolator()); slideIn.start(); } else if (fromIndex == 1 && toIndex == 0) { // Slide item out int duration = Math.round(mStackSlider.getDurationForOffscreenPosition(mYVelocity)); StackSlider animationSlider = new StackSlider(mStackSlider); animationSlider.setView(view); PropertyValuesHolder slideOutY = PropertyValuesHolder.ofFloat("YProgress", 1.0f); PropertyValuesHolder slideOutX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, ObjectAnimator slideOut = ObjectAnimator.ofPropertyValuesHolder(animationSlider, slideOutX, slideOutY); pa.setDuration(duration); pa.setInterpolator(new LinearInterpolator()); pa.start(); } else if (fromIndex == -1 && toIndex == 0) { slideOut.setDuration(duration); slideOut.setInterpolator(new LinearInterpolator()); slideOut.start(); } else if (toIndex == 0) { // Make sure this view that is "waiting in the wings" is invisible view.setAlpha(0.0f); view.setVisibility(INVISIBLE); LayoutParams lp = (LayoutParams) view.getLayoutParams(); lp.setVerticalOffset(-mSlideAmount); } else if (fromIndex == 0 && toIndex > 1) { view.setVisibility(VISIBLE); view.setAlpha(1.0f); } else if (fromIndex == -1) { view.setAlpha(1.0f); view.setVisibility(VISIBLE); } else if (toIndex == -1) { // Fade item out ObjectAnimator fadeOut = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 0.0f); fadeOut.setDuration(STACK_RELAYOUT_DURATION); fadeOut.start(); alphaOa = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 0.0f); alphaOa.setDuration(STACK_RELAYOUT_DURATION); if (oldAlphaOa != null) oldAlphaOa.cancel(); alphaOa.start(); view.setTagInternal(com.android.internal.R.id.viewAlphaAnimation, new WeakReference<ObjectAnimator>(alphaOa)); } // Implement the faked perspective Loading Loading @@ -279,6 +302,16 @@ public class StackView extends AdapterViewAnimator { (getMeasuredWidth() * (1 - PERSPECTIVE_SHIFT_FACTOR_X) / 2.0f); final float transX = perspectiveTranslationX + scaleShiftCorrectionX; // If this view is currently being animated for a certain position, we need to cancel // this animation so as not to interfere with the new transformation. Object tag = view.getTag(com.android.internal.R.id.viewAnimation); if (tag instanceof WeakReference<?>) { Object obj = ((WeakReference<?>) tag).get(); if (obj instanceof ObjectAnimator) { ((ObjectAnimator) obj).cancel(); } } if (animate) { PropertyValuesHolder translationX = PropertyValuesHolder.ofFloat("translationX", transX); PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", transY); Loading @@ -292,14 +325,6 @@ public class StackView extends AdapterViewAnimator { new WeakReference<ObjectAnimator>(oa)); oa.start(); } else { Object tag = view.getTag(com.android.internal.R.id.viewAnimation); if (tag instanceof WeakReference<?>) { Object obj = ((WeakReference<?>) tag).get(); if (obj instanceof ObjectAnimator) { ((ObjectAnimator) obj).cancel(); } } view.setTranslationX(transX); view.setTranslationY(transY); view.setScaleX(scale); Loading core/res/res/values/ids.xml +1 −0 Original line number Diff line number Diff line Loading @@ -74,4 +74,5 @@ <item type="id" name="rowTypeId" /> <item type="id" name="up" /> <item type="id" name="viewAnimation" /> <item type="id" name="viewAlphaAnimation" /> </resources> Loading
api/current.xml +1 −1 Original line number Diff line number Diff line Loading @@ -260231,7 +260231,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="arg0" type="T"> <parameter name="t" type="T"> </parameter> </method> </interface>
core/java/android/widget/AdapterViewAnimator.java +1 −0 Original line number Diff line number Diff line Loading @@ -787,6 +787,7 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> // We do the former in case mAdapter is null, and hence setDisplayedChild won't // set mWhichChild mWhichChild = ss.whichChild; setDisplayedChild(mWhichChild); } Loading
core/java/android/widget/StackView.java +51 −26 Original line number Diff line number Diff line Loading @@ -194,7 +194,21 @@ public class StackView extends AdapterViewAnimator { /** * Animate the views between different relative indexes within the {@link AdapterViewAnimator} */ void animateViewForTransition(int fromIndex, int toIndex, View view) { void animateViewForTransition(int fromIndex, int toIndex, final View view) { ObjectAnimator alphaOa = null; ObjectAnimator oldAlphaOa = null; // If there is currently an alpha animation on this view, we need // to know about it, and may need to cancel it so as not to interfere with // a new alpha animation. Object tag = view.getTag(com.android.internal.R.id.viewAlphaAnimation); if (tag instanceof WeakReference<?>) { Object obj = ((WeakReference<?>) tag).get(); if (obj instanceof ObjectAnimator) { oldAlphaOa = (ObjectAnimator) obj; } } if (fromIndex == -1 && toIndex == NUM_ACTIVE_VIEWS -1) { // Fade item in if (view.getAlpha() == 1) { Loading @@ -206,9 +220,12 @@ public class StackView extends AdapterViewAnimator { view.setTranslationY(0); view.setVisibility(VISIBLE); ObjectAnimator fadeIn = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f); fadeIn.setDuration(FADE_IN_ANIMATION_DURATION); fadeIn.start(); alphaOa = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f); alphaOa.setDuration(FADE_IN_ANIMATION_DURATION); if (oldAlphaOa != null) oldAlphaOa.cancel(); alphaOa.start(); view.setTagInternal(com.android.internal.R.id.viewAlphaAnimation, new WeakReference<ObjectAnimator>(alphaOa)); } else if (fromIndex == 0 && toIndex == 1) { // Slide item in view.setVisibility(VISIBLE); Loading @@ -216,39 +233,45 @@ public class StackView extends AdapterViewAnimator { int duration = Math.round(mStackSlider.getDurationForNeutralPosition(mYVelocity)); StackSlider animationSlider = new StackSlider(mStackSlider); animationSlider.setView(view); PropertyValuesHolder slideInY = PropertyValuesHolder.ofFloat("YProgress", 0.0f); PropertyValuesHolder slideInX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, ObjectAnimator slideIn = ObjectAnimator.ofPropertyValuesHolder(animationSlider, slideInX, slideInY); pa.setDuration(duration); pa.setInterpolator(new LinearInterpolator()); pa.start(); slideIn.setDuration(duration); slideIn.setInterpolator(new LinearInterpolator()); slideIn.start(); } else if (fromIndex == 1 && toIndex == 0) { // Slide item out int duration = Math.round(mStackSlider.getDurationForOffscreenPosition(mYVelocity)); StackSlider animationSlider = new StackSlider(mStackSlider); animationSlider.setView(view); PropertyValuesHolder slideOutY = PropertyValuesHolder.ofFloat("YProgress", 1.0f); PropertyValuesHolder slideOutX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, ObjectAnimator slideOut = ObjectAnimator.ofPropertyValuesHolder(animationSlider, slideOutX, slideOutY); pa.setDuration(duration); pa.setInterpolator(new LinearInterpolator()); pa.start(); } else if (fromIndex == -1 && toIndex == 0) { slideOut.setDuration(duration); slideOut.setInterpolator(new LinearInterpolator()); slideOut.start(); } else if (toIndex == 0) { // Make sure this view that is "waiting in the wings" is invisible view.setAlpha(0.0f); view.setVisibility(INVISIBLE); LayoutParams lp = (LayoutParams) view.getLayoutParams(); lp.setVerticalOffset(-mSlideAmount); } else if (fromIndex == 0 && toIndex > 1) { view.setVisibility(VISIBLE); view.setAlpha(1.0f); } else if (fromIndex == -1) { view.setAlpha(1.0f); view.setVisibility(VISIBLE); } else if (toIndex == -1) { // Fade item out ObjectAnimator fadeOut = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 0.0f); fadeOut.setDuration(STACK_RELAYOUT_DURATION); fadeOut.start(); alphaOa = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 0.0f); alphaOa.setDuration(STACK_RELAYOUT_DURATION); if (oldAlphaOa != null) oldAlphaOa.cancel(); alphaOa.start(); view.setTagInternal(com.android.internal.R.id.viewAlphaAnimation, new WeakReference<ObjectAnimator>(alphaOa)); } // Implement the faked perspective Loading Loading @@ -279,6 +302,16 @@ public class StackView extends AdapterViewAnimator { (getMeasuredWidth() * (1 - PERSPECTIVE_SHIFT_FACTOR_X) / 2.0f); final float transX = perspectiveTranslationX + scaleShiftCorrectionX; // If this view is currently being animated for a certain position, we need to cancel // this animation so as not to interfere with the new transformation. Object tag = view.getTag(com.android.internal.R.id.viewAnimation); if (tag instanceof WeakReference<?>) { Object obj = ((WeakReference<?>) tag).get(); if (obj instanceof ObjectAnimator) { ((ObjectAnimator) obj).cancel(); } } if (animate) { PropertyValuesHolder translationX = PropertyValuesHolder.ofFloat("translationX", transX); PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", transY); Loading @@ -292,14 +325,6 @@ public class StackView extends AdapterViewAnimator { new WeakReference<ObjectAnimator>(oa)); oa.start(); } else { Object tag = view.getTag(com.android.internal.R.id.viewAnimation); if (tag instanceof WeakReference<?>) { Object obj = ((WeakReference<?>) tag).get(); if (obj instanceof ObjectAnimator) { ((ObjectAnimator) obj).cancel(); } } view.setTranslationX(transX); view.setTranslationY(transY); view.setScaleX(scale); Loading
core/res/res/values/ids.xml +1 −0 Original line number Diff line number Diff line Loading @@ -74,4 +74,5 @@ <item type="id" name="rowTypeId" /> <item type="id" name="up" /> <item type="id" name="viewAnimation" /> <item type="id" name="viewAlphaAnimation" /> </resources>