Merge "Adds "more option" section." into tm-qpr-dev am: cbad0d9bb5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/ThemePicker/+/21113147
Change-Id: Iac22afe14d2dff95ab47e35e3bda57128ce441a5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/res/layout/more_settings_section_view.xml b/res/layout/more_settings_section_view.xml
new file mode 100644
index 0000000..b60bb45
--- /dev/null
+++ b/res/layout/more_settings_section_view.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 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.
+-->
+<com.android.customization.picker.settings.ui.view.MoreSettingsSectionView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?selectableItemBackground"
+ android:clickable="true"
+ android:paddingVertical="@dimen/section_top_padding"
+ android:paddingHorizontal="@dimen/section_horizontal_padding"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/more_settings_section_title"
+ style="@style/SectionTitleTextStyle" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/more_settings_section_description"
+ style="@style/SectionSubtitleTextStyle"/>
+
+</com.android.customization.picker.settings.ui.view.MoreSettingsSectionView>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 313fea8..83367d4 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -388,4 +388,22 @@
[CHAR LIMIT=64].
-->
<string name="hide_notifications_on_lock_screen">Hide notifications on the lock screen</string>
+
+ <!--
+ Title for a section in a list of sections in the settings app that allows the user to access
+ additional settings related to lock screen behaviour.
+
+ [CHAR LIMIT=32].
+ -->
+ <string name="more_settings_section_title">More options</string>
+
+ <!--
+ Summary for a setting that lets the user access additional settings related to lock screen
+ behaviour. Please note that "Now Playing" is an entity; it's a name of an existing feature
+ that allows users to see the song that the device is picking up through its microphone on
+ the lock screen; therefore, it should not be translated literally.
+
+ [CHAR LIMIT=64].
+ -->
+ <string name="more_settings_section_description">Text on lock screen, Now Playing, and more</string>
</resources>
diff --git a/src/com/android/customization/module/DefaultCustomizationSections.java b/src/com/android/customization/module/DefaultCustomizationSections.java
index 46f0334..c7fa255 100644
--- a/src/com/android/customization/module/DefaultCustomizationSections.java
+++ b/src/com/android/customization/module/DefaultCustomizationSections.java
@@ -19,6 +19,7 @@
import com.android.customization.picker.quickaffordance.domain.interactor.KeyguardQuickAffordancePickerInteractor;
import com.android.customization.picker.quickaffordance.ui.section.KeyguardQuickAffordanceSectionController;
import com.android.customization.picker.quickaffordance.ui.viewmodel.KeyguardQuickAffordancePickerViewModel;
+import com.android.customization.picker.settings.ui.section.MoreSettingsSectionController;
import com.android.wallpaper.model.CustomizationSectionController;
import com.android.wallpaper.model.CustomizationSectionController.CustomizationSectionNavigationController;
import com.android.wallpaper.model.PermissionRequester;
@@ -114,6 +115,9 @@
mNotificationSectionViewModelFactory)
.get(NotificationSectionViewModel.class),
lifecycleOwner));
+
+ // More settings section.
+ sectionControllers.add(new MoreSettingsSectionController());
break;
case HOME_SCREEN:
diff --git a/src/com/android/customization/picker/settings/ui/section/MoreSettingsSectionController.kt b/src/com/android/customization/picker/settings/ui/section/MoreSettingsSectionController.kt
new file mode 100644
index 0000000..146aca1
--- /dev/null
+++ b/src/com/android/customization/picker/settings/ui/section/MoreSettingsSectionController.kt
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ */
+
+package com.android.customization.picker.settings.ui.section
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.content.Intent
+import android.provider.Settings
+import android.view.LayoutInflater
+import com.android.customization.picker.settings.ui.view.MoreSettingsSectionView
+import com.android.wallpaper.R
+import com.android.wallpaper.model.CustomizationSectionController
+
+class MoreSettingsSectionController : CustomizationSectionController<MoreSettingsSectionView> {
+
+ override fun isAvailable(context: Context?): Boolean {
+ return true
+ }
+
+ @SuppressLint("InflateParams") // We're okay not providing a parent view.
+ override fun createView(context: Context?): MoreSettingsSectionView {
+ return LayoutInflater.from(context)
+ .inflate(R.layout.more_settings_section_view, null)
+ .apply {
+ setOnClickListener {
+ context?.startActivity(Intent(Settings.ACTION_LOCKSCREEN_SETTINGS))
+ }
+ } as MoreSettingsSectionView
+ }
+}
diff --git a/src/com/android/customization/picker/settings/ui/view/MoreSettingsSectionView.kt b/src/com/android/customization/picker/settings/ui/view/MoreSettingsSectionView.kt
new file mode 100644
index 0000000..5de856e
--- /dev/null
+++ b/src/com/android/customization/picker/settings/ui/view/MoreSettingsSectionView.kt
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ *
+ */
+
+package com.android.customization.picker.settings.ui.view
+
+import android.content.Context
+import android.util.AttributeSet
+import com.android.wallpaper.picker.SectionView
+
+class MoreSettingsSectionView(
+ context: Context,
+ attrs: AttributeSet?,
+) :
+ SectionView(
+ context,
+ attrs,
+ )