From 160ca4b8a23f543c9af9f77a5fe836823c7d04da Mon Sep 17 00:00:00 2001 From: Becky Qiu Date: Mon, 18 May 2020 14:18:03 -0700 Subject: [PATCH] [Overview Actions] UI update for Landscape. 1. When home screen rotation is allowed, we still have action buttons for landscape, but remove bottom margin to shrink the UI. 2. When home screen rotation is not allowed, we do in-place rotation for overview, where we won't show action buttons. Test: see demo video: https://drive.google.com/file/d/1G6ihv_DOykx1MLpFAQf3VJHq3D1HotnX/view?usp=sharing Bug: 153736749 Change-Id: Ia1c7ef8c245ac13bf50adf32ee5114f23e491e75 --- .../quickstep/LauncherActivityInterface.java | 14 ++++++++------ .../quickstep/views/OverviewActionsView.java | 19 +++++++++++++++---- .../android/quickstep/views/RecentsView.java | 4 +++- .../launcher3/BaseQuickstepLauncher.java | 4 ++-- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index 62eb235251..4801d71779 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -310,8 +310,8 @@ public final class LauncherActivityInterface extends @Override protected float getExtraSpace(Context context, DeviceProfile dp, PagedOrientationHandler orientationHandler) { - if (dp.isVerticalBarLayout() || - hideShelfInTwoButtonLandscape(context, orientationHandler)) { + if ((dp.isVerticalBarLayout() && !showOverviewActions(context)) + || hideShelfInTwoButtonLandscape(context, orientationHandler)) { return 0; } else { Resources res = context.getResources(); @@ -319,12 +319,14 @@ public final class LauncherActivityInterface extends //TODO: this needs to account for the swipe gesture height and accessibility // UI when shown. float actionsBottomMargin = 0; - if (getMode(context) == Mode.THREE_BUTTONS) { - actionsBottomMargin = res.getDimensionPixelSize( + if (!dp.isVerticalBarLayout()) { + if (getMode(context) == Mode.THREE_BUTTONS) { + actionsBottomMargin = res.getDimensionPixelSize( R.dimen.overview_actions_bottom_margin_three_button); - } else { - actionsBottomMargin = res.getDimensionPixelSize( + } else { + actionsBottomMargin = res.getDimensionPixelSize( R.dimen.overview_actions_bottom_margin_gesture); + } } float actionsHeight = actionsBottomMargin + res.getDimensionPixelSize(R.dimen.overview_actions_height); 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 83287c463a..08c3dc9c27 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 @@ -21,6 +21,7 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SHARE; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; +import android.content.res.Configuration; import android.util.AttributeSet; import android.util.Log; import android.view.View; @@ -33,6 +34,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; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.TaskOverlayFactory.OverlayUICallbacks; @@ -129,6 +131,12 @@ public class OverviewActionsView extends FrameLayo updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION, !removeShelfFromOverview(getContext())); } + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + updateVerticalMargin(SysUINavigationMode.getMode(getContext())); + } + public void updateHiddenFlags(@ActionsHiddenFlags int visibilityFlags, boolean enable) { if (enable) { mHiddenFlags |= visibilityFlags; @@ -152,10 +160,13 @@ public class OverviewActionsView extends FrameLayo return mMultiValueAlpha.getProperty(INDEX_FULLSCREEN_ALPHA); } - /** Updates vertical margins for different navigation mode. */ - public void updateVerticalMarginForNavModeChange(Mode mode) { - int bottomMargin = 0; - if (mode == Mode.THREE_BUTTONS) { + /** Updates vertical margins for different navigation mode or configuration changes. */ + public void updateVerticalMargin(Mode mode) { + int bottomMargin; + int orientation = getResources().getConfiguration().orientation; + if (orientation == Configuration.ORIENTATION_LANDSCAPE) { + bottomMargin = 0; + } else if (mode == Mode.THREE_BUTTONS) { bottomMargin = getResources() .getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_three_button); } else { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index f27bedb8d4..64d90cf4f7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -1627,8 +1627,10 @@ public abstract class RecentsView extends PagedView impl : View.LAYOUT_DIRECTION_RTL); mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated()); mActivity.getDragLayer().recreateControllers(); + boolean isInLandscape = touchRotation != 0 + || mOrientationState.getLauncherRotation() != ROTATION_0; mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, - touchRotation != 0 || mOrientationState.getLauncherRotation() != ROTATION_0); + !mOrientationState.canLauncherRotate() && isInLandscape); resetPaddingFromTaskSize(); requestLayout(); } diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 0968d8e4ad..48743070d8 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -93,7 +93,7 @@ public abstract class BaseQuickstepLauncher extends Launcher public void onNavigationModeChanged(Mode newMode) { getDragLayer().recreateControllers(); if (mActionsView != null && isOverviewActionsEnabled()) { - mActionsView.updateVerticalMarginForNavModeChange(newMode); + mActionsView.updateVerticalMargin(newMode); } } @@ -175,7 +175,7 @@ public abstract class BaseQuickstepLauncher extends Launcher // Overview is above all other launcher elements, including qsb, so move it to the top. getOverviewPanel().bringToFront(); mActionsView.bringToFront(); - mActionsView.updateVerticalMarginForNavModeChange(SysUINavigationMode.getMode(this)); + mActionsView.updateVerticalMargin(SysUINavigationMode.getMode(this)); } }