sanders: LineageActions: Upgrade to Oreo Settings UI

* Attach to appropriate Settings pages
 * Hide divider lines to match Settings UI styles
 * Apply On/Off text on the switch bar toggle
 * Implement AOSP Settings preference layouts for indentation

 * Depends on android_packages_resources_devicesettings:
    "DeviceSettings: Import Oreo Settings layouts"
    Ib3f670b19c7e728b97fd76efe04bcc2f69008b06

 * Partially based upon commit "Bring DozeSettings up to date"
    I0850f7d9558a14f739f752f76002db993381a0e5 by Steve Kondik
    for the SwitchBar integration but using native themes

Change-Id: Ic5b8335aafc9ce876ed90a25045398e39515e484
Signed-off-by: Adrian DC <radian.dc@gmail.com>
Signed-off-by: jhenrique09 <jhenrique09.mcz@hotmail.com>
This commit is contained in:
AdrianDC
2017-10-23 14:38:48 -03:00
committed by therootlord
parent c0c11cd323
commit da5bdbbaca
23 changed files with 590 additions and 219 deletions

View File

@@ -4,14 +4,14 @@
android:height="24dp"
android:viewportWidth="1000.000000"
android:viewportHeight="1000.000000"
android:tint="?android:attr/colorAccent">
android:tint="?android:attr/colorControlNormal">
<group
android:translateY="1000.000000"
android:scaleX="0.100000"
android:scaleY="-0.100000">
<path
android:fillColor="@android:color/white"
android:fillColor="#FFFFFFFF"
android:strokeWidth="1"
android:pathData="M3022 9600 c-109 -29 -187 -74 -272 -160 -87 -86 -131 -163 -160 -276 -20 -76 -20
-127 -20 -4094 0 -3967 0 -4018 20 -4094 29 -113 73 -190 160 -276 86 -87 163 -131

View File

