From 4ecef9aae664ec5e98a66ace68706e3847847395 Mon Sep 17 00:00:00 2001 From: helencheuk Date: Mon, 12 Jun 2023 14:10:21 +0100 Subject: [PATCH] Align ClearAllButton to centre when the ENABLE_GRID_ONLY_OVERVIEW is enabled Bug: 271570406 Flag: ENABLE_GRID_ONLY_OVERVIEW Test: Test postponed due to b/288389556 Change-Id: Ifab0705a45cfea45199ed0db69ef7ad20f935023 --- .../android/quickstep/views/ClearAllButton.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/ClearAllButton.java b/quickstep/src/com/android/quickstep/views/ClearAllButton.java index 6813857ba9..19ac1f8eda 100644 --- a/quickstep/src/com/android/quickstep/views/ClearAllButton.java +++ b/quickstep/src/com/android/quickstep/views/ClearAllButton.java @@ -16,6 +16,8 @@ package com.android.quickstep.views; +import static com.android.launcher3.config.FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW; + import android.content.Context; import android.util.AttributeSet; import android.util.FloatProperty; @@ -248,8 +250,15 @@ public class ClearAllButton extends Button { */ private float getOriginalTranslationY() { DeviceProfile deviceProfile = mActivity.getDeviceProfile(); - return deviceProfile.isTablet - ? deviceProfile.overviewRowSpacing - : deviceProfile.overviewTaskThumbnailTopMarginPx / 2.0f; + if (deviceProfile.isTablet) { + if (ENABLE_GRID_ONLY_OVERVIEW.get()) { + return (getRecentsView().getLastComputedTaskSize().height() + + deviceProfile.overviewTaskThumbnailTopMarginPx) / 2.0f + + deviceProfile.overviewRowSpacing; + } else { + return deviceProfile.overviewRowSpacing; + } + } + return deviceProfile.overviewTaskThumbnailTopMarginPx / 2.0f; } }