Skip to content

Commit 8ca2f47

Browse files
author
NoraBora
committed
ViewAnimator.setAnimateFirstView() doesn't work for out-animation.
1 parent 8d21bdb commit 8ca2f47

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/java/android/widget/ViewAnimator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ void showOnly(int childIndex) {
121121
final int count = getChildCount();
122122
for (int i = 0; i < count; i++) {
123123
final View child = getChildAt(i);
124+
final boolean checkForFirst = (!mFirstTime || mAnimateFirstTime);
124125
if (i == childIndex) {
125-
if ((!mFirstTime || mAnimateFirstTime) && mInAnimation != null) {
126+
if (checkForFirst && mInAnimation != null) {
126127
child.startAnimation(mInAnimation);
127128
}
128129
child.setVisibility(View.VISIBLE);
129130
mFirstTime = false;
130131
} else {
131-
if (mOutAnimation != null && child.getVisibility() == View.VISIBLE) {
132+
if (checkForFirst && mOutAnimation != null && child.getVisibility() == View.VISIBLE) {
132133
child.startAnimation(mOutAnimation);
133134
} else if (child.getAnimation() == mInAnimation)
134135
child.clearAnimation();

0 commit comments

Comments
 (0)