aboutsummaryrefslogtreecommitdiff
path: root/doze/res
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-10-14 21:18:03 -0700
committerDavide Garberi <dade.garberi@gmail.com>2017-12-04 09:01:03 +0100
commit2c64d330803b469deffde432e3fbe292ba8a7d26 (patch)
tree4118ab3194cd18aaeb8c44bfd3f2bbb7392673d4 /doze/res
parentf639e2333a933fdb73927a8f8dba99bec8dce0af (diff)
msm8996-common: Bring DozeSettings up to date
* Rework the UI with a SwitchBar * Change to the preferences support library and use fragments * Use all the new fancy RemotePreference stuff * Slot into display settings instead of the dashboard Change-Id: I0850f7d9558a14f739f752f76002db993381a0e5 Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
Diffstat (limited to 'doze/res')
-rw-r--r--doze/res/drawable/switchbar_background.xml21
-rw-r--r--doze/res/layout/doze.xml28
-rw-r--r--doze/res/layout/switch_bar.xml48
-rw-r--r--doze/res/values/colors.xml23
-rw-r--r--doze/res/values/strings.xml10
-rw-r--r--doze/res/values/styles.xml34
-rw-r--r--doze/res/xml/doze_settings.xml18
7 files changed, 168 insertions, 14 deletions
diff --git a/doze/res/drawable/switchbar_background.xml b/doze/res/drawable/switchbar_background.xml
new file mode 100644
index 0000000..45f1578
--- /dev/null
+++ b/doze/res/drawable/switchbar_background.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight">
+ <item android:drawable="@color/switch_bar_background" />
+</ripple>
+
diff --git a/doze/res/layout/doze.xml b/doze/res/layout/doze.xml
new file mode 100644
index 0000000..941cdf6
--- /dev/null
+++ b/doze/res/layout/doze.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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:orientation="vertical"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent">
+
+ <include layout="@layout/switch_bar" />
+
+</LinearLayout>
+
diff --git a/doze/res/layout/switch_bar.xml b/doze/res/layout/switch_bar.xml
new file mode 100644
index 0000000..f98de96
--- /dev/null
+++ b/doze/res/layout/switch_bar.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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:id="@+id/switch_bar"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/actionBarSize"
+ android:background="@drawable/switchbar_background"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:clickable="true"
+ android:gravity="center">
+
+ <TextView android:id="@+id/switch_text"
+ android:layout_height="wrap_content"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_gravity="center_vertical"
+ android:paddingStart="48dp"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:textAppearance="@android:style/TextAppearance.Material.Title"
+ android:textColor="?android:attr/textColorPrimaryInverse"
+ android:textAlignment="viewStart"
+ android:text="@string/switch_bar_on" />
+
+ <Switch
+ android:id="@android:id/switch_widget"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:background="@null"
+ android:theme="@style/ThemeOverlay.SwitchBar" />
+
+</LinearLayout>
diff --git a/doze/res/values/colors.xml b/doze/res/values/colors.xml
new file mode 100644
index 0000000..d598598
--- /dev/null
+++ b/doze/res/values/colors.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2010, 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.
+ */
+-->
+<resources>
+ <color name="switch_bar_background">#ff37474f</color>
+ <color name="switch_accent_color">#ff7fcac3</color>
+ <color name="system_secondary_color">#ff37474F</color>
+</resources>
diff --git a/doze/res/values/strings.xml b/doze/res/values/strings.xml
index 63146cb..fed5b05 100644
--- a/doze/res/values/strings.xml
+++ b/doze/res/values/strings.xml
@@ -13,8 +13,16 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Label for feature switch [CHAR LIMIT=30] -->
+ <string name="switch_bar_on">On</string>
+
+ <!-- Label for feature switch [CHAR LIMIT=30] -->
+ <string name="switch_bar_off">Off</string>
+
<string name="ambient_display_title">Ambient display</string>
<string name="ambient_display_summary">Wake screen when you receive notifications</string>
+ <string name="ambient_display_summary_on">Screen will wake when you receive notifications</string>
+ <string name="ambient_display_summary_off">Screen will not wake when you receive notifications</string>
<!-- Tilt sensor -->
<string name="tilt_sensor_title">Tilt sensor</string>
@@ -31,5 +39,5 @@
<!-- Help text -->
<string name="dlg_ok">OK</string>
<string name="doze_settings_help_title">Help</string>
- <string name="doze_settings_help_text">These features use sensor events to launch a doze notification pulse. The chosen sensor is only enabled when the device receives a notification, this helps to reduce battery usage. There is also an option to enable the chosen sensor as soon as the screen turns off, this will cause higher battery usage.</string>
+ <string name="doze_settings_help_text">These features use sensor events to launch a doze notification pulse, this will cause higher battery usage.</string>
</resources>
diff --git a/doze/res/values/styles.xml b/doze/res/values/styles.xml
new file mode 100644
index 0000000..78d2d59
--- /dev/null
+++ b/doze/res/values/styles.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The CyanogenMod 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:android="http://schemas.android.com/apk/res/android">
+ <style name="DozeSettings" parent="@android:style/Theme.Material.Settings">
+ <item name="android:windowActionBar">false</item>
+ <item name="preferenceTheme">@style/DozePreferenceTheme</item>
+ </style>
+
+ <style name="DozePreferenceTheme" parent="@android:style/Theme.Material.Settings">
+ <item name="dropdownPreferenceStyle">@style/Preference.DropDown.Material</item>
+ </style>
+
+ <style name="ThemeOverlay.SwitchBar" parent="@android:style/ThemeOverlay">
+ <item name="android:colorAccent">@color/switch_accent_color</item>
+ </style>
+
+ <style name="ThemeOverlay.SwitchBar.Secondary" parent="@android:style/ThemeOverlay">
+ <item name="android:colorAccent">@color/system_secondary_color</item>
+ </style>
+
+</resources>
diff --git a/doze/res/xml/doze_settings.xml b/doze/res/xml/doze_settings.xml
index dfa608b..acc19d2 100644
--- a/doze/res/xml/doze_settings.xml
+++ b/doze/res/xml/doze_settings.xml
@@ -14,13 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
-
- <SwitchPreference
- android:key="ambient_display"
- android:defaultValue="true"
- android:title="@string/ambient_display_title"
- android:summary="@string/ambient_display_summary" />
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:cm="http://schemas.android.com/apk/res/cyanogenmod.platform">
<PreferenceCategory
android:key="tilt_sensor"
@@ -30,8 +25,7 @@
android:key="pick_up"
android:defaultValue="false"
android:title="@string/pick_up_title"
- android:summary="@string/pick_up_summary"
- android:dependency="ambient_display" />
+ android:summary="@string/pick_up_summary" />
</PreferenceCategory>
@@ -43,15 +37,13 @@
android:key="gesture_hand_wave"
android:defaultValue="false"
android:title="@string/hand_wave_gesture_title"
- android:summary="@string/hand_wave_gesture_summary"
- android:dependency="ambient_display" />
+ android:summary="@string/hand_wave_gesture_summary" />
<SwitchPreference
android:key="gesture_pocket"
android:defaultValue="false"
android:title="@string/pocket_gesture_title"
- android:summary="@string/pocket_gesture_summary"
- android:dependency="ambient_display" />
+ android:summary="@string/pocket_gesture_summary" />
</PreferenceCategory>