Fix a couple of issues with app close

- Make sure to use center pivot point
- Use correct curve for alpha
- No need for the layer hack anymore because framework issue
was fixed.
- End X should be 480dp for a 411dp device, so we need to scale
it with 1.16

Test: Close app
Change-Id: Ib4587e324aeeb11921de87da7c389b2e148dc913
Fixes: 72691044
This commit is contained in:
Jorim Jaggi
2018-02-01 18:52:45 +01:00
parent 6674249107
commit fc0f6a5c5a
2 changed files with 17 additions and 11 deletions

View File

@@ -439,6 +439,10 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
mAnimator.play(getClosingWindowAnimators(targets));
mAnimator.play(getLauncherResumeAnimation());
mAnimator.start();
// Because t=0 has the app icon in its original spot, we can skip the
// first frame and have the same movement one frame earlier.
mAnimator.setCurrentPlayTime(REFRESH_RATE_MS);
});
}
};
@@ -451,7 +455,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
Matrix matrix = new Matrix();
float height = mLauncher.getDeviceProfile().heightPx;
float width = mLauncher.getDeviceProfile().widthPx;
float endX = Utilities.isRtl(mLauncher.getResources()) ? -width : width;
float endX = (Utilities.isRtl(mLauncher.getResources()) ? -width : width) * 1.16f;
ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
closingAnimator.setDuration(CLOSING_TRANSITION_DURATION_MS);
@@ -466,27 +470,27 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
float scale = getValue(1f, 0.8f, 0, 267, currentPlayTime,
Interpolators.AGGRESSIVE_EASE);
matrix.setScale(scale, scale);
float dX = getValue(0, endX, 0, 350, currentPlayTime,
Interpolators.AGGRESSIVE_EASE_IN_OUT);
float dY = (height - height * scale) / 2f;
TransactionCompat t = new TransactionCompat();
for (RemoteAnimationTargetCompat app : targets) {
if (app.mode == RemoteAnimationTargetCompat.MODE_CLOSING) {
t.setAlpha(app.leash, 1f - percent);
matrix.postTranslate(dX, dY);
t.setAlpha(app.leash, getValue(1f, 0f, 0, 350, currentPlayTime,
Interpolators.APP_CLOSE_ALPHA));
matrix.setScale(scale, scale,
app.sourceContainerBounds.centerX(),
app.sourceContainerBounds.centerY());
matrix.postTranslate(dX, 0);
matrix.postTranslate(app.position.x, app.position.y);
t.setMatrix(app.leash, matrix);
}
// TODO: Layer should be set only once, but there is possibly a race condition
// where WindowManager is also calling setLayer.
int layer = app.mode == RemoteAnimationTargetCompat.MODE_CLOSING
? Integer.MAX_VALUE
: app.prefixOrderIndex;
t.setLayer(app.leash, layer);
if (isFirstFrame) {
int layer = app.mode == RemoteAnimationTargetCompat.MODE_CLOSING
? Integer.MAX_VALUE
: app.prefixOrderIndex;
t.setLayer(app.leash, layer);
t.show(app.leash);
}
}