@@ -4,6 +4,6 @@
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorAccent">
<path android:fillColor="@android:color/white" android:pathData="M11.83,1.73C8.43,1.79 6.23,3.32 6.23,3.32C5.95,3.5 5.88,3.91 6.07,4.19C6.27,4.5 6.66,4.55 6.96,4.34C6.96,4.34 11.27,1.15 17.46,4.38C17.75,4.55 18.14,4.45 18.31,4.15C18.5,3.85 18.37,3.47 18.03,3.28C16.36,2.4 14.78,1.96 13.36,1.8C12.83,1.74 12.32,1.72 11.83,1.73M12.22,4.34C6.26,4.26 3.41,9.05 3.41,9.05C3.22,9.34 3.3,9.72 3.58,9.91C3.87,10.1 4.26,10 4.5,9.68C4.5,9.68 6.92,5.5 12.2,5.59C17.5,5.66 19.82,9.65 19.82,9.65C20,9.94 20.38,10.04 20.68,9.87C21,9.69 21.07,9.31 20.9,9C20.9,9 18.15,4.42 12.22,4.34M11.5,6.82C9.82,6.94 8.21,7.55 7,8.56C4.62,10.53 3.1,14.14 4.77,19C4.88,19.33 5.24,19.5 5.57,19.39C5.89,19.28 6.07,18.92 5.95,18.6V18.6C4.41,14.13 5.78,11.2 7.8,9.5C9.77,7.89 13.25,7.5 15.84,9.1C17.11,9.9 18.1,11.28 18.6,12.64C19.11,14 19.08,15.32 18.67,15.94C18.25,16.59 17.4,16.83 16.65,16.64C15.9,16.45 15.29,15.91 15.26,14.77C15.23,13.06 13.89,12 12.5,11.84C11.16,11.68 9.61,12.4 9.21,14C8.45,16.92 10.36,21.07 14.78,22.45C15.11,22.55 15.46,22.37 15.57,22.04C15.67,21.71 15.5,21.35 15.15,21.25C11.32,20.06 9.87,16.43 10.42,14.29C10.66,13.33 11.5,13 12.38,13.08C13.25,13.18 14,13.7 14,14.79C14.05,16.43 15.12,17.54 16.34,17.85C17.56,18.16 18.97,17.77 19.72,16.62C20.5,15.45 20.37,13.8 19.78,12.21C19.18,10.61 18.07,9.03 16.5,8.04C14.96,7.08 13.19,6.7 11.5,6.82M11.86,9.25V9.26C10.08,9.32 8.3,10.24 7.28,12.18C5.96,14.67 6.56,17.21 7.44,19.04C8.33,20.88 9.54,22.1 9.54,22.1C9.78,22.35 10.17,22.35 10.42,22.11C10.67,21.87 10.67,21.5 10.43,21.23C10.43,21.23 9.36,20.13 8.57,18.5C7.78,16.87 7.3,14.81 8.38,12.77C9.5,10.67 11.5,10.16 13.26,10.67C15.04,11.19 16.53,12.74 16.5,15.03C16.46,15.38 16.71,15.68 17.06,15.7C17.4,15.73 17.7,15.47 17.73,15.06C17.79,12.2 15.87,10.13 13.61,9.47C13.04,9.31 12.45,9.23 11.86,9.25M12.08,14.25C11.73,14.26 11.46,14.55 11.47,14.89C11.47,14.89 11.5,16.37 12.31,17.8C13.15,19.23 14.93,20.59 18.03,20.3C18.37,20.28 18.64,20 18.62,19.64C18.6,19.29 18.3,19.03 17.91,19.06C15.19,19.31 14.04,18.28 13.39,17.17C12.74,16.07 12.72,14.88 12.72,14.88C12.72,14.53 12.44,14.25 12.08,14.25Z" />
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#FFFFFFFF" android:pathData="M11.83,1.73C8.43,1.79 6.23,3.32 6.23,3.32C5.95,3.5 5.88,3.91 6.07,4.19C6.27,4.5 6.66,4.55 6.96,4.34C6.96,4.34 11.27,1.15 17.46,4.38C17.75,4.55 18.14,4.45 18.31,4.15C18.5,3.85 18.37,3.47 18.03,3.28C16.36,2.4 14.78,1.96 13.36,1.8C12.83,1.74 12.32,1.72 11.83,1.73M12.22,4.34C6.26,4.26 3.41,9.05 3.41,9.05C3.22,9.34 3.3,9.72 3.58,9.91C3.87,10.1 4.26,10 4.5,9.68C4.5,9.68 6.92,5.5 12.2,5.59C17.5,5.66 19.82,9.65 19.82,9.65C20,9.94 20.38,10.04 20.68,9.87C21,9.69 21.07,9.31 20.9,9C20.9,9 18.15,4.42 12.22,4.34M11.5,6.82C9.82,6.94 8.21,7.55 7,8.56C4.62,10.53 3.1,14.14 4.77,19C4.88,19.33 5.24,19.5 5.57,19.39C5.89,19.28 6.07,18.92 5.95,18.6V18.6C4.41,14.13 5.78,11.2 7.8,9.5C9.77,7.89 13.25,7.5 15.84,9.1C17.11,9.9 18.1,11.28 18.6,12.64C19.11,14 19.08,15.32 18.67,15.94C18.25,16.59 17.4,16.83 16.65,16.64C15.9,16.45 15.29,15.91 15.26,14.77C15.23,13.06 13.89,12 12.5,11.84C11.16,11.68 9.61,12.4 9.21,14C8.45,16.92 10.36,21.07 14.78,22.45C15.11,22.55 15.46,22.37 15.57,22.04C15.67,21.71 15.5,21.35 15.15,21.25C11.32,20.06 9.87,16.43 10.42,14.29C10.66,13.33 11.5,13 12.38,13.08C13.25,13.18 14,13.7 14,14.79C14.05,16.43 15.12,17.54 16.34,17.85C17.56,18.16 18.97,17.77 19.72,16.62C20.5,15.45 20.37,13.8 19.78,12.21C19.18,10.61 18.07,9.03 16.5,8.04C14.96,7.08 13.19,6.7 11.5,6.82M11.86,9.25V9.26C10.08,9.32 8.3,10.24 7.28,12.18C5.96,14.67 6.56,17.21 7.44,19.04C8.33,20.88 9.54,22.1 9.54,22.1C9.78,22.35 10.17,22.35 10.42,22.11C10.67,21.87 10.67,21.5 10.43,21.23C10.43,21.23 9.36,20.13 8.57,18.5C7.78,16.87 7.3,14.81 8.38,12.77C9.5,10.67 11.5,10.16 13.26,10.67C15.04,11.19 16.53,12.74 16.5,15.03C16.46,15.38 16.71,15.68 17.06,15.7C17.4,15.73 17.7,15.47 17.73,15.06C17.79,12.2 15.87,10.13 13.61,9.47C13.04,9.31 12.45,9.23 11.86,9.25M12.08,14.25C11.73,14.26 11.46,14.55 11.47,14.89C11.47,14.89 11.5,16.37 12.31,17.8C13.15,19.23 14.93,20.59 18.03,20.3C18.37,20.28 18.64,20 18.62,19.64C18.6,19.29 18.3,19.03 17.91,19.06C15.19,19.31 14.04,18.28 13.39,17.17C12.74,16.07 12.72,14.88 12.72,14.88C12.72,14.53 12.44,14.25 12.08,14.25Z" />
</vector>

