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

Commit d36795ea authored by Winson Chung's avatar Winson Chung Committed by Android Git Automerger
Browse files

am a6335dad: Merge "Adding fallback transition for animating in/out of...

am a6335dad: Merge "Adding fallback transition for animating in/out of affiliate groups." into lmp-dev

* commit 'a6335dad8ba470bb142b7270e2fe3786e3cd67c0':
  Adding fallback transition for animating in/out of affiliate groups.
parents 7d8e9af2 475f15fb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -213,6 +213,9 @@
    <!-- The height of the lock-to-app button. -->
    <dimen name="recents_task_view_lock_to_app_button_height">48dp</dimen>

    <!-- The amount to offset when animating into an affiliate group. -->
    <dimen name="recents_task_view_affiliate_group_enter_offset">64dp</dimen>

    <!-- The height of a task view bar. -->
    <dimen name="recents_task_bar_height">56dp</dimen>

+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class RecentsConfiguration {
    public int taskViewTranslationZIncrementPx;
    public int taskViewRoundedCornerRadiusPx;
    public int taskViewHighlightPx;
    public int taskViewAffiliateGroupEnterOffsetPx;

    /** Task bar colors */
    public int taskBarViewDefaultBackgroundColor;
@@ -210,6 +211,8 @@ public class RecentsConfiguration {
        taskViewTranslationZMinPx = res.getDimensionPixelSize(R.dimen.recents_task_view_z_min);
        taskViewTranslationZIncrementPx =
                res.getDimensionPixelSize(R.dimen.recents_task_view_z_increment);
        taskViewAffiliateGroupEnterOffsetPx =
                res.getDimensionPixelSize(R.dimen.recents_task_view_affiliate_group_enter_offset);

        // Task bar colors
        taskBarViewDefaultBackgroundColor =
+12 −0
Original line number Diff line number Diff line
@@ -53,6 +53,18 @@ public class TaskGrouping {
        return mTaskKeyIndices.get(t.key);
    }

    /** Returns whether a task is in this grouping. */
    public boolean containsTask(Task t) {
        return mTaskKeyIndices.containsKey(t.key);
    }

    /** Returns whether one task is above another in the group.  If they are not in the same group,
     * this returns false. */
    public boolean isTaskAboveTask(Task t, Task below) {
        return mTaskKeyIndices.containsKey(t.key) && mTaskKeyIndices.containsKey(below.key) &&
                mTaskKeyIndices.get(t.key) > mTaskKeyIndices.get(below.key);
    }

    /** Returns the number of tasks in this group. */
    public int getTaskCount() { return mTaskKeys.size(); }

+1 −1
Original line number Diff line number Diff line
@@ -449,7 +449,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        if (tv == null) {
            post(launchRunnable);
        } else {
            stackView.animateOnLaunchingTask(tv, launchRunnable);
            stackView.startLaunchTaskAnimation(tv, launchRunnable);
        }
    }

+54 −22
Original line number Diff line number Diff line
@@ -495,20 +495,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        }
    }

    /** Animates a task view in this stack as it launches. */
    public void animateOnLaunchingTask(TaskView tv, final Runnable r) {
        // Hide each of the task bar dismiss buttons
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            TaskView t = (TaskView) getChildAt(i);
            if (t == tv) {
                t.startLaunchTaskAnimation(r, true);
            } else {
                t.startLaunchTaskAnimation(null, false);
            }
        }
    }

    /** Focuses the task at the specified index in the stack */
    void focusTask(int taskIndex, boolean scrollToNewPosition) {
        if (0 <= taskIndex && taskIndex < mStack.getTaskCount()) {
@@ -664,13 +650,28 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal

    /** Handler for the first layout. */
    void onFirstLayout() {
        // Prepare the first view for its enter animation
        int offscreenY = mStackAlgorithm.mViewRect.bottom -
                (mStackAlgorithm.mTaskRect.top - mStackAlgorithm.mViewRect.top);

        // Find the launch target task
        Task launchTargetTask = null;
        int childCount = getChildCount();
        for (int i = childCount - 1; i >= 0; i--) {
            TaskView tv = (TaskView) getChildAt(i);
            tv.prepareEnterRecentsAnimation(tv.getTask().isLaunchTarget, offscreenY);
            Task task = tv.getTask();
            if (task.isLaunchTarget) {
                launchTargetTask = task;
                break;
            }
        }

        // Prepare the first view for its enter animation
        for (int i = childCount - 1; i >= 0; i--) {
            TaskView tv = (TaskView) getChildAt(i);
            Task task = tv.getTask();
            boolean occludesLaunchTarget = (launchTargetTask != null) &&
                    launchTargetTask.group.isTaskAboveTask(task, launchTargetTask);
            tv.prepareEnterRecentsAnimation(task.isLaunchTarget, occludesLaunchTarget, offscreenY);
        }

        // If the enter animation started already and we haven't completed a layout yet, do the
@@ -698,8 +699,19 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        }

        if (mStack.getTaskCount() > 0) {
            // Animate all the task views into view
            // Find the launch target task
            Task launchTargetTask = null;
            int childCount = getChildCount();
            for (int i = childCount - 1; i >= 0; i--) {
                TaskView tv = (TaskView) getChildAt(i);
                Task task = tv.getTask();
                if (task.isLaunchTarget) {
                    launchTargetTask = task;
                    break;
                }
            }

            // Animate all the task views into view
            for (int i = childCount - 1; i >= 0; i--) {
                TaskView tv = (TaskView) getChildAt(i);
                Task task = tv.getTask();
@@ -707,6 +719,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
                ctx.currentStackViewIndex = i;
                ctx.currentStackViewCount = childCount;
                ctx.currentTaskRect = mStackAlgorithm.mTaskRect;
                ctx.currentTaskOccludesLaunchTarget = (launchTargetTask != null) &&
                        launchTargetTask.group.isTaskAboveTask(task, launchTargetTask);
                mStackAlgorithm.getStackTransform(task, getStackScroll(), ctx.currentTaskTransform);
                tv.startEnterRecentsAnimation(ctx);
            }
@@ -717,11 +731,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
                public void run() {
                    // Start dozing
                    mUIDozeTrigger.startDozing();
                    // Request an update of the task views after the animation in to 
                    // relayout the fullscreen view back to its normal size
                    if (mConfig.launchedFromAppWithScreenshot) {
                        requestSynchronizeStackViewsWithModel();
                    }
                }
            });
        }
@@ -742,6 +751,24 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        ctx.postAnimationTrigger.addLastDecrementRunnable(mReturnAllViewsToPoolRunnable);
    }

    /** Animates a task view in this stack as it launches. */
    public void startLaunchTaskAnimation(TaskView tv, final Runnable r) {
        Task launchTargetTask = tv.getTask();
        int offscreenTranslationY = mStackAlgorithm.mViewRect.bottom -
                (mStackAlgorithm.mTaskRect.top - mStackAlgorithm.mViewRect.top);
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            TaskView t = (TaskView) getChildAt(i);
            if (t == tv) {
                t.startLaunchTaskAnimation(r, true, true);
            } else {
                boolean occludesLaunchTarget = launchTargetTask.group.isTaskAboveTask(t.getTask(),
                        launchTargetTask);
                t.startLaunchTaskAnimation(null, false, occludesLaunchTarget);
            }
        }
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
@@ -988,6 +1015,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        invalidate(mStackAlgorithm.mStackRect);
    }

    @Override
    public void onTaskViewFullScreenTransitionCompleted() {
        requestSynchronizeStackViewsWithModel();
    }

    /**** RecentsPackageMonitor.PackageCallbacks Implementation ****/

    @Override
Loading