Add new preview for theme picker (Part1)
- Uses a flag to hide the new preview until it's ready.
- Uses the apply button of bottom action bar.
Screenshot:
flag is false: https://screenshot.googleplex.com/nDyDnt708tL.png
flag is ture: https://screenshot.googleplex.com/R76eoVL0rNy.png
Test: Manually
Bug: 146475648
Change-Id: I49e33e011da106e7773a66a1238cc462a873c1cc
diff --git a/res/layout/fragment_theme_picker.xml b/res/layout/fragment_theme_picker.xml
index d15d93f..93606ea 100644
--- a/res/layout/fragment_theme_picker.xml
+++ b/res/layout/fragment_theme_picker.xml
@@ -16,7 +16,6 @@
-->
<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"
@@ -27,49 +26,40 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <androidx.constraintlayout.widget.ConstraintLayout
+ <LinearLayout
android:id="@+id/content_section"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <!-- The V2 preview card. -->
+ <FrameLayout
+ android:id="@+id/preview_card_container"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/preview_content_height"
+ android:paddingTop="@dimen/preview_content_padding_top"
+ android:paddingBottom="@dimen/preview_content_padding_bottom"
+ android:clipToPadding="false"
+ android:background="@color/fullscreen_preview_background"
+ android:visibility="gone">
+ <include layout="@layout/theme_preview_card_v2"/>
+ </FrameLayout>
+
+ <!-- Will remove it later. -->
<com.android.wallpaper.widget.PreviewPager
android:id="@+id/theme_preview_pager"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@color/preview_pager_background"
- 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_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0"
- app:layout_constraintVertical_chainStyle="spread_inside"/>
+ android:layout_height="@dimen/preview_content_height"
+ android:background="@color/preview_pager_background"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/options_container"
android:layout_width="match_parent"
- android:layout_height="@dimen/options_container_height"
+ android:layout_height="0dp"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginTop="10dp"
- android:layout_weight="1"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/theme_preview_pager"
- 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: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"/>
- </androidx.constraintlayout.widget.ConstraintLayout>
+ android:layout_weight="1"/>
+ </LinearLayout>
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/loading_indicator"
diff --git a/res/layout/theme_preview_card_v2.xml b/res/layout/theme_preview_card_v2.xml
new file mode 100644
index 0000000..b6e8d49
--- /dev/null
+++ b/res/layout/theme_preview_card_v2.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<androidx.cardview.widget.CardView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/FullContentPreviewCard"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center">
+
+ <ImageView
+ android:id="@+id/wallpaper_preview_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/primary_color" />
+
+ <SurfaceView
+ android:id="@+id/wallpaper_preview_surface"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+</androidx.cardview.widget.CardView>
\ No newline at end of file