Use ConstraintLayout for Theme and Grid picker
- I was changing they to use LinearLay by ag/11453761 and ag/11439238, but they will break when font and display size are large...so the cl is to add ConstraintLayout back.
Before:
https://screenshot.googleplex.com/a4OTafHQkrq.png
https://screenshot.googleplex.com/SEXka81XfYk.png
After:
https://screenshot.googleplex.com/FRNKTMcEMVj.png
https://screenshot.googleplex.com/3ow1Y8NnkzH.png
Test: Manually
Bug: 157111978
BUg: 156059583
Change-Id: Ibd4e636e23a531d896535f2dbd235c3dcaa2ba0f
diff --git a/res/layout/fragment_grid_picker.xml b/res/layout/fragment_grid_picker.xml
index af70e0c..ddb9917 100644
--- a/res/layout/fragment_grid_picker.xml
+++ b/res/layout/fragment_grid_picker.xml
@@ -16,6 +16,7 @@
-->
<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"
@@ -26,19 +27,27 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout
+ <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content_section"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="match_parent">
<FrameLayout
+ android:id="@+id/preview_card_container"
android:layout_width="match_parent"
- android:layout_height="@dimen/preview_content_height"
+ android:layout_height="0dp"
android:paddingTop="@dimen/preview_content_padding_top"
android:paddingBottom="@dimen/preview_content_padding_bottom"
+ android:background="@color/fullscreen_preview_background"
android:clipToPadding="false"
- android:background="@color/fullscreen_preview_background">
+ app:layout_constrainedHeight="true"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/options_title"
+ app:layout_constraintHeight_max="@dimen/preview_pager_max_height"
+ app:layout_constraintVertical_bias="0.0"
+ app:layout_constraintHeight_percent="0.7">
<include layout="@layout/grid_preview_card"/>
</FrameLayout>
@@ -51,14 +60,22 @@
android:lineHeight="24dp"
android:singleLine="true"
android:text="@string/grid_options_title"
- android:textAppearance="@style/TitleTextAppearance"/>
+ android:textAppearance="@style/TitleTextAppearance"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/preview_card_container"
+ app:layout_constraintBottom_toTopOf="@id/options_container" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/options_container"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"/>
- </LinearLayout>
+ android:layout_height="0dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/options_title"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintVertical_bias="1.0" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/loading_indicator"
diff --git a/res/layout/fragment_theme_picker.xml b/res/layout/fragment_theme_picker.xml
index 704114f..09f4819 100644
--- a/res/layout/fragment_theme_picker.xml
+++ b/res/layout/fragment_theme_picker.xml
@@ -14,8 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<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"
@@ -26,20 +26,26 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout
+ <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content_section"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
+ android:layout_height="match_parent">
<FrameLayout
android:id="@+id/preview_card_container"
android:layout_width="match_parent"
- android:layout_height="@dimen/preview_content_height"
+ android:layout_height="0dp"
android:paddingTop="@dimen/preview_content_padding_top"
android:paddingBottom="@dimen/preview_content_padding_bottom"
+ android:background="@color/fullscreen_preview_background"
android:clipToPadding="false"
- android:background="@color/fullscreen_preview_background">
+ app:layout_constrainedHeight="true"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/options_container"
+ app:layout_constraintHeight_max="@dimen/preview_pager_max_height"
+ app:layout_constraintVertical_bias="0.0"
+ app:layout_constraintHeight_percent="0.7">
<include layout="@layout/theme_preview_card_v2"/>
</FrameLayout>
@@ -49,8 +55,12 @@
android:layout_height="0dp"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginTop="10dp"
- android:layout_weight="1"/>
- </LinearLayout>
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/preview_card_container"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintVertical_bias="1.0"/>
+ </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/loading_indicator"