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
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 6584f88..9686510 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -362,10 +362,9 @@
/** Gets the space that the overview actions will take, including bottom margin. */
private int getOverviewActionsHeight(Context context, DeviceProfile dp) {
- Resources res = context.getResources();
return OverviewActionsView.getOverviewActionsBottomMarginPx(getNavigationMode(context), dp)
+ OverviewActionsView.getOverviewActionsTopMarginPx(getNavigationMode(context), dp)
- + res.getDimensionPixelSize(R.dimen.overview_actions_height);
+ + dp.overviewActionsHeight;
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index 0fa2b24..6b15807 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -216,14 +216,12 @@
// 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 3e666fc..2b599bc 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -345,6 +345,7 @@
<dimen name="task_thumbnail_icon_drawable_size_grid">0dp</dimen>
<dimen name="overview_task_margin">0dp</dimen>
<dimen name="overview_task_margin_grid">0dp</dimen>
+ <dimen name="overview_actions_height">0dp</dimen>
<dimen name="overview_actions_button_spacing">0dp</dimen>
<dimen name="overview_actions_margin_gesture">0dp</dimen>
<dimen name="overview_actions_top_margin_gesture">0dp</dimen>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 1b333d8..39020bd 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -191,6 +191,7 @@
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 @@
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