use of com.android.settings.widget.SettingsMainSwitchBar 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();
}
use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.
the class ToggleFeaturePreferenceFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity();
final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
switchBar.hide();
updatePreferenceOrder();
}
use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.
the class ProfileSelectLocationFragment 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.location_settings_primary_switch_title));
final LocationSwitchBarController switchBarController = new LocationSwitchBarController(activity, switchBar, getSettingsLifecycle());
switchBar.show();
}
use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.
the class DevelopmentSettingsDashboardFragmentTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
SettingsMainSwitchBar switchBar = new SettingsMainSwitchBar(mContext);
mSwitch = switchBar.getSwitch();
mDashboard = spy(new DevelopmentSettingsDashboardFragment());
ReflectionHelpers.setField(mDashboard, "mSwitchBar", switchBar);
mShadowUserManager = Shadow.extract(mContext.getSystemService(Context.USER_SERVICE));
mShadowUserManager.setIsAdminUser(true);
}
use of com.android.settings.widget.SettingsMainSwitchBar in project android_packages_apps_Settings by omnirom.
the class DevelopmentSwitchBarControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
final Context context = RuntimeEnvironment.application;
ShadowUserManager.getShadow().setIsAdminUser(true);
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mSwitchBar = new SettingsMainSwitchBar(context);
when(mSettings.getContext()).thenReturn(context);
}
Aggregations