Adjust height of tablet AllApps base on row height
- Also used hotseatQsbHeight for AllApps QSB height as they have to match to transform between each other
Fix: 232907846
Test: manual on different tablets
Test: atest DeviceProfileTest
Change-Id: I001d0e129db2a5de6c8ace4c3302381110da03f1
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 05ed319..bf492a9 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -47,7 +47,6 @@
private Consumer<Boolean> mOnVisibilityAggregatedCallback;
private final View mQsb;
- private final int mQsbHeight;
public Hotseat(Context context) {
this(context, null);
@@ -62,8 +61,6 @@
mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
addView(mQsb);
-
- mQsbHeight = getResources().getDimensionPixelSize(R.dimen.qsb_widget_height);
}
/**
@@ -171,29 +168,29 @@
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- int qsbWidth = mActivity.getDeviceProfile().qsbWidth;
-
- mQsb.measure(MeasureSpec.makeMeasureSpec(qsbWidth, MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(mQsbHeight, MeasureSpec.EXACTLY));
+ DeviceProfile dp = mActivity.getDeviceProfile();
+ mQsb.measure(MeasureSpec.makeMeasureSpec(dp.hotseatQsbWidth, MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(dp.hotseatQsbHeight, MeasureSpec.EXACTLY));
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
- int qsbWidth = mQsb.getMeasuredWidth();
+ int qsbMeasuredWidth = mQsb.getMeasuredWidth();
int left;
- if (mActivity.getDeviceProfile().isQsbInline) {
- int qsbSpace = mActivity.getDeviceProfile().hotseatBorderSpace;
+ DeviceProfile dp = mActivity.getDeviceProfile();
+ if (dp.isQsbInline) {
+ int qsbSpace = dp.hotseatBorderSpace;
left = Utilities.isRtl(getResources()) ? r - getPaddingRight() + qsbSpace
- : l + getPaddingLeft() - qsbWidth - qsbSpace;
+ : l + getPaddingLeft() - qsbMeasuredWidth - qsbSpace;
} else {
- left = (r - l - qsbWidth) / 2;
+ left = (r - l - qsbMeasuredWidth) / 2;
}
- int right = left + qsbWidth;
+ int right = left + qsbMeasuredWidth;
- int bottom = b - t - mActivity.getDeviceProfile().getQsbOffsetY();
- int top = bottom - mQsbHeight;
+ int bottom = b - t - dp.getQsbOffsetY();
+ int top = bottom - dp.hotseatQsbHeight;
mQsb.layout(left, top, right, bottom);
}