Cherish:Bring back Gaming mode [3/3]

Change-Id: I4ffb0bdf8453068eb049da4823fea6da33346446
Signed-off-by: DennySPb <dennyspb@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Pranav Vashi
2019-11-17 22:47:35 +05:30
committed by Hưng Phan
parent e618f927fe
commit c1e9a0df45
7 changed files with 536 additions and 3 deletions

View File

@@ -975,4 +975,31 @@
<item>2</item>
<item>3</item>
</string-array>
<!-- Gaming mode -->
<string-array name="gaming_mode_ringer_entries">
<item>@string/gaming_mode_ringer_off_title</item>
<item>@string/gaming_mode_ringer_vibrate_title</item>
<item>@string/gaming_mode_ringer_dnd_title</item>
<item>@string/gaming_mode_ringer_silent_title</item>
</string-array>
<string-array name="gaming_mode_ringer_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="gaming_mode_notifications_entries">
<item>@string/gaming_mode_notifications_off_title</item>
<item>@string/gaming_mode_notifications_notif_title</item>
<item>@string/gaming_mode_notifications_toast_title</item>
<item>@string/gaming_mode_notifications_all_title</item>
</string-array>
<string-array name="gaming_mode_notifications_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</resources>

View File

@@ -915,4 +915,29 @@
<string name="fod_pressed_color_cyan">Cyan</string>
<string name="fod_pressed_color_green">Green</string>
<string name="fod_pressed_color_yellow">Yellow</string>
<!-- Gaming mode -->
<string name="gaming_mode_title">Gaming Mode</string>
<string name="gaming_mode_summary">Customize gaming mode preferences</string>
<string name="gaming_mode_app_picker_title">Automatically turn on for these apps</string>
<string name="add_gaming_mode_package_title">Add apps for Gaming mode</string>
<string name="add_gaming_mode_package_summary">Gaming mode will turn on automatically when these apps are opened and turn off when they are closed</string>
<string name="gaming_mode_headsup_title">Block notifications</string>
<string name="gaming_mode_headsup_summary">Block all headsup messages except calls</string>
<string name="gaming_mode_hardware_keys_title">Lock buttons</string>
<string name="gaming_mode_hardware_keys_summary">Disable hardware buttons when Gaming mode is turned on</string>
<string name="gaming_mode_brightness_title">Disable automatic brightness</string>
<string name="gaming_mode_brightness_summary">Lock screen brightness when Gaming mode is turned on</string>
<string name="gaming_mode_ringer_title">Ringer in gaming mode</string>
<string name="gaming_mode_ringer_off_title">Do not change</string>
<string name="gaming_mode_ringer_vibrate_title">Vibrate</string>
<string name="gaming_mode_ringer_dnd_title">Do Not Disturb</string>
<string name="gaming_mode_ringer_silent_title">Silent</string>
<string name="gaming_mode_notifications_title">Gaming mode indication</string>
<string name="gaming_mode_notifications_off_title">Disabled</string>
<string name="gaming_mode_notifications_notif_title">Show notification</string>
<string name="gaming_mode_notifications_toast_title">Show toasts</string>
<string name="gaming_mode_notifications_all_title">Show toasts and notification</string>
<string name="gaming_mode_dynamic_title">Dynamic mode</string>
<string name="gaming_mode_dynamic_summary">Try detecting and adding gaming apps automatically</string>
</resources>

View File

@@ -34,6 +34,14 @@
android:summaryOff="@string/summary_dashboard_suggestions_disabled"
android:defaultValue="true"/>
<com.cherish.settings.preferences.SystemSettingMasterSwitchPreference
android:key="gaming_mode_enabled"
android:icon="@drawable/ic_gaming_mode"
android:fragment="com.cherish.settings.fragments.GamingMode"
android:title="@string/gaming_mode_title"
android:summary="@string/gaming_mode_summary"
android:defaultValue="false" />
<com.cherish.settings.preferences.GlobalSettingSwitchPreference
android:icon="@drawable/ic_plug"
android:key="wake_when_plugged_or_unplugged"

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016-2019 crDroid Android 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/com.android.settings"
android:title="@string/gaming_mode_title">
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="gaming_mode_headsup_toggle"
android:title="@string/gaming_mode_headsup_title"
android:summary="@string/gaming_mode_headsup_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="gaming_mode_hw_keys_toggle"
android:title="@string/gaming_mode_hardware_keys_title"
android:summary="@string/gaming_mode_hardware_keys_summary"
android:defaultValue="false" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="gaming_mode_manual_brightness_toggle"
android:title="@string/gaming_mode_brightness_title"
android:summary="@string/gaming_mode_brightness_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="gaming_mode_ringer_mode"
android:title="@string/gaming_mode_ringer_title"
android:entries="@array/gaming_mode_ringer_entries"
android:entryValues="@array/gaming_mode_ringer_values"
android:defaultValue="0"
android:summary="%s" />
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="gaming_mode_notifications"
android:title="@string/gaming_mode_notifications_title"
android:entries="@array/gaming_mode_notifications_entries"
android:entryValues="@array/gaming_mode_notifications_values"
android:defaultValue="3"
android:summary="%s" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="gaming_mode_dynamic_state"
android:title="@string/gaming_mode_dynamic_title"
android:summary="@string/gaming_mode_dynamic_summary"
android:defaultValue="false" />
<PreferenceCategory
android:title="@string/gaming_mode_app_picker_title"
android:key="gamingmode_applications">
<Preference
android:key="add_gamingmode_packages"
android:icon="@drawable/ic_menu_add_white"
android:title="@string/add_gaming_mode_package_title" />
</PreferenceCategory>
</PreferenceScreen>