Make theme picker options carousels full bleed
Fixes: 130760271
Test: visual
Change-Id: Icaea7de251ac7d795fe051d5f989c557b59bbf2e
diff --git a/res/layout/fragment_clock_picker.xml b/res/layout/fragment_clock_picker.xml
index d97a339..da4f891 100644
--- a/res/layout/fragment_clock_picker.xml
+++ b/res/layout/fragment_clock_picker.xml
@@ -35,7 +35,7 @@
android:id="@+id/options_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="10dp"
+ android:paddingVertical="10dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
@@ -46,7 +46,8 @@
<RelativeLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:paddingHorizontal="10dp">
<Button
android:id="@+id/apply_button"
style="@style/ActionPrimaryButton"
diff --git a/res/layout/fragment_custom_theme_component.xml b/res/layout/fragment_custom_theme_component.xml
index 4acc884..c407724 100644
--- a/res/layout/fragment_custom_theme_component.xml
+++ b/res/layout/fragment_custom_theme_component.xml
@@ -42,7 +42,7 @@
android:id="@+id/options_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="10dp"
+ android:paddingVertical="10dp"
android:orientation="vertical">
<TextView
diff --git a/res/layout/fragment_grid_picker.xml b/res/layout/fragment_grid_picker.xml
index 5c21cd9..d7618f3 100644
--- a/res/layout/fragment_grid_picker.xml
+++ b/res/layout/fragment_grid_picker.xml
@@ -34,7 +34,7 @@
android:id="@+id/options_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="10dp"
+ android:paddingVertical="10dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
@@ -45,7 +45,8 @@
<RelativeLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:paddingHorizontal="10dp">
<Button
android:id="@+id/apply_button"
style="@style/ActionPrimaryButton"
diff --git a/res/layout/fragment_theme_picker.xml b/res/layout/fragment_theme_picker.xml
index c73bf63..dddd060 100644
--- a/res/layout/fragment_theme_picker.xml
+++ b/res/layout/fragment_theme_picker.xml
@@ -33,7 +33,7 @@
android:id="@+id/options_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="10dp"
+ android:paddingVertical="10dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
@@ -44,7 +44,8 @@
<RelativeLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:paddingHorizontal="10dp">
<CheckBox
android:id="@+id/use_my_wallpaper"
android:layout_width="wrap_content"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index bd03aa8..b36bb13 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -55,6 +55,7 @@
<dimen name="theme_option_title_font_text_size">12sp</dimen>
<dimen name="option_tile_margin_horizontal">4dp</dimen>
+ <dimen name="option_tile_margin_horizontal_ends">10dp</dimen>
<dimen name="theme_option_label_margin">4dp</dimen>
<dimen name="preview_card_corner_radius">8dp</dimen>
diff --git a/src/com/android/customization/widget/HorizontalSpacerItemDecoration.java b/src/com/android/customization/widget/HorizontalSpacerItemDecoration.java
index 6d95c36..f17d52f 100644
--- a/src/com/android/customization/widget/HorizontalSpacerItemDecoration.java
+++ b/src/com/android/customization/widget/HorizontalSpacerItemDecoration.java
@@ -16,17 +16,19 @@
public class HorizontalSpacerItemDecoration extends ItemDecoration {
private final int mOffset;
+ private final int mEndOffset;
- public HorizontalSpacerItemDecoration(@Dimension int offset) {
+ public HorizontalSpacerItemDecoration(@Dimension int offset, @Dimension int endOffset) {
mOffset = offset;
+ mEndOffset = endOffset;
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
@NonNull RecyclerView parent, @NonNull State state) {
int position = parent.getChildAdapterPosition(view);
- int left = position == 0 ? 0 : mOffset;
- int right = (position == parent.getAdapter().getItemCount() - 1) ? 0 : mOffset;
+ int left = position == 0 ? mEndOffset : mOffset;
+ int right = (position == parent.getAdapter().getItemCount() - 1) ? mEndOffset : mOffset;
outRect.set(left, 0, right, 0);
}
}
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index 090dc7e..82baaf9 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -122,7 +122,8 @@
LinearLayoutManager.HORIZONTAL, false));
Resources res = mContainer.getContext().getResources();
mContainer.addItemDecoration(new HorizontalSpacerItemDecoration(
- res.getDimensionPixelOffset(R.dimen.option_tile_margin_horizontal)));
+ res.getDimensionPixelOffset(R.dimen.option_tile_margin_horizontal),
+ res.getDimensionPixelOffset(R.dimen.option_tile_margin_horizontal_ends)));
mContainer.setAdapter(mAdapter);
}