use of com.android.settings.widget.SwitchBar in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DevelopmentSettingsDashboardFragmentTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
SwitchBar switchBar = new SwitchBar(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.SwitchBar in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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 SwitchBar(context);
when(mSettings.getContext()).thenReturn(context);
}
use of com.android.settings.widget.SwitchBar in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AutomaticStorageManagerSwitchBarControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mSwitchBar = new SwitchBar(mContext);
mMetricsFeatureProvider = FakeFeatureFactory.setupForTest().getMetricsFeatureProvider();
mPreference = new Preference(mContext);
mController = new AutomaticStorageManagerSwitchBarController(mContext, mSwitchBar, mMetricsFeatureProvider, mPreference, mFragmentManager);
}
use of com.android.settings.widget.SwitchBar in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiTetherSettings 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 SwitchBar switchBar = activity.getSwitchBar();
mSwitchBarController = new WifiTetherSwitchBarController(activity, new SwitchBarController(switchBar));
getSettingsLifecycle().addObserver(mSwitchBarController);
switchBar.show();
}
use of com.android.settings.widget.SwitchBar in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MobileNetworkSwitchControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
when(mSubscriptionManager.setSubscriptionEnabled(eq(mSubId), anyBoolean())).thenReturn(true);
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
when(mSubscription.getSubscriptionId()).thenReturn(mSubId);
// Most tests want to have 2 available subscriptions so that the switch bar will show.
SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
when(sub2.getSubscriptionId()).thenReturn(456);
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscription, sub2));
String key = "prefKey";
mController = new MobileNetworkSwitchController(mContext, key);
mController.init(mLifecycle, mSubscription.getSubscriptionId());
mSwitchBar = new SwitchBar(mContext);
when(mScreen.findPreference(key)).thenReturn(mLayoutPreference);
when(mLayoutPreference.findViewById(R.id.switch_bar)).thenReturn(mSwitchBar);
}
Aggregations