diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 4e868b0c1b..a7e7d3a436 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -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; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java index 0af1c0ed36..7201b02ce0 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java @@ -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 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); + } } diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index b06dc6b01d..5c306516c2 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -17,14 +17,16 @@ 24dp - 44dp 12dp 48dp 2dp - 110dp + 66dp + 44dp + 16dp + 8dp 16dp 10dp diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 10e3a28088..9d64d09cc8 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -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,13 +170,18 @@ 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 getActionsView() { return (T) mActionsView; } diff --git a/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java b/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java index 8bb0d7094e..81a19247ed 100644 --- a/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java +++ b/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java @@ -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(