diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java index bf1e8c2e98..5543256897 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java @@ -469,8 +469,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet Log.d(TAG, "Header view height is 0 when inflating recommended widgets"); } float maxTableHeight = - (mLauncher.getDeviceProfile().heightPx - mTabsHeight - getHeaderViewHeight()) - * RECOMMENDATION_TABLE_HEIGHT_RATIO; + (mLauncher.getDeviceProfile().availableHeightPx - mTabsHeight + - getHeaderViewHeight()) * RECOMMENDATION_TABLE_HEIGHT_RATIO; List> recommendedWidgetsInTable = WidgetsTableUtils.groupWidgetItemsIntoTable(recommendedWidgets, mMaxSpansPerRow); diff --git a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java index 1bfffc29fc..824b5806f4 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java +++ b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java @@ -42,7 +42,6 @@ public final class WidgetsRecommendationTableLayout extends TableLayout { private static final String TAG = "WidgetsRecommendationTableLayout"; private static final float DOWN_SCALE_RATIO = 0.9f; private static final float MAX_DOWN_SCALE_RATIO = 0.5f; - private final DeviceProfile mDeviceProfile; private final float mWidgetCellTextViewsHeight; private float mRecommendationTableMaxHeight = Float.MAX_VALUE; @@ -56,7 +55,6 @@ public final class WidgetsRecommendationTableLayout extends TableLayout { public WidgetsRecommendationTableLayout(Context context, AttributeSet attrs) { super(context, attrs); - mDeviceProfile = Launcher.getLauncher(context).getDeviceProfile(); // There are 1 row for title, 1 row for dimension and 2 rows for description. mWidgetCellTextViewsHeight = 4 * getResources().getDimension(R.dimen.widget_cell_font_size); } @@ -143,11 +141,12 @@ public final class WidgetsRecommendationTableLayout extends TableLayout { } // A naive estimation of the widgets recommendation table height without inflation. float totalHeight = 0; + DeviceProfile deviceProfile = Launcher.getLauncher(getContext()).getDeviceProfile(); for (int i = 0; i < recommendedWidgetsInTable.size(); i++) { List widgetItems = recommendedWidgetsInTable.get(i); float rowHeight = 0; for (int j = 0; j < widgetItems.size(); j++) { - float previewHeight = widgetItems.get(j).spanY * mDeviceProfile.allAppsCellHeightPx + float previewHeight = widgetItems.get(j).spanY * deviceProfile.allAppsCellHeightPx * previewScale; rowHeight = Math.max(rowHeight, previewHeight + mWidgetCellTextViewsHeight); }