Fixes divider position after minimizing and unminimizing with ime open

Minimizing with the ime would cause visual glitches with the divider and
unminiming after would set the wrong position leaving graphical errors.
Record the position before minimizing when adjusting for ime and do not
set that position when the ime is still adjusted. Also added animation
for the divider when adjusting for ime.

Bug: 36603383
Test: manual
Change-Id: I456f3a726c62d130dce6c58c2245982e7f46454c
This commit is contained in:
Matthew Ng
2017-04-24 17:14:14 -07:00
parent bf783e24cf
commit f9989e2304

View File

@@ -767,17 +767,22 @@ public class DividerView extends FrameLayout implements OnTouchListener,
mDockedStackMinimized = minimized;
} else if (mDockedStackMinimized != minimized) {
mIsInMinimizeInteraction = true;
if (minimized && (mCurrentAnimator == null || !mCurrentAnimator.isRunning())) {
if (minimized && (mCurrentAnimator == null || !mCurrentAnimator.isRunning())
&& (mDividerPositionBeforeMinimized <= 0 || !mAdjustedForIme)) {
mDividerPositionBeforeMinimized = getCurrentPosition();
}
mMinimizedSnapAlgorithm = null;
mDockedStackMinimized = minimized;
initializeSnapAlgorithm();
stopDragging(getCurrentPosition(), minimized ?
mMinimizedSnapAlgorithm.getMiddleTarget() :
mSnapAlgorithm.calculateNonDismissingSnapTarget(
stopDragging(minimized
? mDividerPositionBeforeMinimized
: getCurrentPosition(),
minimized
? mMinimizedSnapAlgorithm.getMiddleTarget()
: mSnapAlgorithm.calculateNonDismissingSnapTarget(
mDividerPositionBeforeMinimized),
animDuration, Interpolators.FAST_OUT_SLOW_IN, 0);
setAdjustedForIme(false, animDuration);
}
if (!minimized) {
mBackground.animate().withEndAction(mResetBackgroundRunnable);
@@ -820,6 +825,9 @@ public class DividerView extends FrameLayout implements OnTouchListener,
.setDuration(animDuration)
.start();
mAdjustedForIme = adjustedForIme;
if (mHomeStackResizable && adjustedForIme) {
mDividerPositionBeforeMinimized = getCurrentPosition();
}
}
private void resetBackground() {