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));
}
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);
}
}
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();
}
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);
}
}
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();
}
Aggregations