Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a606d344 authored by Steven Ng's avatar Steven Ng
Browse files

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
parent c3f56d76
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -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;