GamingMode: Add our HW keys support [3/3]
SDB: Also remove the switch from now-hw-key devices
and remove gesture hide toggle from HW Key Devices
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
committed by
Hưng Phan
parent
8921ede1d6
commit
b8f6aff761
@@ -1352,7 +1352,7 @@
|
||||
<string name="gaming_mode_auto_answer_call_title">Answering calls automatically</string>
|
||||
<string name="gaming_mode_auto_answer_call_summary">Answer calls automatically in the game and hands free when no headphones connected</string>
|
||||
|
||||
<string name="gaming_mode_prevent_accidental_touch">prevent accidental touch</string>
|
||||
<string name="gaming_mode_disable_gesture_summary">Disables navigation gestures when GamingMode is active</string>
|
||||
<string name="gaming_mode_disable_hw_keys_title">Disable hardware keys</string>
|
||||
<string name="gaming_mode_disable_gesture_title">Disable gestures</string>
|
||||
|
||||
@@ -1369,6 +1369,8 @@
|
||||
<string name="gaming_mode_danmaku_speed_vertical_title">Danmaku speed (vertical)</string>
|
||||
<string name="gaming_mode_danmaku_blacklist">Blacklist</string>
|
||||
<string name="gaming_mode_menu_opacity_title">Menu opacity level</string>
|
||||
<string name="gaming_mode_hardware_keys_title">Disable Hw buttons</string>
|
||||
<string name="gaming_mode_hardware_keys_summary">Disables Hw buttons when GamingMode is active</string>
|
||||
|
||||
<!-- Custom carrier label and position -->
|
||||
<string name="carrier_label_category_title">CarrierLabel Settings</string>
|
||||
|
||||
@@ -112,16 +112,20 @@
|
||||
android:dependency="gaming_mode_enabled" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/gaming_mode_prevent_accidental_touch">
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="gaming_mode_disable_gesture"
|
||||
android:title="@string/gaming_mode_disable_gesture_title"
|
||||
android:defaultValue="false"
|
||||
android:dependency="gaming_mode_enabled" />
|
||||
|
||||
</PreferenceCategory>
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="gaming_mode_disable_hw_keys"
|
||||
android:title="@string/gaming_mode_hardware_keys_title"
|
||||
android:summary="@string/gaming_mode_hardware_keys_summary"
|
||||
android:defaultValue="false"
|
||||
android:dependency="gaming_mode_enabled" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="gaming_mode_disable_gesture"
|
||||
android:title="@string/gaming_mode_disable_gesture_title"
|
||||
android:summary="@string/gaming_mode_disable_gesture_summary"
|
||||
android:defaultValue="false"
|
||||
android:dependency="gaming_mode_enabled" />
|
||||
|
||||
<com.cherish.settings.preferences.PackageListPreference
|
||||
android:key="gaming_mode_app_list"
|
||||
|
||||
@@ -28,14 +28,24 @@ import androidx.preference.PreferenceScreen;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
|
||||
import com.android.internal.util.hwkeys.ActionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.cherish.settings.preferences.PackageListPreference;
|
||||
|
||||
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
|
||||
|
||||
public class GamingModeSettings extends SettingsPreferenceFragment {
|
||||
|
||||
private static final String GAMING_MODE_DISABLE_HW_KEYS = "gaming_mode_disable_hw_keys";
|
||||
private static final String GAMING_MODE_DISABLE_GESTURE = "gaming_mode_disable_gesture";
|
||||
|
||||
private PackageListPreference mGamingPrefList;
|
||||
|
||||
private SystemSettingSwitchPreference mHardwareKeysDisable;
|
||||
private SystemSettingSwitchPreference mGestureDisable;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
@@ -43,9 +53,19 @@ public class GamingModeSettings extends SettingsPreferenceFragment {
|
||||
addPreferencesFromResource(R.xml.cherish_settings_gaming);
|
||||
|
||||
final PreferenceScreen prefScreen = getPreferenceScreen();
|
||||
final boolean hasNavbar = ActionUtils.hasNavbarByDefault(getActivity());
|
||||
|
||||
mGamingPrefList = (PackageListPreference) findPreference("gaming_mode_app_list");
|
||||
mGamingPrefList.setRemovedListKey(Settings.System.GAMING_MODE_REMOVED_APP_LIST);
|
||||
|
||||
mHardwareKeysDisable = (SystemSettingSwitchPreference) findPreference(GAMING_MODE_DISABLE_HW_KEYS);
|
||||
mGestureDisable = (SystemSettingSwitchPreference) findPreference(GAMING_MODE_DISABLE_GESTURE);
|
||||
|
||||
if (hasNavbar) {
|
||||
prefScreen.removePreference(mHardwareKeysDisable);
|
||||
} else {
|
||||
prefScreen.removePreference(mGestureDisable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user