ThemePicker: First iteration of Grid section
Create the Fragment and provider to interface with
Launcher.
Some polish is still pending, as well as applying the grid
to the launcher.
Bug: 120560197
Change-Id: I5fc35c901a33f2163d2864bfc9e177c74d49aa36
diff --git a/res/layout/fragment_grid_picker.xml b/res/layout/fragment_grid_picker.xml
new file mode 100644
index 0000000..536f1f7
--- /dev/null
+++ b/res/layout/fragment_grid_picker.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="@color/category_picker_background_color">
+ <include layout="@layout/section_header"/>
+
+ <com.android.customization.widget.PreviewPager
+ android:id="@+id/grid_preview_pager"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@color/secondary_color"/>
+
+ <LinearLayout
+ android:id="@+id/options_section"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="10dp"
+ android:orientation="vertical">
+
+ <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"/>
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <Button
+ style="@style/ActionPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:text="@string/apply_btn"/>
+ </RelativeLayout>
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout/grid_option.xml b/res/layout/grid_option.xml
new file mode 100644
index 0000000..0dac4fe
--- /dev/null
+++ b/res/layout/grid_option.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/option_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginBottom="@dimen/theme_option_label_margin"
+ android:textAppearance="@style/OptionTitleTextAppearance"/>
+ <FrameLayout
+ android:id="@+id/option_tile"
+ android:layout_width="@dimen/option_tile_width"
+ android:layout_height="@dimen/option_tile_width"
+ android:layout_gravity="center_horizontal"
+ android:padding="@dimen/option_tile_padding_vertical"
+ android:background="@drawable/option_border"
+ android:gravity="center">
+ <ImageView
+ android:id="@+id/grid_option_thumbnail"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+ </FrameLayout>
+</LinearLayout>
diff --git a/res/layout/grid_preview_card.xml b/res/layout/grid_preview_card.xml
new file mode 100644
index 0000000..ae66b83
--- /dev/null
+++ b/res/layout/grid_preview_card.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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">
+
+ <ImageView
+ android:id="@+id/grid_preview_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/primary_color"/>
+
+</androidx.cardview.widget.CardView>
\ No newline at end of file
diff --git a/res/menu/bottom_navigation_menu.xml b/res/menu/bottom_navigation_menu.xml
index a856222..d477aaf 100644
--- a/res/menu/bottom_navigation_menu.xml
+++ b/res/menu/bottom_navigation_menu.xml
@@ -23,11 +23,11 @@
<item
android:id="@+id/nav_clock"
android:title="@string/clock_title"
- android:icon="@drawable/ic_nav_grid" />
+ android:icon="@drawable/ic_nav_clock" />
<item
android:id="@+id/nav_grid"
android:title="@string/grid_title"
- android:icon="@drawable/ic_nav_theme" />
+ android:icon="@drawable/ic_nav_grid" />
<item
android:id="@+id/nav_wallpaper"
android:title="@string/wallpaper_title"
diff --git a/res/values/override.xml b/res/values/override.xml
index b40eec8..82fc964 100644
--- a/res/values/override.xml
+++ b/res/values/override.xml
@@ -17,4 +17,6 @@
-->
<resources>
<string name="themes_stub_package" translatable="false"/>
+
+ <string name="grid_control_authority" translatable="false"/>
</resources>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a09afaa..d87a354 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -38,6 +38,10 @@
[CHAR LIMIT=20] -->
<string name="apply_theme_btn">Apply Theme</string>
+ <!-- Label for a button that allows the user to apply the currently selected customization option.
+ [CHAR LIMIT=20] -->
+ <string name="apply_btn">Apply</string>
+
<!-- Accessibility label for paging indicator in theme picker preview [CHAR LIMIT=NONE] -->
<string name="accessibility_preview_pager">Page <xliff:g name="current_page" example="1">%1$d</xliff:g> of <xliff:g name="num_pages" example="2">%2$d</xliff:g></string>
<!-- Content description of the next button to bring user to the next preview page.[CHAR LIMIT=NONE] -->
@@ -58,4 +62,7 @@
<!-- Body text for previewing a font [CHAR LIMIT=160] -->
<string name="font_card_body">My Style on every screen!\nOnce you install a theme, its design extends to every facet of the phone, from the home screen to icons, Quick Settings, etc.</string>
+
+ <!--Title for a grid option, describing the number of columns and rows, eg: 4x4 [CHAR LIMIT=10] -->
+ <string name="grid_title_pattern"><xliff:g name="num_cols" example="1">%1$d</xliff:g>x<xliff:g name="num_rows" example="1">%2$d</xliff:g></string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1e46cad..4e5103c 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -63,6 +63,13 @@
<item name="android:background">@color/primary_color</item>
</style>
+ <style name="FullContentPreviewCard" parent="PreviewCard">
+ <item name="cardCornerRadius">@dimen/preview_card_corner_radius</item>
+ <item name="android:clipChildren">true</item>
+ <item name="contentPadding">0dp</item>
+ <item name="android:background">@color/primary_color</item>
+ </style>
+
<style name="CardTitleTextAppearance" parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title">
<item name="android:textStyle">bold</item>
<item name="android:textSize">@dimen/card_title_text_size</item>