From 9afe1ea212bea9a9f148585c9c41352cdc16a385 Mon Sep 17 00:00:00 2001 From: Pratyush Date: Wed, 13 Oct 2021 11:13:27 +0000 Subject: [PATCH] Make hotseat bottom a launcher config The changes are required for the bottom placement of QSB on lily devices. This enables lily devices to tweak the required factors to adjust the placement of QSB Bug: 190080582 Bug: 184060190 Test: Tested the changes manually Change-Id: Ibd80db5d78a5792963407a0b03af7e4f40717e08 --- res/values/dimens.xml | 8 ++++++++ src/com/android/launcher3/DeviceProfile.java | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/res/values/dimens.xml b/res/values/dimens.xml index b1294b4c58..f57275672d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -32,6 +32,14 @@ 8dp 2dp + 0dp + + + + 0.325 + 0dp 34dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 0b60b32275..e29cd559ae 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -53,7 +53,7 @@ public class DeviceProfile { private static final int DEFAULT_DOT_SIZE = 100; // Ratio of empty space, qsb should take up to appear visually centered. - private static final float QSB_CENTER_FACTOR = .325f; + private final float mQsbCenterFactor; public final InvariantDeviceProfile inv; private final Info mInfo; @@ -255,7 +255,7 @@ public class DeviceProfile { aspectRatio = ((float) Math.max(widthPx, heightPx)) / Math.min(widthPx, heightPx); boolean isTallDevice = Float.compare(aspectRatio, TALL_DEVICE_ASPECT_RATIO_THRESHOLD) >= 0; - + mQsbCenterFactor = context.getResources().getFloat(R.dimen.qsb_center_factor); // Some more constants context = getContext(context, info, isVerticalBarLayout() ? Configuration.ORIENTATION_LANDSCAPE @@ -347,7 +347,8 @@ public class DeviceProfile { hotseatBarSizeExtraSpacePx = 0; hotseatBarTopPaddingPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding); - hotseatBarBottomPaddingPx = (isTallDevice ? 0 + hotseatBarBottomPaddingPx = (isTallDevice ? res.getDimensionPixelSize( + R.dimen.dynamic_grid_hotseat_bottom_tall_padding) : res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_non_tall_padding)) + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding); hotseatBarSidePaddingEndPx = @@ -931,8 +932,8 @@ public class DeviceProfile { // Note that taskbarSize = 0 unless isTaskbarPresent. return Math.min(qsbBottomMarginPx + taskbarSize, freeSpace); } else { - return (int) (freeSpace * QSB_CENTER_FACTOR) - + (isTaskbarPresent ? taskbarSize : mInsets.bottom); + return (int) (freeSpace * mQsbCenterFactor) + + (isTaskbarPresent ? taskbarSize : mInsets.bottom); } }