Adjust padding, margin of tabs in the WidgetsFullSheet
Also remove elevation set to tab to remove unwanted shadow.
Test: Set up a work profile. Then, open the full widgets picker.
Observe padding & margin of the work / personal tabs.
Bug: 188221455
Change-Id: I761cb1c1410f87c80a5fdca3803fb8b099d499d6
diff --git a/res/layout/widgets_full_sheet_paged_view.xml b/res/layout/widgets_full_sheet_paged_view.xml
index 580ca49..f0ddc2b 100644
--- a/res/layout/widgets_full_sheet_paged_view.xml
+++ b/res/layout/widgets_full_sheet_paged_view.xml
@@ -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">
diff --git a/res/layout/widgets_personal_work_tabs.xml b/res/layout/widgets_personal_work_tabs.xml
index 72d83e8..15275a6 100644
--- a/res/layout/widgets_personal_work_tabs.xml
+++ b/res/layout/widgets_personal_work_tabs.xml
@@ -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
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index bfa02c0..2882b1f 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -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>
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 039cad8..ee5afd9 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -126,6 +126,7 @@
}
};
private final int mTabsHeight;
+ private final int mViewPagerTopPadding;
private final int mWidgetCellHorizontalPadding;
@Nullable private WidgetsRecyclerView mCurrentWidgetsRecyclerView;
@@ -148,6 +149,10 @@
? 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 @@
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 @@
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. */