use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HardwareOverlaysPreferenceController method onDeveloperOptionsSwitchDisabled.
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
final SwitchPreference switchPreference = (SwitchPreference) mPreference;
if (switchPreference.isChecked()) {
// Writing false to the preference when the setting is already off will have a
// side effect of turning on the preference that we wish to avoid
writeHardwareOverlaysSetting(false);
switchPreference.setChecked(false);
}
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WaitForDebuggerPreferenceController method updateState.
private void updateState(Preference preference, String debugApp) {
final SwitchPreference switchPreference = (SwitchPreference) preference;
final boolean debuggerEnabled = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.WAIT_FOR_DEBUGGER, SETTING_VALUE_OFF) != SETTING_VALUE_OFF;
writeDebuggerAppOptions(debugApp, debuggerEnabled, true);
switchPreference.setChecked(debuggerEnabled);
switchPreference.setEnabled(!TextUtils.isEmpty(debugApp));
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WirelessAdbPreferenceController method updatePreference.
private void updatePreference() {
int port = LineageSettings.Secure.getInt(mContext.getContentResolver(), LineageSettings.Secure.ADB_PORT, -1);
boolean enabled = port > 0;
WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
if (enabled && wifiInfo != null) {
String hostAddress = NetworkUtils.intToInetAddress(wifiInfo.getIpAddress()).getHostAddress();
mPreference.setSummary(hostAddress + ":" + String.valueOf(port));
} else {
mPreference.setSummary(R.string.adb_over_network_summary);
}
((SwitchPreference) mPreference).setChecked(enabled);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SecureNfcPreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
if (!isAvailable()) {
mSecureNfcEnabler = null;
return;
}
final SwitchPreference switchPreference = screen.findPreference(getPreferenceKey());
mSecureNfcEnabler = new SecureNfcEnabler(mContext, switchPreference);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BootSoundPreferenceController method handlePreferenceTreeClick.
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (KEY_BOOT_SOUNDS.equals(preference.getKey())) {
SwitchPreference switchPreference = (SwitchPreference) preference;
SystemProperties.set(PROPERTY_BOOT_SOUNDS, switchPreference.isChecked() ? "1" : "0");
}
return false;
}
Aggregations