Search in sources :

Example 1 with SettingsMainSwitchBar

use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_crDroidSettings by crdroidandroid.

the class UdfpsAnimation method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
    mSwitch = switchBar.getSwitch();
    mEnabled = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.UDFPS_ANIM, 0) == 1;
    mSwitch.setChecked(mEnabled);
    setEnabled(mEnabled);
    switchBar.setTitle(getActivity().getString(R.string.enable));
    switchBar.addOnSwitchChangeListener(this);
    switchBar.show();
}
Also used : SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) SettingsActivity(com.android.settings.SettingsActivity)

Example 2 with SettingsMainSwitchBar

use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.

the class GraphicsDriverDashboard method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
    final GraphicsDriverGlobalSwitchBarController switchBarController = new GraphicsDriverGlobalSwitchBarController(activity, new MainSwitchBarController(switchBar));
    getSettingsLifecycle().addObserver(switchBarController);
    switchBar.setTitle(getContext().getString(R.string.graphics_driver_main_switch_title));
    switchBar.show();
}
Also used : MainSwitchBarController(com.android.settings.widget.MainSwitchBarController) SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) SettingsActivity(com.android.settings.SettingsActivity)

Example 3 with SettingsMainSwitchBar

use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.

the class WirelessDebuggingFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
    switchBar.setTitle(getContext().getString(R.string.wireless_debugging_main_switch_title));
    mWifiDebuggingEnabler = new WirelessDebuggingEnabler(activity, new MainSwitchBarController(switchBar), this, getSettingsLifecycle());
}
Also used : MainSwitchBarController(com.android.settings.widget.MainSwitchBarController) SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) SettingsActivity(com.android.settings.SettingsActivity)

Example 4 with SettingsMainSwitchBar

use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.

the class SmartAutoRotatePreferenceFragment method createHeader.

@VisibleForTesting
void createHeader(SettingsActivity activity) {
    if (isRotationResolverServiceAvailable(activity)) {
        final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
        switchBar.setTitle(getContext().getString(R.string.auto_rotate_settings_primary_switch_title));
        switchBar.show();
        mSwitchBarController = new AutoRotateSwitchBarController(activity, switchBar, getSettingsLifecycle());
        findPreference(AUTO_ROTATE_SWITCH_PREFERENCE_ID).setVisible(false);
    }
}
Also used : SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 5 with SettingsMainSwitchBar

use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.

the class WifiTetherSwitchBarControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mSwitchBar = new SettingsMainSwitchBar(mContext);
    when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
    when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
    when(mContext.getSystemService(Context.NETWORK_POLICY_SERVICE)).thenReturn(mNetworkPolicyManager);
    mController = new WifiTetherSwitchBarController(mContext, mSwitchBar);
}
Also used : SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) Before(org.junit.Before)

Aggregations

SettingsMainSwitchBar (com.android.settings.widget.SettingsMainSwitchBar)16 SettingsActivity (com.android.settings.SettingsActivity)8 Before (org.junit.Before)6 MainSwitchBarController (com.android.settings.widget.MainSwitchBarController)4 Context (android.content.Context)2 BluetoothAdapter (android.bluetooth.BluetoothAdapter)1 ContentResolver (android.content.ContentResolver)1 Intent (android.content.Intent)1 ResolveInfo (android.content.pm.ResolveInfo)1 ServiceInfo (android.content.pm.ServiceInfo)1 Bundle (android.os.Bundle)1 PersistableBundle (android.os.PersistableBundle)1 TextView (android.widget.TextView)1 VisibleForTesting (androidx.annotation.VisibleForTesting)1 Preference (androidx.preference.Preference)1 LocationSwitchBarController (com.android.settings.location.LocationSwitchBarController)1 BluetoothTetherPreferenceController (com.android.settings.network.BluetoothTetherPreferenceController)1 EthernetTetherPreferenceController (com.android.settings.network.EthernetTetherPreferenceController)1 TetherEnabler (com.android.settings.network.TetherEnabler)1 UsbTetherPreferenceController (com.android.settings.network.UsbTetherPreferenceController)1