Search in sources :

Example 1 with TetherEnabler

use of com.android.settings.network.TetherEnabler 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)

Aggregations

BluetoothAdapter (android.bluetooth.BluetoothAdapter)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 MainSwitchBarController (com.android.settings.widget.MainSwitchBarController)1 SettingsMainSwitchBar (com.android.settings.widget.SettingsMainSwitchBar)1