Search in sources :

Example 16 with SwitchBarController

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

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 17 with SwitchBarController

use of com.android.settings.widget.SwitchBarController in project platform_packages_apps_Settings by BlissRoms.

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 18 with SwitchBarController

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

the class GameDriverDashboard method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SwitchBar switchBar = activity.getSwitchBar();
    final GameDriverGlobalSwitchBarController switchBarController = new GameDriverGlobalSwitchBarController(activity, new SwitchBarController(switchBar));
    getSettingsLifecycle().addObserver(switchBarController);
    switchBar.show();
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SettingsActivity(com.android.settings.SettingsActivity) SwitchBarController(com.android.settings.widget.SwitchBarController)

Example 19 with SwitchBarController

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

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

Example 20 with SwitchBarController

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

the class BluetoothEnablerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mRestrictedSwitchPreference = new RestrictedSwitchPreference(mContext);
    mSwitchController = spy(new SwitchBarController(new SwitchBar(mContext)));
    mBluetoothEnabler = new BluetoothEnabler(mContext, mSwitchController, mMetricsFeatureProvider, 123, mRestrictionUtils);
    mHolder = PreferenceViewHolder.createInstanceForTests(mock(View.class));
    mRestrictedSwitchPreference.onBindViewHolder(mHolder);
    mBluetoothEnabler.setToggleCallback(mCallback);
    mShadowBluetoothAdapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) SwitchBarController(com.android.settings.widget.SwitchBarController) Before(org.junit.Before)

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