Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36ca57e9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix bug where floating icon and workspace icon visible at the same...

Merge "Fix bug where floating icon and workspace icon visible at the same time." into ub-launcher3-qt-r1-dev
parents 7e15a184 cabbaf98
Loading
Loading
Loading
Loading
+60 −24
Original line number Diff line number Diff line
@@ -809,7 +809,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> extends

    @UiThread
    private InputConsumer createNewInputProxyHandler() {
        endRunningWindowAnim();
        endRunningWindowAnim(true /* cancel */);
        endLauncherTransitionController();
        if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            // Hide the task view, if not already hidden
@@ -821,11 +821,15 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> extends
                ? InputConsumer.NO_OP : new OverviewInputConsumer(activity, null, true);
    }

    private void endRunningWindowAnim() {
    private void endRunningWindowAnim(boolean cancel) {
        if (mRunningWindowAnim != null) {
            if (cancel) {
                mRunningWindowAnim.cancel();
            } else {
                mRunningWindowAnim.end();
            }
        }
    }

    private GestureEndTarget calculateEndTarget(PointF velocity, float endVelocity, boolean isFling,
            boolean isCancel) {
@@ -1115,7 +1119,9 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> extends
        // 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) -> {
        anim.addOnUpdateListener(new RectFSpringAnim.OnUpdateListener() {
            @Override
            public void onUpdate(RectF currentRect, float progress) {
                homeAnim.setPlayFraction(progress);

                float alphaProgress = ACCEL_1_5.getInterpolation(progress);
@@ -1136,6 +1142,14 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> extends
                }

                updateSysUiFlags(Math.max(progress, mCurrentShift.value));
            }

            @Override
            public void onCancel() {
                if (isFloatingIconView) {
                    ((FloatingIconView) floatingView).fastFinish();
                }
            }
        });
        anim.addAnimatorListener(new AnimationSuccessListener() {
            @Override
@@ -1251,7 +1265,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> extends
    }

    private void invalidateHandler() {
        endRunningWindowAnim();
        endRunningWindowAnim(false /* cancel */);

        if (mGestureEndCallback != null) {
            mGestureEndCallback.run();
@@ -1411,12 +1425,34 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> extends
    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();
                }
            };
        }
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -225,7 +225,18 @@ public class RectFSpringAnim {
        }
    }

    public void cancel() {
        if (mAnimsStarted) {
            for (OnUpdateListener onUpdateListener : mOnUpdateListeners) {
                onUpdateListener.onCancel();
            }
        }
        end();
    }

    public interface OnUpdateListener {
        void onUpdate(RectF currentRect, float progress);

        void onCancel();
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -134,10 +134,6 @@ public class StaggeredWorkspaceAnim {
     * @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 @@ public class StaggeredWorkspaceAnim {
        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);
+2 −3
Original line number Diff line number Diff line
@@ -656,8 +656,7 @@ public class FloatingIconView extends View implements
        canvas.restoreToCount(count);
    }

    public void onListenerViewClosed() {
        // Fast finish here.
    public void fastFinish() {
        if (mEndRunnable != null) {
            mEndRunnable.run();
            mEndRunnable = null;
@@ -757,7 +756,7 @@ public class FloatingIconView extends View implements
        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;