View File

@@ -19,10 +19,10 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorAccent">
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:fillColor="#FFFFFFFF"
android:pathData="M4.7,6.9c0.7-0.7,1.4-1.4,1.7-1.2c0.5,0.2,0,1-0.3,1.5c-0.2,0.4-2.8,3.9-2.8,6.3c0,1.3,0.5,2.3,1.3,3
c0.7,0.6,1.7,0.7,2.6,0.5c1.1-0.3,1.9-1.4,3-2.8c1.2-1.5,2.8-3.4,4-3.4c1.6,0,1.6,1,1.7,1.8c-3.7,0.6-5.3,3.7-5.3,5.4
s1.4,3.1,3.2,3.1c1.6,0,4.3-1.3,4.6-6.1H21v-2.5h-2.4c-0.1-1.7-1.1-4.2-4-4.2c-2.2,0-4.1,1.9-4.9,2.8c-0.6,0.7-2,2.5-2.3,2.7

View File

@@ -15,8 +15,8 @@
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorAccent">
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:fillColor="#FFFFFFFF"
android:pathData="M9,11.24L9,7.5C9,6.12 10.12,5 11.5,5S14,6.12 14,7.5v3.74c1.21,-0.81 2,-2.18 2,-3.74C16,5.01 13.99,3 11.5,3S7,5.01 7,7.5c0,1.56 0.79,2.93 2,3.74zM18.84,15.87l-4.54,-2.26c-0.17,-0.07 -0.35,-0.11 -0.54,-0.11L13,13.5v-6c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,6.67 10,7.5v10.74l-3.43,-0.72c-0.08,-0.01 -0.15,-0.03 -0.24,-0.03 -0.31,0 -0.59,0.13 -0.79,0.33l-0.79,0.8 4.94,4.94c0.27,0.27 0.65,0.44 1.06,0.44h6.79c0.75,0 1.33,-0.55 1.44,-1.28l0.75,-5.27c0.01,-0.07 0.02,-0.14 0.02,-0.2 0,-0.62 -0.38,-1.16 -0.91,-1.38z"/>
</vector>

View File

@@ -0,0 +1,20 @@
<?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="?android:attr/colorSecondary" />
</ripple>

View File

@@ -0,0 +1,27 @@
<?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>

View File

@@ -0,0 +1,27 @@
<?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>

View File

@@ -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/textColorPrimary"
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/LineageActions.SwitchBar" />
</LinearLayout>

View File

@@ -16,14 +16,43 @@
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<style name="LineageActions" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="preferenceTheme">@style/SettingsPreference</item>
<item name="dialogPreferenceStyle">@style/LineageActions.DialogPreferenceStyle</item>
<item name="preferenceCategoryStyle">@style/LineageActions.PreferenceCategoryStyle</item>
<item name="preferenceFragmentStyle">@style/LineageActions.PreferenceFragmentStyle</item>
<item name="preferenceStyle">@style/LineageActions.PreferenceStyle</item>
<item name="preferenceTheme">@style/LineageActions.PreferenceTheme</item>
<item name="switchPreferenceStyle">@style/LineageActions.SwitchPreferenceStyle</item>
</style>
<!-- Preferences -->
<style name="SettingsPreference">
<style name="LineageActions.DialogPreferenceStyle" parent="@style/LineageActions.PreferenceStyle">
</style>
<style name="LineageActions.PreferenceCategoryStyle" parent="@*android:style/Preference.DeviceDefault.Category">
<item name="allowDividerAbove">true</item>
<item name="allowDividerBelow">true</item>
<item name="android:layout">@layout/preference_category_material_settings</item>
</style>
<style name="LineageActions.PreferenceFragmentStyle" parent="@*android:style/PreferenceFragment.Material">
<item name="allowDividerAfterLastItem">false</item>
</style>
<style name="LineageActions.PreferenceStyle" parent="@*android:style/Preference.DeviceDefault">
<item name="allowDividerAbove">false</item>
<item name="allowDividerBelow">true</item>
<item name="singleLineTitle">false</item>
<item name="android:layout">@layout/preference_material_settings</item>
</style>
<style name="LineageActions.PreferenceTheme">
</style>
<style name="LineageActions.SwitchPreferenceStyle" parent="@style/LineageActions.PreferenceStyle">
<item name="widgetLayout">@*android:layout/preference_widget_switch</item>
</style>
<style name="LineageActions.SwitchBar" parent="@android:style/ThemeOverlay.Material.ActionBar">
</style>
</resources>

