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

Commit a0a8ae46 authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Fixing regression in drag view

- We should be removing the dragged task view after it is dropped on a
  drag target
- Also fixing issue with ViewPropertyAnimator listeners not being reset
  causing callbacks to be called in later animations

Change-Id: Ib9815d77f4e427c575f5a77fa58ea5a22f39f10f
parent fb5e1fd0
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -470,6 +470,25 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        if (event.dropTarget instanceof TaskStack.DockState) {
            final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;

            // Remove the task after it is docked
            if (event.taskView.isFocusedTask()) {
                mTaskStackView.resetFocusedTask();
            }
            event.taskView.animate()
                    .alpha(0f)
                    .setDuration(150)
                    .setInterpolator(mFastOutLinearInInterpolator)
                    .setUpdateListener(null)
                    .setListener(null)
                    .withEndAction(new Runnable() {
                        @Override
                        public void run() {
                            mTaskStackView.getStack().removeTask(event.task);
                        }
                    })
                    .withLayer()
                    .start();

            // Dock the task and launch it
            SystemServicesProxy ssp = Recents.getSystemServices();
            ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode);
+17 −3
Original line number Diff line number Diff line
@@ -1559,7 +1559,13 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        int taskViewCount = taskViews.size();
        for (int i = taskViewCount - 1; i >= 0; i--) {
            TaskView tv = taskViews.get(i);
            tv.animate().alpha(0f).setDuration(200).start();
            tv.animate()
                    .alpha(0f)
                    .setDuration(200)
                    .setUpdateListener(null)
                    .setListener(null)
                    .withLayer()
                    .start();
        }
    }

@@ -1568,7 +1574,13 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        int taskViewCount = taskViews.size();
        for (int i = taskViewCount - 1; i >= 0; i--) {
            TaskView tv = taskViews.get(i);
            tv.animate().alpha(1f).setDuration(200).start();
            tv.animate()
                    .alpha(1f)
                    .setDuration(200)
                    .setUpdateListener(null)
                    .setListener(null)
                    .withLayer()
                    .start();
        }
    }

@@ -1580,7 +1592,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        Task task = tv.getTask();

        // Reset the previously focused task before it is removed from the stack
        if (tv.isFocusedTask()) {
            resetFocusedTask();
        }

        // Announce for accessibility
        tv.announceForAccessibility(getContext().getString(
+5 −0
Original line number Diff line number Diff line
@@ -395,6 +395,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
                .translationY(ctx.offscreenTranslationY)
                .setStartDelay(0)
                .setUpdateListener(null)
                .setListener(null)
                .setInterpolator(mFastOutLinearInInterpolator)
                .setDuration(taskViewExitToHomeDuration)
                .withEndAction(ctx.postAnimationTrigger.decrementAsRunnable())
@@ -443,6 +444,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
                    .translationY(getTranslationY() + taskViewAffiliateGroupEnterOffset)
                    .setStartDelay(0)
                    .setUpdateListener(null)
                    .setListener(null)
                    .setInterpolator(mFastOutLinearInInterpolator)
                    .setDuration(taskViewExitToAppDuration)
                    .start();
@@ -464,6 +466,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
            .alpha(0f)
            .setStartDelay(delay)
            .setUpdateListener(null)
            .setListener(null)
            .setInterpolator(mFastOutSlowInInterpolator)
            .setDuration(taskViewRemoveAnimDuration)
            .withEndAction(new Runnable() {
@@ -728,6 +731,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
                    .scaleX(finalScale)
                    .scaleY(finalScale)
                    .setDuration(175)
                    .setUpdateListener(null)
                    .setListener(null)
                    .setInterpolator(mFastOutSlowInInterpolator)
                    .start();

+1 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ public class TaskViewTransform {
            } else {
                anim.setUpdateListener(null);
            }
            anim.setListener(null);
            anim.setStartDelay(startDelay)
                    .setDuration(duration)
                    .setInterpolator(interp)