Settings: Add settings to change QS tile shape [2/2]
Change-Id: I03160b6a1c1a73af00526914f633994913aeed2f
diff --git a/res/values/leaf_arrays.xml b/res/values/leaf_arrays.xml
new file mode 100644
index 0000000..10fa78c
--- /dev/null
+++ b/res/values/leaf_arrays.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 The LeafOS 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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- QS tile shape -->
+ <string-array name="qs_tile_shape_entries">
+ <item>@string/qs_tile_round</item>
+ <item>@string/qs_tile_rect</item>
+ <item>@string/qs_tile_mix</item>
+ </string-array>
+
+
+ <string-array name="qs_tile_shape_values">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ </string-array>
+</resources>
diff --git a/res/values/leaf_strings.xml b/res/values/leaf_strings.xml
index c5ecadf..a9c9d2f 100644
--- a/res/values/leaf_strings.xml
+++ b/res/values/leaf_strings.xml
@@ -32,4 +32,15 @@
<!-- Hide power menu on lockscreen -->
<string name="hide_powermenu_lockscreen">Hide power menu on lockscreen</string>
+
+ <!-- QS panel -->
+ <string name="qs_panel_options_title">Quick settings</string>
+ <string name="qs_panel_options_summary">Customize quick settings tiles</string>
+ <string name="category_name_qs_tiles">QS tiles</string>
+
+ <!-- QS tile shape -->
+ <string name="qs_tile_shape">QS tile shape</string>
+ <string name="qs_tile_round">Round</string>
+ <string name="qs_tile_rect">Rounded Rectangle</string>
+ <string name="qs_tile_mix">Round for active tiles and Rounded Rectangle for inactive tiles</string>
</resources>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 2fbbc01..3720708 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -76,6 +76,13 @@
settings:keywords="@string/keywords_dark_ui_mode"/>
<Preference
+ android:key="qs_panel_options"
+ android:persistent="false"
+ android:title="@string/qs_panel_options_title"
+ android:summary="@string/qs_panel_options_summary"
+ android:fragment="org.leafos.settings.qs.QSPanelSettings" />
+
+ <Preference
android:fragment="com.android.settings.accessibility.TextReadingPreferenceFragment"
android:key="text_reading_options"
android:persistent="false"
diff --git a/res/xml/qs_panel_settings.xml b/res/xml/qs_panel_settings.xml
new file mode 100644
index 0000000..a86084b
--- /dev/null
+++ b/res/xml/qs_panel_settings.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The LeafOS 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.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="qs_panel_options"
+ android:title="@string/qs_panel_options_title">
+
+ <PreferenceCategory
+ android:title="@string/category_name_qs_tiles">
+
+ <com.android.settings.support.SecureSettingListPreference
+ android:key="qs_tile_shape"
+ android:title="@string/qs_tile_shape"
+ android:entries="@array/qs_tile_shape_entries"
+ android:entryValues="@array/qs_tile_shape_values"
+ android:defaultValue="2" />
+ </PreferenceCategory>
+</PreferenceScreen>
diff --git a/src/org/leafos/settings/qs/QSPanelSettings.java b/src/org/leafos/settings/qs/QSPanelSettings.java
new file mode 100644
index 0000000..0be5684
--- /dev/null
+++ b/src/org/leafos/settings/qs/QSPanelSettings.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2023 The LeafOS 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 org.leafos.settings.qs;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+@SearchIndexable
+public class QSPanelSettings extends DashboardFragment {
+
+ private static final String TAG = "QSPanelSettings";
+
+ @Override
+ public int getMetricsCategory() {
+ return METRICS_CATEGORY_UNKNOWN;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.qs_panel_settings;
+ }
+
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.qs_panel_settings);
+}