Loading res/values/arrays.xml +16 −0 Original line number Diff line number Diff line Loading @@ -322,4 +322,20 @@ <item>8</item> <item>9</item> </string-array> <string-array name="torch_long_press_power_timeout_entries"> <item>@string/auto_power_save_never</item> <item>1 minute</item> <item>2 minutes</item> <item>5 minutes</item> <item>10 minutes</item> </string-array> <string-array name="torch_long_press_power_timeout_values" translatable="false"> <item>0</item> <item>60</item> <item>120</item> <item>300</item> <item>600</item> </string-array> </resources> res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ <string name="torch_long_press_power_gesture_title">Long press for torch</string> <string name="torch_long_press_power_gesture_desc">Activate the torch by long pressing the power button while the display is off</string> <string name="torch_long_press_power_timeout_title">Automatically turn torch off</string> <!-- Profiles --> <string name="profile_menu_delete_title">Delete</string> Loading res/xml/button_settings.xml +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ android:defaultValue="false" cm:requiresConfig="@*android:bool/config_supportLongPressPowerWhenNonInteractive" /> <ListPreference android:key="torch_long_press_power_timeout" android:dialogTitle="@string/torch_long_press_power_timeout_title" android:title="@string/torch_long_press_power_timeout_title" android:entries="@array/torch_long_press_power_timeout_entries" android:entryValues="@array/torch_long_press_power_timeout_values" android:dependency="torch_long_press_power_gesture" android:persistent="false" /> </PreferenceCategory> <PreferenceCategory Loading src/org/cyanogenmod/cmparts/input/ButtonSettings.java +12 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private static final String KEY_VOLUME_CONTROL_RING_STREAM = "volume_keys_control_ring_stream"; private static final String KEY_TORCH_LONG_PRESS_POWER_GESTURE = "torch_long_press_power_gesture"; private static final String KEY_TORCH_LONG_PRESS_POWER_TIMEOUT = "torch_long_press_power_timeout"; private static final String CATEGORY_POWER = "power_key"; private static final String CATEGORY_HOME = "home_key"; Loading Loading @@ -152,6 +154,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private SwitchPreference mPowerEndCall; private SwitchPreference mHomeAnswerCall; private SwitchPreference mTorchLongPressPowerGesture; private ListPreference mTorchLongPressPowerTimeout; private PreferenceCategory mNavigationPreferencesCat; Loading Loading @@ -213,6 +216,10 @@ public class ButtonSettings extends SettingsPreferenceFragment implements // Long press power while display is off to activate torchlight mTorchLongPressPowerGesture = (SwitchPreference) findPreference(KEY_TORCH_LONG_PRESS_POWER_GESTURE); final int torchLongPressPowerTimeout = CMSettings.System.getInt(resolver, CMSettings.System.TORCH_LONG_PRESS_POWER_TIMEOUT, 0); mTorchLongPressPowerTimeout = initList(KEY_TORCH_LONG_PRESS_POWER_TIMEOUT, torchLongPressPowerTimeout); // Home button answers calls. mHomeAnswerCall = (SwitchPreference) findPreference(KEY_HOME_ANSWER_CALL); Loading Loading @@ -288,6 +295,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements } if (!QSUtils.deviceSupportsFlashLight(getActivity())) { powerCategory.removePreference(mTorchLongPressPowerGesture); powerCategory.removePreference(mTorchLongPressPowerTimeout); } } else { prefScreen.removePreference(powerCategory); Loading Loading @@ -634,6 +642,10 @@ public class ButtonSettings extends SettingsPreferenceFragment implements CMSettings.Secure.putString(getContentResolver(), CMSettings.Secure.RECENTS_LONG_PRESS_ACTIVITY, putString); return true; } else if (preference == mTorchLongPressPowerTimeout) { handleListChange(mTorchLongPressPowerTimeout, newValue, CMSettings.System.TORCH_LONG_PRESS_POWER_TIMEOUT); return true; } return false; } Loading Loading
res/values/arrays.xml +16 −0 Original line number Diff line number Diff line Loading @@ -322,4 +322,20 @@ <item>8</item> <item>9</item> </string-array> <string-array name="torch_long_press_power_timeout_entries"> <item>@string/auto_power_save_never</item> <item>1 minute</item> <item>2 minutes</item> <item>5 minutes</item> <item>10 minutes</item> </string-array> <string-array name="torch_long_press_power_timeout_values" translatable="false"> <item>0</item> <item>60</item> <item>120</item> <item>300</item> <item>600</item> </string-array> </resources>
res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ <string name="torch_long_press_power_gesture_title">Long press for torch</string> <string name="torch_long_press_power_gesture_desc">Activate the torch by long pressing the power button while the display is off</string> <string name="torch_long_press_power_timeout_title">Automatically turn torch off</string> <!-- Profiles --> <string name="profile_menu_delete_title">Delete</string> Loading
res/xml/button_settings.xml +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ android:defaultValue="false" cm:requiresConfig="@*android:bool/config_supportLongPressPowerWhenNonInteractive" /> <ListPreference android:key="torch_long_press_power_timeout" android:dialogTitle="@string/torch_long_press_power_timeout_title" android:title="@string/torch_long_press_power_timeout_title" android:entries="@array/torch_long_press_power_timeout_entries" android:entryValues="@array/torch_long_press_power_timeout_values" android:dependency="torch_long_press_power_gesture" android:persistent="false" /> </PreferenceCategory> <PreferenceCategory Loading
src/org/cyanogenmod/cmparts/input/ButtonSettings.java +12 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private static final String KEY_VOLUME_CONTROL_RING_STREAM = "volume_keys_control_ring_stream"; private static final String KEY_TORCH_LONG_PRESS_POWER_GESTURE = "torch_long_press_power_gesture"; private static final String KEY_TORCH_LONG_PRESS_POWER_TIMEOUT = "torch_long_press_power_timeout"; private static final String CATEGORY_POWER = "power_key"; private static final String CATEGORY_HOME = "home_key"; Loading Loading @@ -152,6 +154,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private SwitchPreference mPowerEndCall; private SwitchPreference mHomeAnswerCall; private SwitchPreference mTorchLongPressPowerGesture; private ListPreference mTorchLongPressPowerTimeout; private PreferenceCategory mNavigationPreferencesCat; Loading Loading @@ -213,6 +216,10 @@ public class ButtonSettings extends SettingsPreferenceFragment implements // Long press power while display is off to activate torchlight mTorchLongPressPowerGesture = (SwitchPreference) findPreference(KEY_TORCH_LONG_PRESS_POWER_GESTURE); final int torchLongPressPowerTimeout = CMSettings.System.getInt(resolver, CMSettings.System.TORCH_LONG_PRESS_POWER_TIMEOUT, 0); mTorchLongPressPowerTimeout = initList(KEY_TORCH_LONG_PRESS_POWER_TIMEOUT, torchLongPressPowerTimeout); // Home button answers calls. mHomeAnswerCall = (SwitchPreference) findPreference(KEY_HOME_ANSWER_CALL); Loading Loading @@ -288,6 +295,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements } if (!QSUtils.deviceSupportsFlashLight(getActivity())) { powerCategory.removePreference(mTorchLongPressPowerGesture); powerCategory.removePreference(mTorchLongPressPowerTimeout); } } else { prefScreen.removePreference(powerCategory); Loading Loading @@ -634,6 +642,10 @@ public class ButtonSettings extends SettingsPreferenceFragment implements CMSettings.Secure.putString(getContentResolver(), CMSettings.Secure.RECENTS_LONG_PRESS_ACTIVITY, putString); return true; } else if (preference == mTorchLongPressPowerTimeout) { handleListChange(mTorchLongPressPowerTimeout, newValue, CMSettings.System.TORCH_LONG_PRESS_POWER_TIMEOUT); return true; } return false; } Loading