Merge "Include recommended widgets table vertical padding in the height estimation" into sc-dev am: c2f4f0de02
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14314646 Change-Id: I155d24adcf210fee0eb4be48fcfc2b045997eb6f
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/widgets_recommendation_background"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingVertical="@dimen/recommended_widgets_table_vertical_padding"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
<dimen name="widget_cell_horizontal_padding">16dp</dimen>
|
||||
<dimen name="widget_cell_font_size">14sp</dimen>
|
||||
|
||||
<dimen name="recommended_widgets_table_vertical_padding">8dp</dimen>
|
||||
|
||||
<dimen name="widget_list_top_bottom_corner_radius">28dp</dimen>
|
||||
<dimen name="widget_list_content_corner_radius">4dp</dimen>
|
||||
|
||||
@@ -42,6 +42,7 @@ 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 float mWidgetsRecommendationTableVerticalPadding;
|
||||
private final float mWidgetCellTextViewsHeight;
|
||||
private final float mWidgetPreviewPadding;
|
||||
|
||||
@@ -57,6 +58,8 @@ public final class WidgetsRecommendationTableLayout extends TableLayout {
|
||||
public WidgetsRecommendationTableLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
// There are 1 row for title, 1 row for dimension and 2 rows for description.
|
||||
mWidgetsRecommendationTableVerticalPadding = 2 * getResources()
|
||||
.getDimensionPixelSize(R.dimen.widget_cell_vertical_padding);
|
||||
mWidgetCellTextViewsHeight = 4 * getResources().getDimension(R.dimen.widget_cell_font_size);
|
||||
mWidgetPreviewPadding = 2 * getResources()
|
||||
.getDimensionPixelSize(R.dimen.widget_preview_shortcut_padding);
|
||||
@@ -143,7 +146,7 @@ public final class WidgetsRecommendationTableLayout extends TableLayout {
|
||||
return new RecommendationTableData(List.of(), previewScale);
|
||||
}
|
||||
// A naive estimation of the widgets recommendation table height without inflation.
|
||||
float totalHeight = 0;
|
||||
float totalHeight = mWidgetsRecommendationTableVerticalPadding;
|
||||
DeviceProfile deviceProfile = Launcher.getLauncher(getContext()).getDeviceProfile();
|
||||
for (int i = 0; i < recommendedWidgetsInTable.size(); i++) {
|
||||
List<WidgetItem> widgetItems = recommendedWidgetsInTable.get(i);
|
||||
|
||||
Reference in New Issue
Block a user