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

Commit 7d121342 authored by Becky Qiu's avatar Becky Qiu
Browse files

[Overview Actions] Change actions view UI based on different nav modes.

1. Change the overview actions container to 66dp height.
2. For 3 button mode, container will have 8dp bottom margin.
3. For gesture mode, container will have 16dp bottom margin.
4. Action buttons and close button will always be in the center vertically.

Spec: https://docs.google.com/presentation/d/1gXWNdCRXvXuEhgDmE0TX2KYqCxIQBXVtWKdl4pKrno8/edit#slide=id.g840c32b190_3_6

Demo:
- 3 button: https://screenshot.googleplex.com/2Y3uMaJMi9E
- gesture: https://screenshot.googleplex.com/XzaKHpp5ke9
Test: tested for both modes and when switch between.
Bug: 155444592

Change-Id: If66d369df0218b7ee2abab8a3f345488bf223b16
parent 3141c99e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public class OverviewModalTaskState extends OverviewState {
        int taskHeight = out.height();

        float topMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
        float bottomMargin = res.getDimension(R.dimen.task_thumbnail_bottom_margin_with_actions);
        float bottomMargin = res.getDimension(R.dimen.overview_actions_top_margin);
        float newHeight = taskHeight + topMargin + bottomMargin;
        float scale = newHeight / taskHeight;

+18 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.R;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.TaskOverlayFactory.OverlayUICallbacks;

import java.lang.annotation.Retention;
@@ -141,4 +142,21 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
    public AlphaProperty getVisibilityAlpha() {
        return mMultiValueAlpha.getProperty(INDEX_VISIBILITY_ALPHA);
    }

    /** Updates vertical margins for different navigation mode. */
    public void updateVerticalMarginForNavModeChange(Mode mode) {
        int topMargin = getResources()
                .getDimensionPixelSize(R.dimen.overview_actions_top_margin);
        int bottomMargin = 0;
        if (mode == Mode.THREE_BUTTONS) {
            bottomMargin = getResources()
                    .getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_three_button);
        } else {
            bottomMargin = getResources()
                    .getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_gesture);
        }
        LayoutParams params = (LayoutParams) getLayoutParams();
        params.setMargins(
                params.leftMargin, topMargin, params.rightMargin, bottomMargin);
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -17,14 +17,16 @@
<resources>

    <dimen name="task_thumbnail_top_margin">24dp</dimen>
    <dimen name="task_thumbnail_bottom_margin_with_actions">44dp</dimen>
    <dimen name="task_thumbnail_half_top_margin">12dp</dimen>
    <dimen name="task_thumbnail_icon_size">48dp</dimen>
    <!-- For screens without rounded corners -->
    <dimen name="task_corner_radius_small">2dp</dimen>

    <!-- Overrideable in overlay that provides the Overview Actions. -->
    <dimen name="overview_actions_height">110dp</dimen>
    <dimen name="overview_actions_height">66dp</dimen>
    <dimen name="overview_actions_top_margin">44dp</dimen>
    <dimen name="overview_actions_bottom_margin_gesture">16dp</dimen>
    <dimen name="overview_actions_bottom_margin_three_button">8dp</dimen>
    <dimen name="overview_actions_horizontal_margin">16dp</dimen>

    <dimen name="recents_page_spacing">10dp</dimen>
+9 −1
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@ public abstract class BaseQuickstepLauncher extends Launcher
    @Override
    public void onNavigationModeChanged(Mode newMode) {
        getDragLayer().recreateControllers();
        if (mActionsView != null && isOverviewActionsEnabled()) {
            mActionsView.updateVerticalMarginForNavModeChange(newMode);
        }
    }

    @Override
@@ -167,11 +170,16 @@ public abstract class BaseQuickstepLauncher extends Launcher
        mActionsView = findViewById(R.id.overview_actions_view);
        ((RecentsView) getOverviewPanel()).init(mActionsView);

        if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(this)) {
        if (isOverviewActionsEnabled()) {
            // Overview is above all other launcher elements, including qsb, so move it to the top.
            getOverviewPanel().bringToFront();
            mActionsView.bringToFront();
            mActionsView.updateVerticalMarginForNavModeChange(SysUINavigationMode.getMode(this));
        }
    }

    private boolean isOverviewActionsEnabled() {
        return FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(this);
    }

    public <T extends OverviewActionsView> T getActionsView() {
+15 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.quickstep.util;

import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.quickstep.SysUINavigationMode.getMode;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import static com.android.quickstep.util.LayoutUtils.getDefaultSwipeHeight;

@@ -26,6 +27,7 @@ import android.graphics.Rect;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.quickstep.SysUINavigationMode.Mode;

/**
 * Utility class to wrap different layout behavior for Launcher and RecentsView
@@ -136,7 +138,19 @@ public abstract class WindowSizeStrategy {
                if (showOverviewActions(context)) {
                    //TODO: this needs to account for the swipe gesture height and accessibility
                    // UI when shown.
                    return res.getDimensionPixelSize(R.dimen.overview_actions_height);
                    float actionsBottomMargin = 0;
                    if (getMode(context) == Mode.THREE_BUTTONS) {
                        actionsBottomMargin = res.getDimensionPixelSize(
                                R.dimen.overview_actions_bottom_margin_three_button);
                    } else {
                        actionsBottomMargin = res.getDimensionPixelSize(
                                R.dimen.overview_actions_bottom_margin_gesture);
                    }
                    float actionsTopMargin = res.getDimensionPixelSize(
                            R.dimen.overview_actions_top_margin);
                    float actionsHeight = actionsTopMargin + actionsBottomMargin
                            + res.getDimensionPixelSize(R.dimen.overview_actions_height);
                    return actionsHeight;
                } else {
                    return getDefaultSwipeHeight(context, dp) + dp.workspacePageIndicatorHeight
                            + res.getDimensionPixelSize(