Loading core/java/android/widget/AdapterViewAnimator.java +7 −15 Original line number Diff line number Diff line Loading @@ -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()) { Loading @@ -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); Loading Loading @@ -793,22 +797,10 @@ 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. * Loading Loading @@ -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; Loading core/java/android/widget/StackView.java +4 −11 Original line number Diff line number Diff line Loading @@ -549,25 +549,16 @@ 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(); } }); } if (Float.compare(mPerspectiveShiftY, mNewPerspectiveShiftY) != 0 || Float.compare(mPerspectiveShiftX, mNewPerspectiveShiftX) != 0) { mPerspectiveShiftY = mNewPerspectiveShiftY; mPerspectiveShiftX = mNewPerspectiveShiftX; post(new Runnable() { public void run() { updateChildTransforms(); } }); } } /** Loading Loading @@ -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; } Loading Loading
core/java/android/widget/AdapterViewAnimator.java +7 −15 Original line number Diff line number Diff line Loading @@ -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()) { Loading @@ -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); Loading Loading @@ -793,22 +797,10 @@ 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. * Loading Loading @@ -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; Loading
core/java/android/widget/StackView.java +4 −11 Original line number Diff line number Diff line Loading @@ -549,25 +549,16 @@ 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(); } }); } if (Float.compare(mPerspectiveShiftY, mNewPerspectiveShiftY) != 0 || Float.compare(mPerspectiveShiftX, mNewPerspectiveShiftX) != 0) { mPerspectiveShiftY = mNewPerspectiveShiftY; mPerspectiveShiftX = mNewPerspectiveShiftX; post(new Runnable() { public void run() { updateChildTransforms(); } }); } } /** Loading Loading @@ -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; } Loading