Measure WidgetsFullSheet before estimating the recommended table

size

Issue: The header view height was obtained before any measurement.

Test: On Pixel 5 4x5 gird with Photo widget shown in recommended
      table, make the device in landscape. Then open the full widgets
      picker. The widgets picker can be scrolled. Before this fix,
      scrolling is not possible.
Fix: 194172597
Change-Id: Ib30cf4b95d2ed23ff28f3d24e103f0e919b3a551
This commit is contained in:
Steven Ng 2021-07-22 16:08:15 +01:00
parent c3f56d7628
commit a606d344a6
1 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,8 @@
*/ */
package com.android.launcher3.widget.picker; package com.android.launcher3.widget.picker;
import static android.view.View.MeasureSpec.makeMeasureSpec;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_SEARCHED; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_SEARCHED;
import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL; import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL;
@ -519,7 +521,12 @@ public class WidgetsFullSheet extends BaseWidgetSheet
mNoWidgetsView.getText().length(), noWidgetsViewTextBounds); mNoWidgetsView.getText().length(), noWidgetsViewTextBounds);
noWidgetsViewHeight = noWidgetsViewTextBounds.height(); noWidgetsViewHeight = noWidgetsViewTextBounds.height();
} }
float maxTableHeight = (mActivityContext.getDeviceProfile().availableHeightPx doMeasure(
makeMeasureSpec(mActivityContext.getDeviceProfile().availableWidthPx,
MeasureSpec.EXACTLY),
makeMeasureSpec(mActivityContext.getDeviceProfile().availableHeightPx,
MeasureSpec.EXACTLY));
float maxTableHeight = (mContent.getMeasuredHeight()
- mTabsHeight - mViewPagerTopPadding - getHeaderViewHeight() - mTabsHeight - mViewPagerTopPadding - getHeaderViewHeight()
- noWidgetsViewHeight) * RECOMMENDATION_TABLE_HEIGHT_RATIO; - noWidgetsViewHeight) * RECOMMENDATION_TABLE_HEIGHT_RATIO;