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

Commit 72db6908 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Anchoring the front most task to make the dismiss animation more...

Merge "Anchoring the front most task to make the dismiss animation more stable. (Bug 16939699)" into lmp-dev
parents 82324ec6 78cc96af
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal

            // Scroll the view into position (just center it in the curve)
            if (scrollToNewPosition) {
                float newScroll = mLayoutAlgorithm.getStackScrollForTaskIndex(t) - 0.5f;
                float newScroll = mLayoutAlgorithm.getStackScrollForTask(t) - 0.5f;
                newScroll = mStackScroller.getBoundedStackScroll(newScroll);
                mStackScroller.animateScroll(mStackScroller.getStackScroll(), newScroll, postScrollRunnable);
            } else {
@@ -681,8 +681,28 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        // Notify the callback that we've removed the task and it can clean up after it
        mCb.onTaskViewDismissed(removedTask);

        // Get the stack scroll of the task to anchor to (since we are removing something, the front
        // most task will be our anchor task)
        Task anchorTask = null;
        float prevAnchorTaskScroll = 0;
        boolean pullStackForward = stack.getTaskCount() > 0;
        if (pullStackForward) {
            anchorTask = mStack.getFrontMostTask();
            prevAnchorTaskScroll = mLayoutAlgorithm.getStackScrollForTask(anchorTask);
        }

        // Update the min/max scroll and animate other task views into their new positions
        updateMinMaxScroll(true, mConfig.launchedWithAltTab, mConfig.launchedFromHome);

        // Offset the stack by as much as the anchor task would otherwise move back
        if (pullStackForward) {
            float anchorTaskScroll = mLayoutAlgorithm.getStackScrollForTask(anchorTask);
            mStackScroller.setStackScroll(mStackScroller.getStackScroll() + (anchorTaskScroll
                    - prevAnchorTaskScroll));
            mStackScroller.boundScroll();
        }

        // Animate all the tasks into place
        requestSynchronizeStackViewsWithModel(200);

        // Update the new front most task
+1 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ public class TaskStackViewLayoutAlgorithm {
    /**
     * Returns the scroll to such task top = 1f;
     */
    float getStackScrollForTaskIndex(Task t) {
    float getStackScrollForTask(Task t) {
        return mTaskProgressMap.get(t.key);
    }