From 3edfa98ba7be61e17ab896ad53ecaf4204efd873 Mon Sep 17 00:00:00 2001 From: Steven Ng Date: Fri, 30 Jul 2021 13:15:26 +0100 Subject: [PATCH] Use the right content to estimate the span in WidgetsFullSheet Test: Manual Fix: 194784402 Change-Id: I150f4c7b5a0344caa2bea3f1502894cb0f32e208 --- .../android/launcher3/widget/picker/WidgetsFullSheet.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java index e36ea905bc..be83f9ac13 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java @@ -402,7 +402,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet private boolean updateMaxSpansPerRow() { if (getMeasuredWidth() == 0) return false; - int maxHorizontalSpans = computeMaxHorizontalSpans(mContent, + View content = mHasWorkProfile + ? mViewPager + : mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView; + int maxHorizontalSpans = computeMaxHorizontalSpans(content, mWidgetSheetContentHorizontalPadding); if (mMaxSpansPerRow != maxHorizontalSpans) { mMaxSpansPerRow = maxHorizontalSpans;