Add set wallpaper button
Flag: com.android.wallpaper.multi_crop_preview_ui_flag
Bug: 303317694
Test: launch preview
Change-Id: I7ae14b3f3131137bddf1db1f24483de96157ae12
diff --git a/res/drawable/check_circle_full_preview.xml b/res/drawable/check_circle_full_preview.xml
new file mode 100644
index 0000000..09b288a
--- /dev/null
+++ b/res/drawable/check_circle_full_preview.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2023 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/wallpaper_control_button_on_background" />
+ <item android:drawable="@drawable/ic_check_wallpaper" />
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/ic_check_wallpaper.xml b/res/drawable/ic_check_wallpaper.xml
new file mode 100644
index 0000000..a280693
--- /dev/null
+++ b/res/drawable/ic_check_wallpaper.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2023 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="@color/text_color_on_accent"
+ android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41L9,16.17z"/>
+</vector>
diff --git a/res/layout/fragment_full_preview.xml b/res/layout/fragment_full_preview.xml
index 689dfff..f59f0f1 100644
--- a/res/layout/fragment_full_preview.xml
+++ b/res/layout/fragment_full_preview.xml
@@ -14,7 +14,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout
+ 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">
@@ -25,8 +27,31 @@
android:background="@android:color/transparent"
android:contentDescription="@string/preview_screen_description"/>
- <include layout="@layout/wallpaper_preview_crop" />
+ <include layout="@layout/wallpaper_preview_crop"/>
- <include layout="@layout/section_header" />
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+ <include
+ android:id="@+id/toolbar_container"
+ layout="@layout/section_header_content"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ <Button
+ android:id="@+id/apply_crop_button"
+ android:layout_width="@dimen/wallpaper_control_button_size"
+ android:layout_height="@dimen/wallpaper_control_button_size"
+ android:background="@drawable/check_circle_full_preview"
+ android:elevation="@dimen/wallpaper_preview_buttons_elevation"
+ android:contentDescription="@string/show_preview_controls_action"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="@id/toolbar_container"
+ app:layout_constraintBottom_toBottomOf="@id/toolbar_container"/>
+ </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
diff --git a/res/layout/fragment_small_preview_for_two_screens.xml b/res/layout/fragment_small_preview_for_two_screens.xml
index ec86f29..4788e27 100644
--- a/res/layout/fragment_small_preview_for_two_screens.xml
+++ b/res/layout/fragment_small_preview_for_two_screens.xml
@@ -20,7 +20,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
<include
android:id="@+id/toolbar_container"
@@ -31,6 +32,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
+ <Button
+ android:id="@+id/button_set_wallpaper"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:elevation="@dimen/wallpaper_preview_buttons_elevation"
+ android:layout_marginEnd="@dimen/set_wallpaper_button_margin_end"
+ android:background="@drawable/set_wallpaper_button_background"
+ android:text="@string/set_wallpaper_button_text"
+ android:textColor="@color/text_color_on_accent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="@id/toolbar_container"
+ app:layout_constraintBottom_toBottomOf="@id/toolbar_container"/>
+
<com.android.wallpaper.picker.preview.ui.fragment.smallpreview.DualPreviewViewPager
android:id="@+id/dual_preview_pager"
android:layout_width="match_parent"
diff --git a/res/layout/fragment_small_preview_handheld.xml b/res/layout/fragment_small_preview_handheld.xml
index e2cae55..813fa55 100644
--- a/res/layout/fragment_small_preview_handheld.xml
+++ b/res/layout/fragment_small_preview_handheld.xml
@@ -15,25 +15,35 @@
~ limitations under the License.
~
-->
-
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:fitsSystemWindows="true">
- <FrameLayout
+ <include
android:id="@+id/toolbar_container"
+ layout="@layout/section_header_content"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toEndOf="parent">
- <include
- layout="@layout/section_header" />
- </FrameLayout>
+ app:layout_constraintEnd_toEndOf="parent"/>
+ <Button
+ android:id="@+id/button_set_wallpaper"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:elevation="@dimen/wallpaper_preview_buttons_elevation"
+ android:layout_marginEnd="@dimen/set_wallpaper_button_margin_end"
+ android:background="@drawable/set_wallpaper_button_background"
+ android:text="@string/set_wallpaper_button_text"
+ android:textColor="@color/text_color_on_accent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="@id/toolbar_container"
+ app:layout_constraintBottom_toBottomOf="@id/toolbar_container"/>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager_previews"