Merge "Implementation of the pack theme entry in the home option" into main
diff --git a/res/drawable/ic_pack_theme_24px.xml b/res/drawable/ic_pack_theme_24px.xml
new file mode 100644
index 0000000..7aa9aae
--- /dev/null
+++ b/res/drawable/ic_pack_theme_24px.xml
@@ -0,0 +1,31 @@
+<!--
+ Copyright (C) 2025 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="24dp"
+ android:height="24dp"
+ android:tint="?attr/colorControlNormal"
+ android:translateX="100"
+ android:viewportHeight="1920"
+ android:viewportWidth="1920">
+
+ <group
+ android:translateX="480"
+ android:translateY="480">
+ <path
+ android:fillColor="?android:textColorPrimary"
+ android:pathData="M340,240L260,160L340,80L420,160L340,240ZM800,700L720,620L800,540L880,620L800,700ZM205,868L92,755Q80,743 80,727Q80,711 92,699L455,335Q490,300 540,300Q590,300 625,335Q660,370 660,420Q660,470 625,505L261,868Q249,880 233,880Q217,880 205,868ZM740,401Q740,326 687,273Q634,220 559,220Q634,220 687,167.5Q740,115 740,40Q740,115 792.5,167.5Q845,220 920,220Q845,220 792.5,273Q740,326 740,401ZM484,533L484,533Q484,533 469.5,519Q455,505 455,505Q455,505 441,491Q427,477 427,477L427,477L455,505L484,533ZM233,784L484,533L427,477L177,727L233,784Z" />
+ </group>
+</vector>
\ No newline at end of file
diff --git a/res/layout/customization_option_entry_pack_theme.xml b/res/layout/customization_option_entry_pack_theme.xml
new file mode 100644
index 0000000..e3fb6fc
--- /dev/null
+++ b/res/layout/customization_option_entry_pack_theme.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2025 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.constraintlayout.widget.ConstraintLayout
+ 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="wrap_content"
+ android:paddingHorizontal="@dimen/customization_option_entry_horizontal_padding"
+ android:paddingVertical="@dimen/customization_option_entry_vertical_padding"
+ android:clickable="true">
+
+ <TextView
+ android:id="@+id/option_entry_title"
+ style="@style/CustomizationOptionEntryTitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/pack_theme_title"
+ android:layout_marginEnd="@dimen/customization_option_entry_text_margin_end"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_icon_container"
+ app:layout_constraintBottom_toTopOf="@+id/option_entry_description"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed" />
+
+ <TextView
+ android:id="@+id/option_entry_description"
+ style="@style/CustomizationOptionEntrySubtitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/customization_option_entry_text_margin_end"
+ android:text="@string/theme_packs_description"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_icon_container"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/option_entry_title" />
+
+ <RelativeLayout
+ android:id="@+id/option_entry_icon_container"
+ android:layout_width="@dimen/customization_option_entry_icon_size"
+ android:layout_height="@dimen/customization_option_entry_icon_size"
+ android:padding="@dimen/customization_option_entry_icon_padding"
+ android:background="@drawable/customization_option_entry_icon_background"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent">
+
+ <ImageView
+ android:id="@+id/option_entry_icon"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/ic_pack_theme_24px"
+ android:contentDescription="@string/pack_theme_preview_card_content_description"
+ android:layout_centerInParent="true"/>
+ </RelativeLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 819f7e3..d335636 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -203,6 +203,7 @@
<dimen name="floating_sheet_color_option_size">54dp</dimen>
<dimen name="floating_sheet_color_option_stroke_width">3dp</dimen>
<dimen name="customization_option_entry_shortcut_icon_size">20dp</dimen>
+ <dimen name="customization_option_entry_icon_image_size">24dp</dimen>
<dimen name="customization_option_entry_clock_icon_size">44dp</dimen>
<dimen name="customization_option_entry_color_icon_size">48dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 19e1630..46038c6 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -141,6 +141,9 @@
<!-- Content description of grid preview card. [CHAR_LIMIT=30]-->
<string name="grid_preview_card_content_description">Grid preview</string>
+ <!-- Content description of theme preview card. [CHAR_LIMIT=30]-->
+ <string name="pack_theme_preview_card_content_description">Themes preview</string>
+
<!-- Content description of font preview. [CHAR_LIMIT=30]-->
<string name="font_preview_content_description">Font preview</string>
@@ -348,9 +351,15 @@
<!-- Title of a section of the customization where the user can select color override for icon. [CHAR LIMIT=30] -->
<string name="themed_icon_title" msgid="4305612684940220645">Themed icons</string>
+ <!-- Title of a section of the customization where the user can select color override for icon. [CHAR LIMIT=30] -->
+ <string name="pack_theme_title" msgid="4305612684940220645">Themes</string>
+
<!-- Title of the tag to indicate beta version. [CHAR LIMIT=6] -->
<string name="beta_title">Beta</string>
+ <!-- The description of theme picker entry. [CHAR LIMIT=30] -->
+ <string name="theme_packs_description">Discover Pixel themes</string>
+
<!-- The content description of grid picker entry. [CHAR LIMIT=NONE] -->
<string name="gird_picker_entry_content_description" msgid="7538418512525897691">Change app grid</string>
diff --git a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
index 2cb5e86..5736e0e 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
@@ -175,6 +175,22 @@
navigateToMoreLockScreenSettingsActivity.invoke()
}
+ var optionPackThemeIconHome: ImageView? = null
+ var optionPackThemeIconLock: ImageView? = null
+
+ if (BaseFlags.get().isPackThemeEnabled()) {
+ val optionPackThemeHome: View =
+ homeScreenCustomizationOptionEntries
+ .first { it.first == ThemePickerHomeCustomizationOption.PACK_THEME }
+ .second
+ optionPackThemeIconHome = optionPackThemeHome.requireViewById(R.id.option_entry_icon)
+ val optionPackThemeLock: View =
+ homeScreenCustomizationOptionEntries
+ .first { it.first == ThemePickerHomeCustomizationOption.PACK_THEME }
+ .second
+ optionPackThemeIconLock = optionPackThemeLock.requireViewById(R.id.option_entry_icon)
+ }
+
val optionColors: View =
homeScreenCustomizationOptionEntries
.first { it.first == ThemePickerHomeCustomizationOption.COLORS }
@@ -209,6 +225,10 @@
optionShortcutIcon1.setColorFilter(color)
optionShortcutIcon2.setColorFilter(color)
optionShapeGridIcon.setColorFilter(color)
+ if (BaseFlags.get().isPackThemeEnabled()) {
+ optionPackThemeIconHome?.setColorFilter(color)
+ optionPackThemeIconLock?.setColorFilter(color)
+ }
},
color = colorUpdateViewModel.colorOnSurfaceVariant,
shouldAnimate = isOnMainScreen,
diff --git a/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt b/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt
index 922384a..4ec89d0 100644
--- a/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt
+++ b/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt
@@ -55,6 +55,7 @@
}
enum class ThemePickerHomeCustomizationOption : CustomizationOptionUtil.CustomizationOption {
+ PACK_THEME,
COLORS,
THEMED_ICONS,
APP_SHAPE_GRID,
@@ -72,6 +73,16 @@
LOCK_SCREEN ->
buildList {
addAll(defaultOptionEntries)
+ if (BaseFlags.get().isPackThemeEnabled()) {
+ add(
+ ThemePickerHomeCustomizationOption.PACK_THEME to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_pack_theme,
+ optionContainer,
+ false,
+ )
+ )
+ }
add(
ThemePickerLockCustomizationOption.CLOCK to
layoutInflater.inflate(
@@ -108,6 +119,16 @@
HOME_SCREEN ->
buildList {
addAll(defaultOptionEntries)
+ if (BaseFlags.get().isPackThemeEnabled()) {
+ add(
+ ThemePickerHomeCustomizationOption.PACK_THEME to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_pack_theme,
+ optionContainer,
+ false,
+ )
+ )
+ }
add(
ThemePickerHomeCustomizationOption.COLORS to
layoutInflater.inflate(