Search in sources :

Example 51 with SwitchPreference

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);
    }
}
Also used : SwitchPreference(androidx.preference.SwitchPreference)

Example 52 with SwitchPreference

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));
}
Also used : SwitchPreference(androidx.preference.SwitchPreference)

Example 53 with SwitchPreference

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);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) WifiInfo(android.net.wifi.WifiInfo)

Example 54 with SwitchPreference

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);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference)

Example 55 with 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;
}
Also used : SwitchPreference(androidx.preference.SwitchPreference)

Aggregations

SwitchPreference (androidx.preference.SwitchPreference)299 Test (org.junit.Test)125 Before (org.junit.Before)68 Intent (android.content.Intent)17 Preference (androidx.preference.Preference)17 ComponentName (android.content.ComponentName)10 A2dpProfile (com.android.settingslib.bluetooth.A2dpProfile)10 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)8 PbapServerProfile (com.android.settingslib.bluetooth.PbapServerProfile)8 ListPreference (androidx.preference.ListPreference)7 PreferenceScreen (androidx.preference.PreferenceScreen)7 RemoteException (android.os.RemoteException)6 PreferenceCategory (androidx.preference.PreferenceCategory)6 HashSet (java.util.HashSet)6 Context (android.content.Context)5 Parcel (android.os.Parcel)5 VisibleForTesting (androidx.annotation.VisibleForTesting)5 BluetoothDevice (android.bluetooth.BluetoothDevice)4 ChangeConfig (android.compat.Compatibility.ChangeConfig)4 ServiceInfo (android.content.pm.ServiceInfo)4