View File

@@ -17,24 +17,16 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<SwitchPreference
android:key="doze_enabled"
android:defaultValue="true"
android:title="@string/ambient_display_enable_title"
android:summary="@string/ambient_display_enable_summary" />
<SwitchPreference
android:key="gesture_pick_up"
android:defaultValue="true"
android:title="@string/pick_up_gesture_title"
android:summary="@string/pick_up_gesture_summary"
android:dependency="doze_enabled" />
android:summary="@string/pick_up_gesture_summary" />
<SwitchPreference
android:key="gesture_hand_wave"
android:defaultValue="true"
android:title="@string/hand_wave_gesture_title"
android:summary="@string/hand_wave_gesture_summary"
android:dependency="doze_enabled" />
android:summary="@string/hand_wave_gesture_summary" />
</PreferenceScreen>

View File

@@ -15,31 +15,17 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<SwitchPreference
android:key="fp_home"
android:title="@string/fingerprint_gestures_title"
android:summary="@string/fingerprint_gestures_summary" />
<SwitchPreference
android:key="fp_home_scr_off"
android:dependency="fp_home"
android:enabled="false"
android:title="@string/fingerprint_gestures_screenoff_title"
android:summary="@string/fingerprint_gestures_screenoff_summary" />
<PreferenceCategory
android:key="fp_keys_scr_on"
android:title="@string/fingerprint_actions_screenon" >
<SwitchPreference
android:key="fp_haptic"
android:dependency="fp_home"
android:defaultValue="0"
android:title="@string/haptic_feedback"
android:summary="@string/haptic_feedback_summary" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_tap_dlg_title"
@@ -49,7 +35,6 @@
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_double_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_double_tap_dlg_title"
@@ -59,7 +44,6 @@
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_long_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_long_tap_dlg_title"
@@ -69,7 +53,6 @@
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_swipe_left_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_swipe_left_dlg_title"
@@ -79,7 +62,6 @@
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_swipe_right_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_swipe_right_dlg_title"
@@ -89,6 +71,12 @@
android:entryValues="@array/fp_keys_listValues" />
</PreferenceCategory>
<SwitchPreference
android:key="fp_home_scr_off"
android:enabled="false"
android:title="@string/fingerprint_gestures_screenoff_title"
android:summary="@string/fingerprint_gestures_screenoff_summary" />
<PreferenceCategory
android:key="fp_keys_scr_off"
android:title="@string/fingerprint_actions_screenoff"

View File

@@ -18,44 +18,44 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceScreen
<Preference
android:key="gestures"
android:title="@string/device_gestures_title"
android:summary="@string/device_gestures_summary"
android:icon="@drawable/ic_settings_gestures">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.GestureSettings" />
</PreferenceScreen>
android:targetClass="org.lineageos.settings.device.GestureSettingsActivity" />
</Preference>
<PreferenceScreen
<Preference
android:key="doze"
android:title="@string/ambient_display_title"
android:summary="@string/ambient_display_manage_summary"
android:icon="@drawable/ic_settings_doze">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.DozeSettings" />
</PreferenceScreen>
android:targetClass="org.lineageos.settings.device.DozeSettingsActivity" />
</Preference>
<PreferenceScreen
<Preference
android:key="fp_gestures"
android:title="@string/fingerprint_gestures_title"
android:summary="@string/fingerprint_gestures_manage_summary"
android:icon="@drawable/ic_settings_fingerprint">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.FPGestureSettings" />
</PreferenceScreen>
android:targetClass="org.lineageos.settings.device.FPGestureSettingsActivity" />
</Preference>
<PreferenceScreen
<Preference
android:key="screen_off_gestures"
android:title="@string/screen_off_gestures_title"
android:summary="@string/screen_off_gestures_manage_summary"
android:icon="@drawable/ic_settings_screen_off_gestures">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.ScreenOffGestureSettings" />
</PreferenceScreen>
android:targetClass="org.lineageos.settings.device.ScreenOffGestureSettingsActivity" />
</Preference>
</PreferenceScreen>