From 19c6eca5c5fe6174fa1f91c3c7a7f693746d909c Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 10 Mar 2022 20:12:56 +0000 Subject: [PATCH] Use overview_actions_height from Resources to calculate OverviewActionsView alignment - startActionView.getHeight() isn't ready when updatePaddingAndTranslations is called, so use overview_actions_height from Resources through DeviceProfile instead. Fix: 218442870 Test: Restart launcher, go to overveiw from app, rotate and rotate back, overview actions stays in same position Change-Id: Ia5e234f73100a2f418c17222145a8f993cbfab8a --- .../src/com/android/quickstep/BaseActivityInterface.java | 3 +-- .../com/android/quickstep/views/OverviewActionsView.java | 6 ++---- res/values/dimens.xml | 1 + src/com/android/launcher3/DeviceProfile.java | 2 ++ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 6584f88ebb..9686510638 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -362,10 +362,9 @@ public abstract class BaseActivityInterface extends FrameLayo // Align vertically, using taskbar height + mDp.taskbarOffsetY() to estimate where // the button nav top is. - View startActionView = findViewById(R.id.action_screenshot); int marginBottom = getOverviewActionsBottomMarginPx( DisplayController.getNavigationMode(getContext()), mDp); int actionsTop = - (mDp.heightPx - marginBottom - mInsets.bottom) - startActionView.getHeight(); + (mDp.heightPx - marginBottom - mInsets.bottom) - mDp.overviewActionsHeight; int navTop = mDp.heightPx - (mDp.taskbarSize + mDp.getTaskbarOffsetY()); - int transY = navTop - actionsTop - + ((mDp.taskbarSize - startActionView.getHeight()) / 2); + int transY = navTop - actionsTop + ((mDp.taskbarSize - mDp.overviewActionsHeight) / 2); setTranslationY(transY); } else { setPadding(mInsets.left, 0, mInsets.right, 0); diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 3e666fcf2e..2b599bc959 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -345,6 +345,7 @@ 0dp 0dp 0dp + 0dp 0dp 0dp 0dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 1b333d88ff..39020bde12 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -191,6 +191,7 @@ public class DeviceProfile { public int overviewTaskIconDrawableSizePx; public int overviewTaskIconDrawableSizeGridPx; public int overviewTaskThumbnailTopMarginPx; + public final int overviewActionsHeight; public final int overviewActionsMarginThreeButtonPx; public final int overviewActionsTopMarginGesturePx; public final int overviewActionsBottomMarginGesturePx; @@ -407,6 +408,7 @@ public class DeviceProfile { overviewPageSpacing = res.getDimensionPixelSize(R.dimen.overview_page_spacing); overviewActionsButtonSpacing = res.getDimensionPixelSize( R.dimen.overview_actions_button_spacing); + overviewActionsHeight = res.getDimensionPixelSize(R.dimen.overview_actions_height); overviewActionsMarginThreeButtonPx = res.getDimensionPixelSize( R.dimen.overview_actions_margin_three_button); // Grid task's top margin is only overviewTaskIconSizePx + overviewTaskMarginGridPx, but