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

Commit ba656ff8 authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Gerrit Code Review
Browse files

systemui: animate clear recents button on exit animation



Change-Id: Ic617f50400558be4ad92a4a5ea3ef441d2afde6a
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent f7286fb3
Loading
Loading
Loading
Loading
+24 −17
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.recents.views;

import android.app.ActivityOptions;
import android.app.TaskStackBuilder;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -35,7 +34,6 @@ import android.view.WindowInsets;
import android.widget.FrameLayout;
import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.misc.Utilities;
import com.android.systemui.recents.model.RecentsPackageMonitor;
@@ -218,6 +216,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV

    /** Requests all task stacks to start their exit-recents animation */
    public void startExitToHomeAnimation(ViewAnimation.TaskViewExitContext ctx) {
        // Hide clear recents button before return to home
        startHideClearRecentsButtonAnimation();

        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);
@@ -231,6 +232,25 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        mCb.onExitToHomeAnimationTriggered();
    }

    public void startHideClearRecentsButtonAnimation() {
        if (mClearRecents != null) {
            mClearRecents.animate()
                .alpha(0f)
                .setStartDelay(0)
                .setUpdateListener(null)
                .setInterpolator(mConfig.fastOutSlowInInterpolator)
                .setDuration(mConfig.taskViewRemoveAnimDuration)
                .withEndAction(new Runnable() {
                    @Override
                    public void run() {
                        mClearRecents.setVisibility(View.GONE);
                        mClearRecents.setAlpha(1f);
                    }
                })
                .start();
        }
    }

    /** Adds the search bar */
    public void setSearchBar(View searchBar) {
        // Create the search bar (and hide it if we have no recent tasks)
@@ -337,21 +357,8 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
                    return;
                }

                // Hide clear recents before dismiss all tasks
                mClearRecents.animate()
                    .alpha(0f)
                    .setStartDelay(0)
                    .setUpdateListener(null)
                    .setInterpolator(mConfig.fastOutSlowInInterpolator)
                    .setDuration(mConfig.taskViewRemoveAnimDuration)
                    .withEndAction(new Runnable() {
                        @Override
                        public void run() {
                            mClearRecents.setVisibility(View.GONE);
                            mClearRecents.setAlpha(1f);
                        }
                    })
                    .start();
                // Hide clear recents button before dismiss all tasks
                startHideClearRecentsButtonAnimation();

                dismissAllTasksAnimated();
            }