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

Commit 4a206837 authored by Alex Chau's avatar Alex Chau
Browse files

Enable adjacent task animation for grid

- Enable adjacent task animation for grid tasks
- Only parallax for focused task and only when it's fully visible

Bug: 236963497
Test: manual
Change-Id: I6c681e112f3eb2c7075bc98fab405d978f5057d1
parent afff9362
Loading
Loading
Loading
Loading
+2 −8
Original line number Original line Diff line number Diff line
@@ -43,7 +43,6 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD
import android.animation.Animator;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.app.PendingIntent;
@@ -198,8 +197,7 @@ public final class TaskViewUtils {
        BaseActivity baseActivity = BaseActivity.fromContext(context);
        BaseActivity baseActivity = BaseActivity.fromContext(context);
        DeviceProfile dp = baseActivity.getDeviceProfile();
        DeviceProfile dp = baseActivity.getDeviceProfile();
        boolean showAsGrid = dp.isTablet;
        boolean showAsGrid = dp.isTablet;
        boolean parallaxCenterAndAdjacentTask =
        boolean parallaxCenterAndAdjacentTask = taskIndex != recentsView.getCurrentPage();
                taskIndex != recentsView.getCurrentPage() && !showAsGrid;
        int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex);
        int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex);
        int taskRectTranslationSecondary = showAsGrid ? (int) v.getGridTranslationY() : 0;
        int taskRectTranslationSecondary = showAsGrid ? (int) v.getGridTranslationY() : 0;


@@ -603,11 +601,7 @@ public final class TaskViewUtils {
            if (raController != null) {
            if (raController != null) {
                raController.setWillFinishToHome(false);
                raController.setWillFinishToHome(false);
            }
            }
            Context context = v.getContext();
            launcherAnim = recentsView.createAdjacentPageAnimForTaskLaunch(taskView);
            DeviceProfile dp = BaseActivity.fromContext(context).getDeviceProfile();
            launcherAnim = dp.isTablet
                    ? ObjectAnimator.ofFloat(recentsView, RecentsView.CONTENT_ALPHA, 0)
                    : recentsView.createAdjacentPageAnimForTaskLaunch(taskView);
            launcherAnim.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR);
            launcherAnim.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR);
            launcherAnim.setDuration(RECENTS_LAUNCH_DURATION);
            launcherAnim.setDuration(RECENTS_LAUNCH_DURATION);


+11 −9
Original line number Original line Diff line number Diff line
@@ -4317,25 +4317,27 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T


        int taskIndex = indexOfChild(tv);
        int taskIndex = indexOfChild(tv);
        int centerTaskIndex = getCurrentPage();
        int centerTaskIndex = getCurrentPage();
        boolean launchingCenterTask = taskIndex == centerTaskIndex;


        float toScale = getMaxScaleForFullScreen();
        float toScale = getMaxScaleForFullScreen();
        RecentsView recentsView = tv.getRecentsView();
        boolean showAsGrid = showAsGrid();
        boolean launchingCenterTask = showAsGrid
                ? tv.isFocusedTask() && isTaskViewFullyVisible(tv)
                : taskIndex == centerTaskIndex;
        if (launchingCenterTask) {
        if (launchingCenterTask) {
            anim.play(ObjectAnimator.ofFloat(recentsView, RECENTS_SCALE_PROPERTY, toScale));
            anim.play(ObjectAnimator.ofFloat(this, RECENTS_SCALE_PROPERTY, toScale));
            anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1));
            anim.play(ObjectAnimator.ofFloat(this, FULLSCREEN_PROGRESS, 1));
        } else {
        } else if (!showAsGrid) {
            // We are launching an adjacent task, so parallax the center and other adjacent task.
            // We are launching an adjacent task, so parallax the center and other adjacent task.
            float displacementX = tv.getWidth() * (toScale - 1f);
            float displacementX = tv.getWidth() * (toScale - 1f);
            float primaryTranslation = mIsRtl ? -displacementX : displacementX;
            float primaryTranslation = mIsRtl ? -displacementX : displacementX;
            anim.play(ObjectAnimator.ofFloat(getPageAt(centerTaskIndex),
            anim.play(ObjectAnimator.ofFloat(getPageAt(centerTaskIndex),
                    mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation));
                    mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation));
            int runningTaskIndex = recentsView.getRunningTaskIndex();
            int runningTaskIndex = getRunningTaskIndex();
            if (ENABLE_QUICKSTEP_LIVE_TILE.get()
            if (ENABLE_QUICKSTEP_LIVE_TILE.get()
                    && runningTaskIndex != -1
                    && runningTaskIndex != -1
                    && runningTaskIndex != taskIndex
                    && runningTaskIndex != taskIndex
                    && recentsView.getRemoteTargetHandles() != null) {
                    && getRemoteTargetHandles() != null) {
                for (RemoteTargetHandle remoteHandle : recentsView.getRemoteTargetHandles()) {
                for (RemoteTargetHandle remoteHandle : getRemoteTargetHandles()) {
                    anim.play(ObjectAnimator.ofFloat(
                    anim.play(ObjectAnimator.ofFloat(
                            remoteHandle.getTaskViewSimulator().taskPrimaryTranslation,
                            remoteHandle.getTaskViewSimulator().taskPrimaryTranslation,
                            AnimatedFloat.VALUE,
                            AnimatedFloat.VALUE,
@@ -4355,7 +4357,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                        properties));
                        properties));
            }
            }
        }
        }
        anim.play(ObjectAnimator.ofFloat(recentsView, TASK_THUMBNAIL_SPLASH_ALPHA, 0, 1));
        anim.play(ObjectAnimator.ofFloat(this, TASK_THUMBNAIL_SPLASH_ALPHA, 0, 1));
        return anim;
        return anim;
    }
    }