Merge "Adjust padding, margin of tabs in the WidgetsFullSheet" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-05-25 10:49:39 +00:00
committed by Android (Google) Code Review
4 changed files with 12 additions and 5 deletions

View File

@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="@dimen/widget_picker_view_pager_top_padding"
android:descendantFocusability="afterDescendants"
launcher:pageIndicator="@+id/tabs">

View File

@@ -20,10 +20,9 @@
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/all_apps_header_pill_height"
android:layout_marginHorizontal="16dp"
android:layout_marginHorizontal="32dp"
android:orientation="horizontal"
android:background="@drawable/all_apps_tabs_background"
android:elevation="2dp"
style="@style/TextHeadline">
<Button

View File

@@ -146,6 +146,8 @@
<dimen name="widget_picker_education_tip_width">120dp</dimen>
<dimen name="widget_picker_education_tip_min_margin">4dp</dimen>
<dimen name="widget_picker_view_pager_top_padding">16dp</dimen>
<!-- Padding applied to shortcut previews -->
<dimen name="shortcut_preview_padding_left">0dp</dimen>
<dimen name="shortcut_preview_padding_right">0dp</dimen>

View File

@@ -126,6 +126,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
}
};
private final int mTabsHeight;
private final int mViewPagerTopPadding;
private final int mWidgetCellHorizontalPadding;
@Nullable private WidgetsRecyclerView mCurrentWidgetsRecyclerView;
@@ -148,6 +149,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet
? getContext().getResources()
.getDimensionPixelSize(R.dimen.all_apps_header_pill_height)
: 0;
mViewPagerTopPadding = mHasWorkProfile
? getContext().getResources()
.getDimensionPixelSize(R.dimen.widget_picker_view_pager_top_padding)
: 0;
mWidgetCellHorizontalPadding = 2 * getResources().getDimensionPixelOffset(
R.dimen.widget_cell_horizontal_padding);
}
@@ -499,8 +504,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
noWidgetsViewHeight = noWidgetsViewTextBounds.height();
}
float maxTableHeight = (mActivityContext.getDeviceProfile().availableHeightPx
- mTabsHeight - getHeaderViewHeight() - noWidgetsViewHeight)
* RECOMMENDATION_TABLE_HEIGHT_RATIO;
- mTabsHeight - mViewPagerTopPadding - getHeaderViewHeight()
- noWidgetsViewHeight) * RECOMMENDATION_TABLE_HEIGHT_RATIO;
List<ArrayList<WidgetItem>> recommendedWidgetsInTable =
WidgetsTableUtils.groupWidgetItemsIntoTable(recommendedWidgets,
@@ -605,7 +610,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
return measureHeightWithVerticalMargins(mSearchAndRecommendationViewHolder.mCollapseHandle)
+ measureHeightWithVerticalMargins(mSearchAndRecommendationViewHolder.mHeaderTitle)
+ measureHeightWithVerticalMargins(
(View) mSearchAndRecommendationViewHolder.mSearchBar);
(View) mSearchAndRecommendationViewHolder.mSearchBarContainer);
}
/** private the height, in pixel, + the vertical margins of a given view. */