Home option entry UIs (1/2)
Added home screen cutomization option entry UIs
Test: Manually tested. See bug.
Bug: 337941334
Flag: com.android.wallpaper.new_picker_ui_flag
Change-Id: Idd107634c57a387aa3557c3f9b154a0073a9338f
diff --git a/res/layout/customization_option_entry_app_grid.xml b/res/layout/customization_option_entry_app_grid.xml
new file mode 100644
index 0000000..48d493d
--- /dev/null
+++ b/res/layout/customization_option_entry_app_grid.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 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:clickable="true">
+
+ <TextView
+ android:id="@+id/option_entry_app_grid_title"
+ style="@style/SectionTitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/grid_title"
+ android:layout_marginEnd="8dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_app_grid_icon"
+ app:layout_constraintBottom_toTopOf="@+id/option_entry_app_grid_description"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed" />
+
+ <TextView
+ android:id="@+id/option_entry_app_grid_description"
+ style="@style/SectionSubtitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="8dp"
+ android:text="4x4"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_app_grid_icon"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/option_entry_app_grid_title" />
+
+ <FrameLayout
+ android:id="@+id/option_entry_app_grid_icon"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:orientation="horizontal"
+ android:background="@drawable/customization_option_entry_icon_background"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/customization_option_entry_app_shape.xml b/res/layout/customization_option_entry_app_shape.xml
new file mode 100644
index 0000000..7d95274
--- /dev/null
+++ b/res/layout/customization_option_entry_app_shape.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 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:clickable="true">
+
+ <TextView
+ style="@style/SectionTitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/preview_name_shape"
+ android:layout_marginEnd="8dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_app_shape_icon"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed" />
+
+ <FrameLayout
+ android:id="@+id/option_entry_app_shape_icon"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:orientation="horizontal"
+ android:background="@drawable/customization_option_entry_icon_background"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/customization_option_entry_colors.xml b/res/layout/customization_option_entry_colors.xml
new file mode 100644
index 0000000..bd20dc7
--- /dev/null
+++ b/res/layout/customization_option_entry_colors.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 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:clickable="true">
+
+ <TextView
+ style="@style/SectionTitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/color_picker_title"
+ android:layout_marginEnd="8dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_clock_icon"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed" />
+
+ <FrameLayout
+ android:id="@+id/option_entry_clock_icon"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:orientation="horizontal"
+ android:background="@drawable/customization_option_entry_icon_background"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/customization_option_entry_themed_icons.xml b/res/layout/customization_option_entry_themed_icons.xml
new file mode 100644
index 0000000..be8af80
--- /dev/null
+++ b/res/layout/customization_option_entry_themed_icons.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 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"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clickable="true">
+
+ <TextView
+ android:id="@+id/option_entry_themed_icons_title"
+ style="@style/SectionTitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/themed_icon_title"
+ android:layout_marginEnd="8dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_themed_icons_switch"
+ app:layout_constraintBottom_toTopOf="@+id/option_entry_themed_icons_description"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed" />
+
+ <TextView
+ android:id="@+id/option_entry_themed_icons_description"
+ style="@style/SectionSubtitleTextStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="8dp"
+ android:text="@string/beta_title"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_themed_icons_switch"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/option_entry_themed_icons_title" />
+
+ <Switch
+ android:id="@+id/option_entry_themed_icons_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:focusable="false"
+ android:clickable="false"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ style="@style/Switch.SettingsLib"
+ tools:ignore="UseSwitchCompatOrMaterialXml" />
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
index 0bab82e..349c7c5 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
@@ -40,12 +40,14 @@
override fun bind(
view: View,
lockScreenCustomizationOptionEntries: List<Pair<CustomizationOption, View>>,
+ homeScreenCustomizationOptionEntries: List<Pair<CustomizationOption, View>>,
viewModel: CustomizationOptionsViewModel,
lifecycleOwner: LifecycleOwner
) {
defaultCustomizationOptionsBinder.bind(
view,
lockScreenCustomizationOptionEntries,
+ homeScreenCustomizationOptionEntries,
viewModel,
lifecycleOwner
)
diff --git a/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt b/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt
index 5891f93..4905551 100644
--- a/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt
+++ b/src/com/android/wallpaper/customization/ui/util/ThemePickerCustomizationOptionUtil.kt
@@ -21,6 +21,9 @@
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.android.themepicker.R
+import com.android.wallpaper.model.Screen
+import com.android.wallpaper.model.Screen.HOME_SCREEN
+import com.android.wallpaper.model.Screen.LOCK_SCREEN
import com.android.wallpaper.picker.customization.ui.util.CustomizationOptionUtil
import com.android.wallpaper.picker.customization.ui.util.DefaultCustomizationOptionUtil
import dagger.hilt.android.scopes.ActivityScoped
@@ -48,49 +51,90 @@
private var viewMap: Map<CustomizationOptionUtil.CustomizationOption, View>? = null
- override fun getLockOptionEntryViews(
+ override fun getOptionEntries(
+ screen: Screen,
optionContainer: LinearLayout,
- layoutInflater: LayoutInflater
+ layoutInflater: LayoutInflater,
): List<Pair<CustomizationOptionUtil.CustomizationOption, View>> {
- return buildList {
- addAll(
- defaultCustomizationOptionUtil.getLockOptionEntryViews(
- optionContainer,
- layoutInflater
- )
+ val defaultOptionEntries =
+ defaultCustomizationOptionUtil.getOptionEntries(
+ screen,
+ optionContainer,
+ layoutInflater,
)
- add(
- ThemePickerLockCustomizationOption.CLOCK to
- layoutInflater.inflate(
- R.layout.customization_option_entry_clock,
- optionContainer,
- false
+ return when (screen) {
+ LOCK_SCREEN ->
+ buildList {
+ addAll(defaultOptionEntries)
+ add(
+ ThemePickerLockCustomizationOption.CLOCK to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_clock,
+ optionContainer,
+ false,
+ )
)
- )
- add(
- ThemePickerLockCustomizationOption.SHORTCUTS to
- layoutInflater.inflate(
- R.layout.customization_option_entry_keyguard_quick_affordance,
- optionContainer,
- false
+ add(
+ ThemePickerLockCustomizationOption.SHORTCUTS to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_keyguard_quick_affordance,
+ optionContainer,
+ false
+ )
)
- )
- add(
- ThemePickerLockCustomizationOption.SHOW_NOTIFICATIONS to
- layoutInflater.inflate(
- R.layout.customization_option_entry_show_notifications,
- optionContainer,
- false
+ add(
+ ThemePickerLockCustomizationOption.SHOW_NOTIFICATIONS to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_show_notifications,
+ optionContainer,
+ false,
+ )
)
- )
- add(
- ThemePickerLockCustomizationOption.MORE_LOCK_SCREEN_SETTINGS to
- layoutInflater.inflate(
- R.layout.customization_option_entry_more_lock_settings,
- optionContainer,
- false
+ add(
+ ThemePickerLockCustomizationOption.MORE_LOCK_SCREEN_SETTINGS to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_more_lock_settings,
+ optionContainer,
+ false,
+ )
)
- )
+ }
+ HOME_SCREEN ->
+ buildList {
+ addAll(defaultOptionEntries)
+ add(
+ ThemePickerHomeCustomizationOption.COLORS to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_colors,
+ optionContainer,
+ false,
+ )
+ )
+ add(
+ ThemePickerHomeCustomizationOption.APP_GRID to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_app_grid,
+ optionContainer,
+ false,
+ )
+ )
+ add(
+ ThemePickerHomeCustomizationOption.APP_SHAPE to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_app_shape,
+ optionContainer,
+ false,
+ )
+ )
+ add(
+ ThemePickerHomeCustomizationOption.THEMED_ICONS to
+ layoutInflater.inflate(
+ R.layout.customization_option_entry_themed_icons,
+ optionContainer,
+ false,
+ )
+ )
+ }
}
}