Merge "Fix some minor issues with animating dismiss" into rvc-dev am: a2caf278e0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11917703 Change-Id: Ie2436290d0653fc88eda9f64cb7ff275b50aadf2
This commit is contained in:
@@ -206,6 +206,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
|
|||||||
void synchronizePinnedStackBounds() {
|
void synchronizePinnedStackBounds() {
|
||||||
cancelAnimations();
|
cancelAnimations();
|
||||||
mBounds.set(mPipTaskOrganizer.getLastReportedBounds());
|
mBounds.set(mPipTaskOrganizer.getLastReportedBounds());
|
||||||
|
mTemporaryBounds.setEmpty();
|
||||||
|
|
||||||
if (mPipTaskOrganizer.isInPip()) {
|
if (mPipTaskOrganizer.isInPip()) {
|
||||||
mFloatingContentCoordinator.onContentMoved(this);
|
mFloatingContentCoordinator.onContentMoved(this);
|
||||||
@@ -274,6 +275,11 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
|
|||||||
final float destinationX = targetCenter.x - (desiredWidth / 2f);
|
final float destinationX = targetCenter.x - (desiredWidth / 2f);
|
||||||
final float destinationY = targetCenter.y - (desiredHeight / 2f);
|
final float destinationY = targetCenter.y - (desiredHeight / 2f);
|
||||||
|
|
||||||
|
// If we're already in the dismiss target area, then there won't be a move to set the
|
||||||
|
// temporary bounds, so just initialize it to the current bounds
|
||||||
|
if (mTemporaryBounds.isEmpty()) {
|
||||||
|
mTemporaryBounds.set(mBounds);
|
||||||
|
}
|
||||||
mTemporaryBoundsPhysicsAnimator
|
mTemporaryBoundsPhysicsAnimator
|
||||||
.spring(FloatProperties.RECT_X, destinationX, velX, mSpringConfig)
|
.spring(FloatProperties.RECT_X, destinationX, velX, mSpringConfig)
|
||||||
.spring(FloatProperties.RECT_Y, destinationY, velY, mSpringConfig)
|
.spring(FloatProperties.RECT_Y, destinationY, velY, mSpringConfig)
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ public class PipTouchHandler {
|
|||||||
/** Duration of the dismiss scrim fading in/out. */
|
/** Duration of the dismiss scrim fading in/out. */
|
||||||
private static final int DISMISS_TRANSITION_DURATION_MS = 200;
|
private static final int DISMISS_TRANSITION_DURATION_MS = 200;
|
||||||
|
|
||||||
|
/* The multiplier to apply scale the target size by when applying the magnetic field radius */
|
||||||
|
private static final float MAGNETIC_FIELD_RADIUS_MULTIPLIER = 1.25f;
|
||||||
|
|
||||||
// Allow dragging the PIP to a location to close it
|
// Allow dragging the PIP to a location to close it
|
||||||
private final boolean mEnableDismissDragToEdge;
|
private final boolean mEnableDismissDragToEdge;
|
||||||
// Allow PIP to resize to a slightly bigger state upon touch
|
// Allow PIP to resize to a slightly bigger state upon touch
|
||||||
@@ -330,8 +333,9 @@ public class PipTouchHandler {
|
|||||||
R.dimen.floating_dismiss_bottom_margin);
|
R.dimen.floating_dismiss_bottom_margin);
|
||||||
mTargetView.setLayoutParams(newParams);
|
mTargetView.setLayoutParams(newParams);
|
||||||
|
|
||||||
// Set the magnetic field radius equal to twice the size of the target.
|
// Set the magnetic field radius equal to the target size from the center of the target
|
||||||
mMagneticTarget.setMagneticFieldRadiusPx(targetSize * 2);
|
mMagneticTarget.setMagneticFieldRadiusPx(
|
||||||
|
(int) (targetSize * MAGNETIC_FIELD_RADIUS_MULTIPLIER));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldShowResizeHandle() {
|
private boolean shouldShowResizeHandle() {
|
||||||
@@ -953,7 +957,6 @@ public class PipTouchHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PointF vel = touchState.getVelocity();
|
final PointF vel = touchState.getVelocity();
|
||||||
final float velocity = PointF.length(vel.x, vel.y);
|
|
||||||
|
|
||||||
if (touchState.isDragging()) {
|
if (touchState.isDragging()) {
|
||||||
if (mMenuState != MENU_STATE_NONE) {
|
if (mMenuState != MENU_STATE_NONE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user