From 8949c583eeef8ae2c5e896413613b773ae2791af Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 7 Oct 2022 12:31:20 +0100 Subject: [PATCH] Fix positioning of split instruction and share targets with taskbar in overview - When taskbar is in overview, overview actions has dedicated space and no need to align to nav buttons - Add a bottom margin to split instruction and share targetse that is equal to the space below overview actions Bug: 245320601 Test: Test split select and share target with different screen sizes Change-Id: I6aec325da9cc4c43c84ba8bed5f0e087c57d6925 --- .../android/quickstep/views/OverviewActionsView.java | 8 ++++++-- .../quickstep/views/SplitInstructionsView.java | 5 ++++- src/com/android/launcher3/DeviceProfile.java | 4 +++- .../launcher3/touch/PortraitPagedViewHandler.java | 11 +++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java index abace7cd7d..514d5b98bf 100644 --- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java @@ -31,6 +31,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.R; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; @@ -258,7 +259,9 @@ public class OverviewActionsView extends FrameLayo // If in 3-button mode, shift action buttons to accommodate 3-button layout. // (Special exception for landscape tablets, where there is enough room and we don't need to // shift the action buttons.) - if (mDp.areNavButtonsInline && !largeScreenLandscape) { + if (mDp.areNavButtonsInline && !largeScreenLandscape + // If taskbar is in overview, overview action has dedicated space above nav buttons + && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) { // Add extra horizontal spacing int additionalPadding = mDp.hotseatBarEndOffset; if (isLayoutRtl()) { @@ -288,7 +291,8 @@ public class OverviewActionsView extends FrameLayo return 0; } - if (!mDp.isGestureMode && mDp.isTaskbarPresent) { + if (!mDp.isGestureMode && mDp.isTaskbarPresent + && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) { return mDp.getOverviewActionsClaimedSpaceBelow(); } diff --git a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java index 27ec01a640..fae96dc49c 100644 --- a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java +++ b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java @@ -29,6 +29,7 @@ import androidx.appcompat.widget.AppCompatTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.util.DisplayController; @@ -114,7 +115,9 @@ public class SplitInstructionsView extends FrameLayout { int getThreeButtonNavShift() { DeviceProfile dp = mLauncher.getDeviceProfile(); if ((DisplayController.getNavigationMode(getContext()) == THREE_BUTTONS) - && ((dp.isTwoPanels) || (dp.isTablet && !dp.isLandscape))) { + && ((dp.isTwoPanels) || (dp.isTablet && !dp.isLandscape)) + // If taskbar is in overview, overview action has dedicated space above nav buttons + && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) { int navButtonWidth = getResources().getDimensionPixelSize( R.dimen.taskbar_nav_buttons_size); int extraMargin = getResources().getDimensionPixelSize( diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 9a1bba97ce..7881a261ad 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -1272,7 +1272,9 @@ public class DeviceProfile { * Returns the number of pixels required below OverviewActions excluding insets. */ public int getOverviewActionsClaimedSpaceBelow() { - if (isTaskbarPresent && !isGestureMode) { + if (isTaskbarPresent && !isGestureMode + // If taskbar is in overview, overview action has dedicated space above nav buttons + && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) { // Align vertically to where nav buttons are. return ((taskbarSize - overviewActionsHeight) / 2) + getTaskbarOffsetY(); } diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index bc1b6345b4..fc3350d09b 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -50,6 +50,7 @@ import android.widget.LinearLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions.SplitBounds; @@ -524,7 +525,9 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { out.setRotation(getDegreesRotated()); int distanceToEdge; if ((DisplayController.getNavigationMode(out.getContext()) == THREE_BUTTONS) - && (dp.isTwoPanels || dp.isTablet)) { + && (dp.isTwoPanels || dp.isTablet) + // If taskbar is in overview, overview action has dedicated space above nav buttons + && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) { // If 3-button nav is active, align the splitInstructionsView with it. distanceToEdge = dp.getTaskbarOffsetY() + ((dp.taskbarSize - splitInstructionsHeight) / 2); @@ -561,8 +564,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { int insetCorrectionX = (dp.getInsets().right - dp.getInsets().left) / 2; // Adjust for any insets on the bottom edge int insetCorrectionY = dp.getInsets().bottom; + // Adjust for taskbar in overview + int taskbarCorrectionY = + dp.isTaskbarPresent && FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get() + ? dp.taskbarSize : 0; out.setTranslationX(insetCorrectionX + threeButtonNavShift); - out.setTranslationY(-distanceToEdge + insetCorrectionY); + out.setTranslationY(-distanceToEdge + insetCorrectionY - taskbarCorrectionY); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) out.getLayoutParams(); lp.gravity = CENTER_HORIZONTAL | BOTTOM; out.setLayoutParams(lp);