Merge "Fix bug where floating icon and workspace icon visible at the same time." into ub-launcher3-qt-r1-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 9684eec..206173c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -809,7 +809,7 @@
@UiThread
private InputConsumer createNewInputProxyHandler() {
- endRunningWindowAnim();
+ endRunningWindowAnim(true /* cancel */);
endLauncherTransitionController();
if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) {
// Hide the task view, if not already hidden
@@ -821,9 +821,13 @@
? InputConsumer.NO_OP : new OverviewInputConsumer(activity, null, true);
}
- private void endRunningWindowAnim() {
+ private void endRunningWindowAnim(boolean cancel) {
if (mRunningWindowAnim != null) {
- mRunningWindowAnim.end();
+ if (cancel) {
+ mRunningWindowAnim.cancel();
+ } else {
+ mRunningWindowAnim.end();
+ }
}
}
@@ -1115,27 +1119,37 @@
// We want the window alpha to be 0 once this threshold is met, so that the
// FolderIconView can be seen morphing into the icon shape.
final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f;
- anim.addOnUpdateListener((currentRect, progress) -> {
- homeAnim.setPlayFraction(progress);
+ anim.addOnUpdateListener(new RectFSpringAnim.OnUpdateListener() {
+ @Override
+ public void onUpdate(RectF currentRect, float progress) {
+ homeAnim.setPlayFraction(progress);
- float alphaProgress = ACCEL_1_5.getInterpolation(progress);
- float windowAlpha = Utilities.boundToRange(Utilities.mapToRange(alphaProgress, 0,
- windowAlphaThreshold, 1.5f, 0f, Interpolators.LINEAR), 0, 1);
- mTransformParams.setProgress(progress)
- .setCurrentRectAndTargetAlpha(currentRect, windowAlpha);
- if (isFloatingIconView) {
- mTransformParams.setCornerRadius(endRadius * progress + startRadius
- * (1f - progress));
- }
- mClipAnimationHelper.applyTransform(targetSet, mTransformParams,
- false /* launcherOnTop */);
+ float alphaProgress = ACCEL_1_5.getInterpolation(progress);
+ float windowAlpha = Utilities.boundToRange(Utilities.mapToRange(alphaProgress, 0,
+ windowAlphaThreshold, 1.5f, 0f, Interpolators.LINEAR), 0, 1);
+ mTransformParams.setProgress(progress)
+ .setCurrentRectAndTargetAlpha(currentRect, windowAlpha);
+ if (isFloatingIconView) {
+ mTransformParams.setCornerRadius(endRadius * progress + startRadius
+ * (1f - progress));
+ }
+ mClipAnimationHelper.applyTransform(targetSet, mTransformParams,
+ false /* launcherOnTop */);
- if (isFloatingIconView) {
- ((FloatingIconView) floatingView).update(currentRect, 1f, progress,
- windowAlphaThreshold, mClipAnimationHelper.getCurrentCornerRadius(), false);
+ if (isFloatingIconView) {
+ ((FloatingIconView) floatingView).update(currentRect, 1f, progress,
+ windowAlphaThreshold, mClipAnimationHelper.getCurrentCornerRadius(), false);
+ }
+
+ updateSysUiFlags(Math.max(progress, mCurrentShift.value));
}
- updateSysUiFlags(Math.max(progress, mCurrentShift.value));
+ @Override
+ public void onCancel() {
+ if (isFloatingIconView) {
+ ((FloatingIconView) floatingView).fastFinish();
+ }
+ }
});
anim.addAnimatorListener(new AnimationSuccessListener() {
@Override
@@ -1251,7 +1265,7 @@
}
private void invalidateHandler() {
- endRunningWindowAnim();
+ endRunningWindowAnim(false /* cancel */);
if (mGestureEndCallback != null) {
mGestureEndCallback.run();
@@ -1411,12 +1425,34 @@
private interface RunningWindowAnim {
void end();
+ void cancel();
+
static RunningWindowAnim wrap(Animator animator) {
- return animator::end;
+ return new RunningWindowAnim() {
+ @Override
+ public void end() {
+ animator.end();
+ }
+
+ @Override
+ public void cancel() {
+ animator.cancel();
+ }
+ };
}
static RunningWindowAnim wrap(RectFSpringAnim rectFSpringAnim) {
- return rectFSpringAnim::end;
+ return new RunningWindowAnim() {
+ @Override
+ public void end() {
+ rectFSpringAnim.end();
+ }
+
+ @Override
+ public void cancel() {
+ rectFSpringAnim.cancel();
+ }
+ };
}
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
index 77dc6f3..9c5cf20 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
@@ -225,7 +225,18 @@
}
}
+ public void cancel() {
+ if (mAnimsStarted) {
+ for (OnUpdateListener onUpdateListener : mOnUpdateListeners) {
+ onUpdateListener.onCancel();
+ }
+ }
+ end();
+ }
+
public interface OnUpdateListener {
void onUpdate(RectF currentRect, float progress);
+
+ void onCancel();
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 07e9686..bb6892a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -134,10 +134,6 @@
* @param totalRows Total number of rows.
*/
private void addStaggeredAnimationForView(View v, int row, int totalRows) {
- if (v == mViewToIgnore) {
- return;
- }
-
// Invert the rows, because we stagger starting from the bottom of the screen.
int invertedRow = totalRows - row;
// Add 1 to the inverted row so that the bottom most row has a start delay.
@@ -149,6 +145,10 @@
springTransY.setStartDelay(startDelay);
mAnimators.add(springTransY);
+ if (v == mViewToIgnore) {
+ return;
+ }
+
v.setAlpha(0);
ObjectAnimator alpha = ObjectAnimator.ofFloat(v, View.ALPHA, 0f, 1f);
alpha.setInterpolator(LINEAR);
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index ab4b576..4fdd83b 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -656,8 +656,7 @@
canvas.restoreToCount(count);
}
- public void onListenerViewClosed() {
- // Fast finish here.
+ public void fastFinish() {
if (mEndRunnable != null) {
mEndRunnable.run();
mEndRunnable = null;
@@ -757,7 +756,7 @@
view.setVisibility(INVISIBLE);
parent.addView(view);
dragLayer.addView(view.mListenerView);
- view.mListenerView.setListener(view::onListenerViewClosed);
+ view.mListenerView.setListener(view::fastFinish);
view.mEndRunnable = () -> {
view.mEndRunnable = null;