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:
@@ -14,6 +14,10 @@
|
||||
|
||||
<protected-broadcast android:name="com.android.systemui.doze.pulse" />
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="26"
|
||||
android:targetSdkVersion="26" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/moto_actions_title"
|
||||
@@ -34,7 +38,7 @@
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name=".DozeSettings"
|
||||
android:name=".DozeSettingsActivity"
|
||||
android:label="@string/ambient_display_title"
|
||||
android:theme="@style/LineageActions">
|
||||
<intent-filter>
|
||||
@@ -49,7 +53,7 @@
|
||||
android:summary="@string/device_gestures_summary"
|
||||
android:theme="@style/LineageActions">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.EXTRA_SETTINGS" />
|
||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="com.android.settings.category"
|
||||
@@ -63,19 +67,19 @@
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".GestureSettings"
|
||||
android:name=".GestureSettingsActivity"
|
||||
android:label="@string/device_gestures_title"
|
||||
android:theme="@style/LineageActions">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".FPGestureSettings"
|
||||
android:name=".FPGestureSettingsActivity"
|
||||
android:label="@string/fingerprint_gestures_title"
|
||||
android:theme="@style/LineageActions">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ScreenOffGestureSettings"
|
||||
android:name=".ScreenOffGestureSettingsActivity"
|
||||
android:label="@string/screen_off_gestures_title"
|
||||
android:theme="@style/LineageActions">
|
||||
</activity>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
20
LineageActions/res/drawable/switchbar_background.xml
Normal file
20
LineageActions/res/drawable/switchbar_background.xml
Normal 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>
|
||||
27
LineageActions/res/layout/doze.xml
Normal file
27
LineageActions/res/layout/doze.xml
Normal 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>
|
||||
27
LineageActions/res/layout/fp_gesture.xml
Normal file
27
LineageActions/res/layout/fp_gesture.xml
Normal 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>
|
||||
48
LineageActions/res/layout/switch_bar.xml
Normal file
48
LineageActions/res/layout/switch_bar.xml
Normal 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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 The LineageOS 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.lineageos.settings.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.provider.Settings;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class DozeSettings extends PreferenceActivity {
|
||||
|
||||
|
||||
private static final String KEY_AMBIENT_DISPLAY_ENABLE = "doze_enabled";
|
||||
|
||||
private SwitchPreference mAmbientDisplayPreference;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.doze_panel);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
boolean dozeEnabled = LineageActionsSettings.isDozeEnabled(getContentResolver());
|
||||
mAmbientDisplayPreference = (SwitchPreference) findPreference(KEY_AMBIENT_DISPLAY_ENABLE);
|
||||
// Read from DOZE_ENABLED secure setting
|
||||
mAmbientDisplayPreference.setChecked(dozeEnabled);
|
||||
mAmbientDisplayPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean enable = (boolean) newValue;
|
||||
return enableDoze(enable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean enableDoze(boolean enable) {
|
||||
return Settings.Secure.putInt(getContentResolver(),
|
||||
Settings.Secure.DOZE_ENABLED, enable ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
public class DozeSettingsActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState == null){
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new DozeSettingsFragment()).commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2017 The LineageOS 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.lineageos.settings.device;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.os.Bundle;
|
||||
import android.support.v14.preference.PreferenceFragment;
|
||||
import android.provider.Settings;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.view.MenuItem;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class DozeSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private SwitchPreference mHandwavePreference;
|
||||
private SwitchPreference mPickupPreference;
|
||||
|
||||
private TextView mSwitchBarText;
|
||||
private Switch mAmbientDisplaySwitch;
|
||||
|
||||
private String KEY_GESTURE_HAND_WAVE = "gesture_hand_wave";
|
||||
private String KEY_GESTURE_PICK_UP = "gesture_pick_up";
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
ActionBar actionbar = getActivity().getActionBar();
|
||||
actionbar.setDisplayHomeAsUpEnabled(true);
|
||||
actionbar.setTitle(R.string.ambient_display_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final View view = LayoutInflater.from(getContext()).inflate(R.layout.doze, container, false);
|
||||
((ViewGroup) view).addView(super.onCreateView(inflater, container, savedInstanceState));
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
View switchBar = view.findViewById(R.id.switch_bar);
|
||||
mAmbientDisplaySwitch = (Switch) switchBar.findViewById(android.R.id.switch_widget);
|
||||
mAmbientDisplaySwitch.setChecked(LineageActionsSettings.isDozeEnabled(getActivity().getContentResolver()));
|
||||
mAmbientDisplaySwitch.setOnCheckedChangeListener(mAmbientDisplayPrefListener);
|
||||
|
||||
switchBar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mAmbientDisplaySwitch.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
mSwitchBarText = switchBar.findViewById(R.id.switch_text);
|
||||
mSwitchBarText.setText(LineageActionsSettings.isDozeEnabled(getActivity().getContentResolver()) ? R.string.switch_bar_on :
|
||||
R.string.switch_bar_off);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.doze_panel);
|
||||
boolean dozeEnabled = LineageActionsSettings.isDozeEnabled(getActivity().getContentResolver());
|
||||
mHandwavePreference = (SwitchPreference) findPreference(KEY_GESTURE_HAND_WAVE);
|
||||
mPickupPreference = (SwitchPreference) findPreference(KEY_GESTURE_PICK_UP);
|
||||
updatePrefs(dozeEnabled);
|
||||
}
|
||||
|
||||
private CompoundButton.OnCheckedChangeListener mAmbientDisplayPrefListener =
|
||||
new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean enable) {
|
||||
if (enableDoze(enable)) {
|
||||
updatePrefs(enable);
|
||||
mSwitchBarText.setText(enable ? R.string.switch_bar_on : R.string.switch_bar_off);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void updatePrefs(boolean enabled){
|
||||
mHandwavePreference.setEnabled(enabled);
|
||||
mPickupPreference.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private boolean enableDoze(boolean enable) {
|
||||
return Settings.Secure.putInt(getActivity().getContentResolver(),
|
||||
Settings.Secure.DOZE_ENABLED, enable ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.content.Context;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class FPGestureSettings extends PreferenceActivity {
|
||||
|
||||
private SwitchPreference mFPScreenOffGesture;
|
||||
private PreferenceCategory mFPScreenOffCategory;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.fp_gesture_panel);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
mFPScreenOffGesture = (SwitchPreference) findPreference("fp_home_scr_off");
|
||||
mFPScreenOffCategory = (PreferenceCategory) findPreference("fp_keys_scr_off");
|
||||
boolean hasEnrolledFingerprints = hasEnrolledFingerprints();
|
||||
mFPScreenOffGesture.setEnabled(!hasEnrolledFingerprints);
|
||||
mFPScreenOffCategory.setEnabled(!hasEnrolledFingerprints);
|
||||
}
|
||||
|
||||
private boolean hasEnrolledFingerprints(){
|
||||
FingerprintManager fingerprintManager = (FingerprintManager) getSystemService(Context.FINGERPRINT_SERVICE);
|
||||
return fingerprintManager.hasEnrolledFingerprints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
public class FPGestureSettingsActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState == null){
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new FPGestureSettingsFragment()).commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.os.Bundle;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.preference.PreferenceCategory;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.support.v14.preference.PreferenceFragment;
|
||||
import android.view.MenuItem;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.lineageos.settings.device.actions.Constants;
|
||||
|
||||
import static org.lineageos.settings.device.actions.Constants.FP_HOME_KEY;
|
||||
import static org.lineageos.settings.device.actions.Constants.FP_HOME_KEY_OFF;
|
||||
|
||||
public class FPGestureSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private SwitchPreference mFPScreenOffGesture;
|
||||
private PreferenceCategory mFPScreenOffCategory;
|
||||
private PreferenceCategory mFPScreenOnCategory;
|
||||
|
||||
private TextView mSwitchBarText;
|
||||
private Switch mFPGestureSwitch;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
ActionBar actionbar = getActivity().getActionBar();
|
||||
actionbar.setDisplayHomeAsUpEnabled(true);
|
||||
actionbar.setTitle(R.string.fingerprint_gestures_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final View view = LayoutInflater.from(getContext()).inflate(R.layout.fp_gesture, container, false);
|
||||
((ViewGroup) view).addView(super.onCreateView(inflater, container, savedInstanceState));
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
View switchBar = view.findViewById(R.id.switch_bar);
|
||||
mFPGestureSwitch = (Switch) switchBar.findViewById(android.R.id.switch_widget);
|
||||
mFPGestureSwitch.setChecked(isFPGestureEnabled());
|
||||
mFPGestureSwitch.setOnCheckedChangeListener(mFPGesturePrefListener);
|
||||
|
||||
switchBar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mFPGestureSwitch.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
mSwitchBarText = switchBar.findViewById(R.id.switch_text);
|
||||
mSwitchBarText.setText(isFPGestureEnabled() ? R.string.switch_bar_on :
|
||||
R.string.switch_bar_off);
|
||||
}
|
||||
|
||||
private void updatePrefs(boolean enabled){
|
||||
Editor prefEditor = PreferenceManager.getDefaultSharedPreferences(getActivity()).edit();
|
||||
prefEditor.putBoolean(FP_HOME_KEY, enabled);
|
||||
prefEditor.apply();
|
||||
mFPScreenOnCategory.setEnabled(enabled);
|
||||
mFPScreenOffGesture.setEnabled(enabled);
|
||||
mFPScreenOffCategory.setEnabled(enabled);
|
||||
if(enabled){
|
||||
boolean hasEnrolledFingerprints = hasEnrolledFingerprints();
|
||||
mFPScreenOffGesture.setEnabled(!hasEnrolledFingerprints);
|
||||
mFPScreenOffCategory.setEnabled(!hasEnrolledFingerprints);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFPGestureEnabled(){
|
||||
return Constants.isPreferenceEnabled(getActivity(), FP_HOME_KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.fp_gesture_panel);
|
||||
mFPScreenOffGesture = (SwitchPreference) findPreference(FP_HOME_KEY_OFF);
|
||||
mFPScreenOffCategory = (PreferenceCategory) findPreference("fp_keys_scr_off");
|
||||
mFPScreenOnCategory = (PreferenceCategory) findPreference("fp_keys_scr_on");
|
||||
updatePrefs(isFPGestureEnabled());
|
||||
}
|
||||
|
||||
private CompoundButton.OnCheckedChangeListener mFPGesturePrefListener =
|
||||
new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean enable) {
|
||||
updatePrefs(enable);
|
||||
mSwitchBarText.setText(enable ? R.string.switch_bar_on : R.string.switch_bar_off);
|
||||
}
|
||||
};
|
||||
|
||||
private boolean hasEnrolledFingerprints(){
|
||||
FingerprintManager fingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
|
||||
return fingerprintManager.hasEnrolledFingerprints();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
public class GestureSettingsActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState == null){
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new GestureSettingsFragment()).commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,32 +22,36 @@ import android.os.Bundle;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.support.v14.preference.PreferenceFragment;
|
||||
import android.support.v7.preference.PreferenceCategory;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceClickListener;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class GestureSettings extends PreferenceActivity {
|
||||
public class GestureSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private SwitchPreference mFlipPref;
|
||||
private NotificationManager mNotificationManager;
|
||||
private boolean mFlipClick = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.actions_panel);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mFlipPref = (SwitchPreference) findPreference("gesture_flip_to_mute");
|
||||
|
||||
mFlipPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (!mNotificationManager.isNotificationPolicyAccessGranted()) {
|
||||
mFlipPref.setChecked(false);
|
||||
new AlertDialog.Builder(GestureSettings.this)
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getString(R.string.flip_to_mute_title))
|
||||
.setMessage(getString(R.string.dnd_access))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
@@ -77,13 +81,4 @@ public class GestureSettings extends PreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
public class ScreenOffGestureSettingsActivity extends PreferenceActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState == null){
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new ScreenOffGestureSettingsFragment()).commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,54 +18,49 @@ package org.lineageos.settings.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.preference.Preference;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v14.preference.PreferenceFragment;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import static android.provider.Settings.Secure.DOUBLE_TAP_TO_WAKE;
|
||||
import static org.lineageos.settings.device.actions.Constants.KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK;
|
||||
|
||||
public class ScreenOffGestureSettings extends PreferenceActivity {
|
||||
public class ScreenOffGestureSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private SwitchPreference mTapToWake;
|
||||
private SwitchPreference mHapticFeedback;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.screen_off_gesture_panel);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
mTapToWake = (SwitchPreference) findPreference("tap_to_wake");
|
||||
mTapToWake.setChecked(Settings.Secure.getInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, 0) == 1);
|
||||
mTapToWake.setChecked(Settings.Secure.getInt(getActivity().getContentResolver(), DOUBLE_TAP_TO_WAKE, 0) == 1);
|
||||
mTapToWake.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
||||
boolean value = (Boolean) objValue;
|
||||
Settings.Secure.putInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, value ? 1 : 0);
|
||||
Settings.Secure.putInt(getActivity().getContentResolver(), DOUBLE_TAP_TO_WAKE, value ? 1 : 0);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
mHapticFeedback = (SwitchPreference) findPreference("haptic_feedback");
|
||||
mHapticFeedback.setChecked(Settings.System.getInt(getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, 1) == 1);
|
||||
mHapticFeedback.setChecked(Settings.System.getInt(getActivity().getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, 1) == 1);
|
||||
mHapticFeedback.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
||||
boolean value = (Boolean) objValue;
|
||||
Settings.System.putInt(getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, value ? 1 : 0);
|
||||
Settings.System.putInt(getActivity().getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, value ? 1 : 0);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user