Cherish:Cleanup for android 12

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Hưng Phan
2021-10-24 20:56:46 +07:00
parent 2ee28134b0
commit 3c58bb7cd8
144 changed files with 12 additions and 63182 deletions

View File

@@ -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;
}