Cherish:Cleanup for android 12
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -22,39 +22,14 @@ import java.util.List;
|
||||
public class GestureSettings extends SettingsPreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String KEY_TORCH_LONG_PRESS_POWER_TIMEOUT =
|
||||
"torch_long_press_power_timeout";
|
||||
|
||||
private ListPreference mTorchLongPressPowerTimeout;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.cherish_settings_gestures);
|
||||
|
||||
mTorchLongPressPowerTimeout =
|
||||
(ListPreference) findPreference(KEY_TORCH_LONG_PRESS_POWER_TIMEOUT);
|
||||
|
||||
mTorchLongPressPowerTimeout.setOnPreferenceChangeListener(this);
|
||||
int TorchTimeout = Settings.System.getInt(getContentResolver(),
|
||||
Settings.System.TORCH_LONG_PRESS_POWER_TIMEOUT, 0);
|
||||
mTorchLongPressPowerTimeout.setValue(Integer.toString(TorchTimeout));
|
||||
mTorchLongPressPowerTimeout.setSummary(mTorchLongPressPowerTimeout.getEntry());
|
||||
}
|
||||
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (preference == mTorchLongPressPowerTimeout) {
|
||||
String TorchTimeout = (String) newValue;
|
||||
int TorchTimeoutValue = Integer.parseInt(TorchTimeout);
|
||||
Settings.System.putInt(getActivity().getContentResolver(),
|
||||
Settings.System.TORCH_LONG_PRESS_POWER_TIMEOUT, TorchTimeoutValue);
|
||||
int TorchTimeoutIndex = mTorchLongPressPowerTimeout
|
||||
.findIndexOfValue(TorchTimeout);
|
||||
mTorchLongPressPowerTimeout
|
||||
.setSummary(mTorchLongPressPowerTimeout.getEntries()[TorchTimeoutIndex]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user