Make hotseat fit one line on tablets
When running on tablets in landscape, the QSB should inline with the hotseat icons. This does that and fixes small bugs that didn't account for the new hotseatBorderSpace.
Bug: 210118169
Test: atest Launcher3Tests:DeviceProfileTest
Test: visual, using HSV and Window
Change-Id: I5a89c5449bf59fde736618151eceaacca443ef67
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index ffe3816..cb0cc11 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -173,7 +173,10 @@
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- int width = getShortcutsAndWidgets().getMeasuredWidth();
+ int width = mActivity.getDeviceProfile().isQsbInline
+ ? mActivity.getDeviceProfile().qsbWidth
+ : getShortcutsAndWidgets().getMeasuredWidth();
+
mQsb.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(mQsbHeight, MeasureSpec.EXACTLY));
}
@@ -183,7 +186,13 @@
super.onLayout(changed, l, t, r, b);
int qsbWidth = mQsb.getMeasuredWidth();
- int left = (r - l - qsbWidth) / 2;
+ int left;
+ if (mActivity.getDeviceProfile().isQsbInline) {
+ int qsbSpace = mActivity.getDeviceProfile().hotseatBorderSpace;
+ left = l + getPaddingLeft() - qsbWidth - qsbSpace;
+ } else {
+ left = (r - l - qsbWidth) / 2;
+ }
int right = left + qsbWidth;
int bottom = b - t - mActivity.getDeviceProfile().getQsbOffsetY();