Search in sources :

Example 11 with SwitchBarController

use of com.android.settings.widget.SwitchBarController in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiTetherSwitchBarControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mSwitchBar = new SwitchBar(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, new SwitchBarController(mSwitchBar));
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SwitchBarController(com.android.settings.widget.SwitchBarController) Before(org.junit.Before)

Example 12 with SwitchBarController

use of com.android.settings.widget.SwitchBarController in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BluetoothDashboardFragment method onActivityCreated.

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

Example 13 with SwitchBarController

use of com.android.settings.widget.SwitchBarController in project android_packages_apps_Settings by DirtyUnicorns.

the class WifiTetherSettings 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 SwitchBar switchBar = activity.getSwitchBar();
    mSwitchBarController = new WifiTetherSwitchBarController(activity, new SwitchBarController(switchBar));
    getLifecycle().addObserver(mSwitchBarController);
    switchBar.show();
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SettingsActivity(com.android.settings.SettingsActivity) SwitchBarController(com.android.settings.widget.SwitchBarController)

Example 14 with SwitchBarController

use of com.android.settings.widget.SwitchBarController in project android_packages_apps_Settings by crdroidandroid.

the class BluetoothSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mBluetoothEnabler = new BluetoothEnabler(activity, new SwitchBarController(mSwitchBar), mMetricsFeatureProvider, Utils.getLocalBtManager(activity), MetricsEvent.ACTION_BLUETOOTH_TOGGLE);
    mBluetoothEnabler.setupSwitchController();
    if (mLocalAdapter != null) {
        mAlwaysDiscoverable = new AlwaysDiscoverable(getContext(), mLocalAdapter);
    }
}
Also used : SettingsActivity(com.android.settings.SettingsActivity) SwitchBarController(com.android.settings.widget.SwitchBarController)

Example 15 with SwitchBarController

use of com.android.settings.widget.SwitchBarController in project android_packages_apps_Settings by crdroidandroid.

the class WifiTetherSettings 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 SwitchBar switchBar = activity.getSwitchBar();
    mSwitchBarController = new WifiTetherSwitchBarController(activity, new SwitchBarController(switchBar));
    getLifecycle().addObserver(mSwitchBarController);
    switchBar.show();
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SettingsActivity(com.android.settings.SettingsActivity) SwitchBarController(com.android.settings.widget.SwitchBarController)

Aggregations

SwitchBarController (com.android.settings.widget.SwitchBarController)22 SettingsActivity (com.android.settings.SettingsActivity)15 SwitchBar (com.android.settings.widget.SwitchBar)14 Before (org.junit.Before)7 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)2 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)2 BluetoothPan (android.bluetooth.BluetoothPan)1 Context (android.content.Context)1 BluetoothSwitchPreferenceController (com.android.settings.bluetooth.BluetoothSwitchPreferenceController)1