Change the layout of TP pages and previews
Change the position of the "Keep my wallpaper" checkbox and
make the bottom panel larger, as well as restrict how much
a preview card can grow or shrink depending on the screen
size.
Note that the UX spec cannot be met 100% on all screen
sizes, so for some cases we round to the closest
approximation.
(ConstraintLayout FTW!)
Fixes: 130763357
Fixes: 130398264
Change-Id: I15bece84fb4ce1018676f57d32e0fc533bcdec92
diff --git a/res/layout/fragment_theme_picker.xml b/res/layout/fragment_theme_picker.xml
index 2cfac1d..84c5516 100644
--- a/res/layout/fragment_theme_picker.xml
+++ b/res/layout/fragment_theme_picker.xml
@@ -16,56 +16,73 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?android:colorPrimary">
<include layout="@layout/section_header"/>
- <com.android.customization.widget.PreviewPager
- android:id="@+id/theme_preview_pager"
+ <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:background="@color/secondary_color"/>
+ android:layout_height="match_parent">
- <LinearLayout
- android:id="@+id/options_section"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingVertical="10dp"
- android:orientation="vertical">
+ <com.android.customization.widget.PreviewPager
+ android:id="@+id/theme_preview_pager"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/secondary_color"
+ app:layout_constrainedHeight="true"
+ app:layout_constraintBottom_toTopOf="@id/options_container"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_max="@dimen/preview_pager_max_height"
+ app:layout_constraintHeight_min="@dimen/preview_pager_min_height"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.0"
+ app:layout_constraintVertical_chainStyle="spread_inside"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/options_container"
android:layout_width="match_parent"
android:layout_height="@dimen/options_container_height"
- android:layout_gravity="center_horizontal"/>
+ android:layout_gravity="bottom|center_horizontal"
+ android:layout_marginTop="10dp"
+ android:layout_weight="1"
+ app:layout_constraintBottom_toTopOf="@id/use_my_wallpaper"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_pager"
+ app:layout_constraintVertical_bias="1.0"/>
- <RelativeLayout
- android:layout_width="match_parent"
+ <CheckBox
+ android:id="@+id/use_my_wallpaper"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/min_taptarget_height"
+ android:layout_marginStart="10dp"
+ android:ellipsize="end"
+ android:gravity="start|center_vertical"
+ android:paddingLeft="4dp"
+ android:text="@string/keep_my_wallpaper"
+ app:layout_constraintBottom_toTopOf="@id/apply_button"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_min="@dimen/min_taptarget_height"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/options_container"
+ app:layout_constraintVertical_bias="1.0"/>
+
+ <Button
+ android:id="@+id/apply_button"
+ style="@style/ActionPrimaryButton"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingHorizontal="10dp">
- <CheckBox
- android:id="@+id/use_my_wallpaper"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_centerVertical="true"
- android:layout_toStartOf="@+id/apply_button"
- android:ellipsize="end"
- android:paddingLeft="4dp"
- android:minHeight="@dimen/min_taptarget_height"
- android:text="@string/keep_my_wallpaper"/>
- <Button
- android:id="@+id/apply_button"
- style="@style/ActionPrimaryButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:text="@string/apply_theme_btn"/>
- </RelativeLayout>
+ android:layout_gravity="end"
+ android:layout_marginEnd="10dp"
+ android:layout_marginBottom="10dp"
+ android:text="@string/apply_theme_btn"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"/>
- </LinearLayout>
-
+ </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>