summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/AdapterViewAnimator.java22
-rw-r--r--core/java/android/widget/StackView.java15
2 files changed, 11 insertions, 26 deletions
diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java
index e3a62db..190c0fc 100644
--- a/core/java/android/widget/AdapterViewAnimator.java
+++ b/core/java/android/widget/AdapterViewAnimator.java
@@ -280,6 +280,10 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
* @param whichChild the index of the child view to display
*/
public void setDisplayedChild(int whichChild) {
+ setDisplayedChild(whichChild, true);
+ }
+
+ private void setDisplayedChild(int whichChild, boolean animate) {
if (mAdapter != null) {
mWhichChild = whichChild;
if (whichChild >= getWindowSize()) {
@@ -290,7 +294,7 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
boolean hasFocus = getFocusedChild() != null;
// This will clear old focus if we had it
- showOnly(mWhichChild);
+ showOnly(mWhichChild, animate);
if (hasFocus) {
// Try to retake focus if we had it
requestFocus(FOCUS_FORWARD);
@@ -793,23 +797,11 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
if (mRemoteViewsAdapter != null && mAdapter == null) {
mRestoreWhichChild = mWhichChild;
} else {
- setDisplayedChild(mWhichChild);
+ setDisplayedChild(mWhichChild, false);
}
}
/**
- * Shows only the specified child. The other displays Views exit the screen
- * with the {@link #getOutAnimation() out animation} and the specified child
- * enters the screen with the {@link #getInAnimation() in animation}.
- *
- * @param childIndex The index of the child to be shown.
- */
- void showOnly(int childIndex) {
- final boolean animate = (!mFirstTime || mAnimateFirstTime);
- showOnly(childIndex, animate);
- }
-
- /**
* Returns the View corresponding to the currently displayed child.
*
* @return The View currently displayed.
@@ -977,7 +969,7 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
// Restore the previous position (see onRestoreInstanceState)
if (mRestoreWhichChild > -1) {
- setDisplayedChild(mRestoreWhichChild);
+ setDisplayedChild(mRestoreWhichChild, false);
mRestoreWhichChild = -1;
}
return false;
diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java
index d57d5c6..7a74241 100644
--- a/core/java/android/widget/StackView.java
+++ b/core/java/android/widget/StackView.java
@@ -549,11 +549,7 @@ public class StackView extends AdapterViewAnimator {
mSlideAmount = Math.round(SLIDE_UP_RATIO * getMeasuredHeight());
mSwipeThreshold = Math.round(SWIPE_THRESHOLD_RATIO * mSlideAmount);
mFirstLayoutHappened = true;
- post(new Runnable() {
- public void run() {
- updateChildTransforms();
- }
- });
+ updateChildTransforms();
}
if (Float.compare(mPerspectiveShiftY, mNewPerspectiveShiftY) != 0 ||
@@ -561,12 +557,7 @@ public class StackView extends AdapterViewAnimator {
mPerspectiveShiftY = mNewPerspectiveShiftY;
mPerspectiveShiftX = mNewPerspectiveShiftX;
-
- post(new Runnable() {
- public void run() {
- updateChildTransforms();
- }
- });
+ updateChildTransforms();
}
}
@@ -1120,6 +1111,8 @@ public class StackView extends AdapterViewAnimator {
mNewPerspectiveShiftX = PERSPECTIVE_SHIFT_FACTOR_X * measuredWidth;
mNewPerspectiveShiftY = PERSPECTIVE_SHIFT_FACTOR_Y * measuredHeight;
+
+ // If we have extra space, we try and spread the items out
if (maxWidth > 0 && count > 0 && maxWidth < childWidth) {
mNewPerspectiveShiftX = measuredWidth - maxWidth;
}