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: I0b2d19ee7651a02db0bfc1756fdc730b2d0fc3f3
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index bb06be8..8f263a6 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -35,6 +35,14 @@
<!-- Hotseat -->
<dimen name="dynamic_grid_hotseat_top_padding">8dp</dimen>
<dimen name="dynamic_grid_hotseat_bottom_padding">2dp</dimen>
+ <dimen name="dynamic_grid_hotseat_bottom_tall_padding">0dp</dimen>
+
+ <!-- Qsb -->
+ <!-- Used for adjusting the position of QSB when placed in hotseat. This is a ratio and a higher
+ number signifies that the QSB is close to the hotseat icons and a lower number signifies that
+ it is close to the bottom of the screen -->
+ <item name="qsb_center_factor" format="float" type="dimen">0.325</item>
+
<!-- Extra bottom padding for non-tall devices. -->
<dimen name="dynamic_grid_hotseat_bottom_non_tall_padding">0dp</dimen>
<dimen name="dynamic_grid_hotseat_extra_vertical_size">34dp</dimen>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index b7d0481..b503893 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -53,7 +53,7 @@
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;
@@ -253,7 +253,7 @@
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
@@ -339,7 +339,8 @@
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 =
@@ -918,7 +919,7 @@
if (isScalableGrid && qsbBottomMarginPx > mInsets.bottom) {
return Math.min(qsbBottomMarginPx, freeSpace);
} else {
- return (int) (freeSpace * QSB_CENTER_FACTOR)
+ return (int) (freeSpace * mQsbCenterFactor)
+ (isTaskbarPresent ? taskbarSize : mInsets.bottom);
}
}