am 3b52ca3b: Merge "Fixing some ugly StackView relayouts on rotation" into honeycomb
* commit '3b52ca3bbcb989200abff5582ef569d5f316d7f5': Fixing some ugly StackView relayouts on rotation
This commit is contained in:
@@ -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,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.
|
||||
*
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user