Search in sources :

Example 1 with MainSwitchBarController

use of com.android.settings.widget.MainSwitchBarController 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 2 with MainSwitchBarController

use of com.android.settings.widget.MainSwitchBarController 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 3 with MainSwitchBarController

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

the class AllInOneTetherSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (mUnavailable) {
        return;
    }
    // Assume we are in a SettingsActivity. This is only safe because we currently use
    // SettingsActivity as base for all preference fragments.
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
    if (adapter != null) {
        adapter.getProfileProxy(activity.getApplicationContext(), mProfileServiceListener, BluetoothProfile.PAN);
    }
    final SettingsMainSwitchBar mainSwitch = activity.getSwitchBar();
    mTetherEnabler = new TetherEnabler(activity, new MainSwitchBarController(mainSwitch), mBluetoothPan);
    getSettingsLifecycle().addObserver(mTetherEnabler);
    use(UsbTetherPreferenceController.class).setTetherEnabler(mTetherEnabler);
    use(BluetoothTetherPreferenceController.class).setTetherEnabler(mTetherEnabler);
    use(EthernetTetherPreferenceController.class).setTetherEnabler(mTetherEnabler);
    use(WifiTetherDisablePreferenceController.class).setTetherEnabler(mTetherEnabler);
    mainSwitch.show();
}
Also used : MainSwitchBarController(com.android.settings.widget.MainSwitchBarController) EthernetTetherPreferenceController(com.android.settings.network.EthernetTetherPreferenceController) WifiTetherDisablePreferenceController(com.android.settings.network.WifiTetherDisablePreferenceController) TetherEnabler(com.android.settings.network.TetherEnabler) SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) BluetoothTetherPreferenceController(com.android.settings.network.BluetoothTetherPreferenceController) UsbTetherPreferenceController(com.android.settings.network.UsbTetherPreferenceController) BluetoothAdapter(android.bluetooth.BluetoothAdapter)

Example 4 with MainSwitchBarController

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

the class UserSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    // Assume we are in a SettingsActivity. This is only safe because we currently use
    // SettingsActivity as base for all preference fragments.
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
    switchBar.setTitle(getContext().getString(R.string.multiple_users_main_switch_title));
    switchBar.show();
    mSwitchBarController = new MultiUserSwitchBarController(activity, new MainSwitchBarController(switchBar), this);
    getSettingsLifecycle().addObserver(mSwitchBarController);
}
Also used : MainSwitchBarController(com.android.settings.widget.MainSwitchBarController) SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) SettingsActivity(com.android.settings.SettingsActivity)

Example 5 with MainSwitchBarController

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

the class BluetoothDashboardFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.setTitle(getContext().getString(R.string.bluetooth_main_switch_title));
    mController = new BluetoothSwitchPreferenceController(activity, new MainSwitchBarController(mSwitchBar), mFooterPreference);
    Lifecycle lifecycle = getSettingsLifecycle();
    if (lifecycle != null) {
        lifecycle.addObserver(mController);
    }
}
Also used : MainSwitchBarController(com.android.settings.widget.MainSwitchBarController) BluetoothSwitchPreferenceController(com.android.settings.bluetooth.BluetoothSwitchPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) SettingsActivity(com.android.settings.SettingsActivity)

Aggregations

MainSwitchBarController (com.android.settings.widget.MainSwitchBarController)5 SettingsActivity (com.android.settings.SettingsActivity)4 SettingsMainSwitchBar (com.android.settings.widget.SettingsMainSwitchBar)4 BluetoothAdapter (android.bluetooth.BluetoothAdapter)1 BluetoothSwitchPreferenceController (com.android.settings.bluetooth.BluetoothSwitchPreferenceController)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 WifiTetherDisablePreferenceController (com.android.settings.network.WifiTetherDisablePreferenceController)1 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)1