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

Commit 1b27affb authored by Pat Manning's avatar Pat Manning Committed by Android (Google) Code Review
Browse files

Merge "Animate grid tasks to modal state." into tm-qpr-dev

parents 85f734b5 550181e6
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -18,12 +18,12 @@ package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;

import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.views.RecentsView;

/**
@@ -70,13 +70,22 @@ public class OverviewModalTaskState extends OverviewState {
        }
    }

    @Override
    public boolean isTaskbarStashed(Launcher launcher) {
        if (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) {
            return true;
        }
        return super.isTaskbarStashed(launcher);
    }

    public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
        Point taskSize = activity.<RecentsView>getOverviewPanel().getSelectedTaskSize();
        RecentsView recentsView = activity.<RecentsView>getOverviewPanel();
        Rect taskSize = recentsView.getSelectedTaskBounds();
        Rect modalTaskSize = new Rect();
        activity.<RecentsView>getOverviewPanel().getModalTaskSize(modalTaskSize);
        recentsView.getModalTaskSize(modalTaskSize);

        float scale = Math.min((float) modalTaskSize.height() / taskSize.y,
                (float) modalTaskSize.width() / taskSize.x);
        float scale = Math.min((float) modalTaskSize.height() / taskSize.height(),
                (float) modalTaskSize.width() / taskSize.width());

        return new float[] {scale, NO_OFFSET};
    }
+13 −3
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statehandlers.DesktopVisibilityController;
import com.android.launcher3.statemanager.BaseState;
@@ -339,12 +340,21 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
     */
    public final void calculateModalTaskSize(Context context, DeviceProfile dp, Rect outRect) {
        calculateTaskSize(context, dp, outRect);
        boolean isGridOnlyOverview = dp.isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get();
        int claimedSpaceBelow = isGridOnlyOverview
                ? dp.overviewActionsTopMarginPx + dp.overviewActionsHeight + dp.stashedTaskbarSize
                : (dp.heightPx - outRect.bottom - dp.getInsets().bottom);
        int minimumHorizontalPadding = 0;
        if (!isGridOnlyOverview) {
            float maxScale = context.getResources().getFloat(R.dimen.overview_modal_max_scale);
            minimumHorizontalPadding =
                    Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2);
        }
        calculateTaskSizeInternal(
                context, dp,
                dp.overviewTaskMarginPx,
                dp.heightPx - outRect.bottom - dp.getInsets().bottom,
                Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2),
                claimedSpaceBelow,
                minimumHorizontalPadding,
                1f /*maxScale*/,
                Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM,
                outRect);
+2 −2
Original line number Diff line number Diff line
@@ -80,9 +80,9 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
        boolean isInLandscape = orientedState.getTouchRotation() != ROTATION_0;
        boolean isTablet = activity.getDeviceProfile().isTablet;

        boolean isGridOnlyOverview = isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get();
        // Add overview actions to the menu when in in-place rotate landscape mode.
        if ((!canLauncherRotate && isInLandscape)
                || (isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get())) {
        if ((!canLauncherRotate && isInLandscape) || isGridOnlyOverview) {
            // Add screenshot action to task menu.
            List<SystemShortcut> screenshotShortcuts = TaskShortcutFactory.SCREENSHOT
                    .getShortcuts(activity, taskContainer);
+5 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.quickstep.fallback;

import static android.app.ActivityTaskManager.INVALID_TASK_ID;

import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
import static com.android.quickstep.fallback.RecentsState.DEFAULT;
import static com.android.quickstep.fallback.RecentsState.HOME;
@@ -200,8 +202,9 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
    }

    @Override
    public void setModalStateEnabled(boolean isModalState, boolean animate) {
        if (isModalState) {
    public void setModalStateEnabled(int taskId, boolean animate) {
        if (taskId != INVALID_TASK_ID) {
            setSelectedTask(taskId);
            mActivity.getStateManager().goToState(RecentsState.MODAL_TASK, animate);
        } else {
            if (mActivity.isInState(RecentsState.MODAL_TASK)) {
+5 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.quickstep.views;

import static android.app.ActivityTaskManager.INVALID_TASK_ID;

import static com.android.launcher3.LauncherState.CLEAR_ALL_BUTTON;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
@@ -171,8 +173,9 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
    }

    @Override
    public void setModalStateEnabled(boolean isModalState, boolean animate) {
        if (isModalState) {
    public void setModalStateEnabled(int taskId, boolean animate) {
        if (taskId != INVALID_TASK_ID) {
            setSelectedTask(taskId);
            mActivity.getStateManager().goToState(LauncherState.OVERVIEW_MODAL_TASK, animate);
        } else {
            if (mActivity.isInState(LauncherState.OVERVIEW_MODAL_TASK)) {
Loading