diff --git a/api/current.xml b/api/current.xml
index 098676ec302d8..5aeeec6448a40 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -2275,6 +2275,17 @@
visibility="public"
>
+
+
0) {
setOutAnimation(context, resource);
}
+
+ boolean flag = a.getBoolean(com.android.internal.R.styleable.ViewAnimator_animateFirstView, true);
+ setAnimateFirstView(flag);
+
a.recycle();
initViewAnimator(context, attrs);
@@ -84,10 +90,10 @@ public class ViewAnimator extends FrameLayout {
setMeasureAllChildren(measureAllChildren);
a.recycle();
}
-
+
/**
* Sets which child view will be displayed.
- *
+ *
* @param whichChild the index of the child view to display
*/
public void setDisplayedChild(int whichChild) {
@@ -105,14 +111,14 @@ public class ViewAnimator extends FrameLayout {
requestFocus(FOCUS_FORWARD);
}
}
-
+
/**
* Returns the index of the currently displayed child view.
*/
public int getDisplayedChild() {
return mWhichChild;
}
-
+
/**
* Manually shows the next child.
*/
@@ -127,6 +133,35 @@ public class ViewAnimator extends FrameLayout {
setDisplayedChild(mWhichChild - 1);
}
+ /**
+ * Shows only the specified child. The other displays Views exit the screen,
+ * optionally with the with the {@link #getOutAnimation() out animation} and
+ * the specified child enters the screen, optionally with the
+ * {@link #getInAnimation() in animation}.
+ *
+ * @param childIndex The index of the child to be shown.
+ * @param animate Whether or not to use the in and out animations, defaults
+ * to true.
+ */
+ void showOnly(int childIndex, boolean animate) {
+ final int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (i == childIndex) {
+ if (animate && mInAnimation != null) {
+ child.startAnimation(mInAnimation);
+ }
+ child.setVisibility(View.VISIBLE);
+ mFirstTime = false;
+ } else {
+ if (animate && mOutAnimation != null && child.getVisibility() == View.VISIBLE) {
+ child.startAnimation(mOutAnimation);
+ } else if (child.getAnimation() == mInAnimation)
+ child.clearAnimation();
+ child.setVisibility(View.GONE);
+ }
+ }
+ }
/**
* Shows only the specified child. The other displays Views exit the screen
* with the {@link #getOutAnimation() out animation} and the specified child
@@ -135,24 +170,8 @@ public class ViewAnimator extends FrameLayout {
* @param childIndex The index of the child to be shown.
*/
void showOnly(int childIndex) {
- final int count = getChildCount();
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- final boolean checkForFirst = (!mFirstTime || mAnimateFirstTime);
- if (i == childIndex) {
- if (checkForFirst && mInAnimation != null) {
- child.startAnimation(mInAnimation);
- }
- child.setVisibility(View.VISIBLE);
- mFirstTime = false;
- } else {
- if (checkForFirst && mOutAnimation != null && child.getVisibility() == View.VISIBLE) {
- child.startAnimation(mOutAnimation);
- } else if (child.getAnimation() == mInAnimation)
- child.clearAnimation();
- child.setVisibility(View.GONE);
- }
- }
+ final boolean animate = (!mFirstTime || mAnimateFirstTime);
+ showOnly(childIndex, animate);
}
@Override
diff --git a/core/java/android/widget/ViewFlipper.java b/core/java/android/widget/ViewFlipper.java
index 8034961df50a5..c6f6e81d452b9 100644
--- a/core/java/android/widget/ViewFlipper.java
+++ b/core/java/android/widget/ViewFlipper.java
@@ -75,7 +75,7 @@ public class ViewFlipper extends ViewAnimator {
updateRunning();
} else if (Intent.ACTION_USER_PRESENT.equals(action)) {
mUserPresent = true;
- updateRunning();
+ updateRunning(false);
}
}
};
@@ -109,7 +109,7 @@ public class ViewFlipper extends ViewAnimator {
protected void onWindowVisibilityChanged(int visibility) {
super.onWindowVisibilityChanged(visibility);
mVisible = visibility == VISIBLE;
- updateRunning();
+ updateRunning(false);
}
/**
@@ -144,10 +144,22 @@ public class ViewFlipper extends ViewAnimator {
* on {@link #mRunning} and {@link #mVisible} state.
*/
private void updateRunning() {
+ updateRunning(true);
+ }
+
+ /**
+ * Internal method to start or stop dispatching flip {@link Message} based
+ * on {@link #mRunning} and {@link #mVisible} state.
+ *
+ * @param flipNow Determines whether or not to execute the animation now, in
+ * addition to queuing future flips. If omitted, defaults to
+ * true.
+ */
+ private void updateRunning(boolean flipNow) {
boolean running = mVisible && mStarted && mUserPresent;
if (running != mRunning) {
if (running) {
- showOnly(mWhichChild);
+ showOnly(mWhichChild, flipNow);
Message msg = mHandler.obtainMessage(FLIP_MSG);
mHandler.sendMessageDelayed(msg, mFlipInterval);
} else {
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 7814aa858f91e..d3e66ee1150a5 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -14,8 +14,8 @@
limitations under the License.
-->
-
@@ -985,7 +985,7 @@
-
+
@@ -1026,7 +1026,7 @@
animation that is run on the top activity of the current task
(which is exiting the screen). -->
-
+
@@ -1043,7 +1043,7 @@
currently showing the wallpaper, this is the animation that
is run on the old wallpaper activity (which is exiting the screen). -->
-
+
@@ -2188,8 +2188,13 @@
+
+
+
+
@@ -3545,7 +3550,7 @@
-
+
-
+
@@ -3581,7 +3586,7 @@
-
+
-
+
@@ -3662,7 +3667,7 @@
-
+
@@ -3678,7 +3683,7 @@
-
+
@@ -3737,12 +3742,12 @@
-
+
-
+
@@ -3754,7 +3759,7 @@
-
+
@@ -3763,7 +3768,7 @@
-
+
@@ -3790,7 +3795,7 @@
-
+
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index f36c473909dda..8b1c9d46f6699 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1178,7 +1178,7 @@
-
+
@@ -1186,7 +1186,7 @@
-
+
@@ -1206,7 +1206,7 @@
-
+
@@ -1215,7 +1215,7 @@
-
+
@@ -1236,9 +1236,9 @@
-
+
-
+
@@ -1247,7 +1247,7 @@
-
+
@@ -1257,9 +1257,9 @@
-
+
-
+
@@ -1293,6 +1293,7 @@
+