Search in sources :

Example 21 with SwitchBar

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

the class MultiUserSwitchBarControllerTest method setUp.

@Before
public void setUp() {
    mContext = RuntimeEnvironment.application;
    mUserManager = ShadowUserManager.getShadow();
    mSwitchBarController = spy(new SwitchBarController(new SwitchBar(mContext)));
    mUserManager.setSupportsMultipleUsers(true);
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SwitchBarController(com.android.settings.widget.SwitchBarController) Before(org.junit.Before)

Example 22 with SwitchBar

use of com.android.settings.widget.SwitchBar 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 23 with SwitchBar

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

the class LocationSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SwitchBar switchBar = activity.getSwitchBar();
    switchBar.setSwitchBarText(R.string.location_settings_master_switch_title, R.string.location_settings_master_switch_title);
    mSwitchBarController = new LocationSwitchBarController(activity, switchBar, getSettingsLifecycle());
    switchBar.show();
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SettingsActivity(com.android.settings.SettingsActivity)

Example 24 with SwitchBar

use of com.android.settings.widget.SwitchBar in project android_packages_apps_Settings by LineageOS.

the class AutomaticStorageManagerSwitchBarControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mSwitchBar = new SwitchBar(mContext);
    Context fakeContextForFakeProvider = mock(Context.class, RETURNS_DEEP_STUBS);
    FakeFeatureFactory.setupForTest(fakeContextForFakeProvider);
    FeatureFactory featureFactory = FakeFeatureFactory.getFactory(fakeContextForFakeProvider);
    mMetricsFeatureProvider = featureFactory.getMetricsFeatureProvider();
    mPreference = new Preference(mContext);
    mController = new AutomaticStorageManagerSwitchBarController(mContext, mSwitchBar, mMetricsFeatureProvider, mPreference, mFragmentManager);
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) Context(android.content.Context) Preference(android.support.v7.preference.Preference) FeatureFactory(com.android.settings.overlay.FeatureFactory) FakeFeatureFactory(com.android.settings.testutils.FakeFeatureFactory) Before(org.junit.Before)

Example 25 with SwitchBar

use of com.android.settings.widget.SwitchBar in project android_packages_apps_Settings by omnirom.

the class AutomaticStorageManagerSwitchBarControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mSwitchBar = new SwitchBar(mContext);
    Context fakeContextForFakeProvider = mock(Context.class, RETURNS_DEEP_STUBS);
    FakeFeatureFactory.setupForTest(fakeContextForFakeProvider);
    FeatureFactory featureFactory = FakeFeatureFactory.getFactory(fakeContextForFakeProvider);
    mMetricsFeatureProvider = featureFactory.getMetricsFeatureProvider();
    mPreference = new Preference(mContext);
    mController = new AutomaticStorageManagerSwitchBarController(mContext, mSwitchBar, mMetricsFeatureProvider, mPreference, mFragmentManager);
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) Context(android.content.Context) Preference(android.support.v7.preference.Preference) FeatureFactory(com.android.settings.overlay.FeatureFactory) FakeFeatureFactory(com.android.settings.testutils.FakeFeatureFactory) Before(org.junit.Before)

Aggregations

SwitchBar (com.android.settings.widget.SwitchBar)37 Before (org.junit.Before)26 SwitchBarController (com.android.settings.widget.SwitchBarController)12 SettingsActivity (com.android.settings.SettingsActivity)10 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)8 Context (android.content.Context)7 Preference (android.support.v7.preference.Preference)6 FeatureFactory (com.android.settings.overlay.FeatureFactory)6 FakeFeatureFactory (com.android.settings.testutils.FakeFeatureFactory)6 SubscriptionInfo (android.telephony.SubscriptionInfo)1 Preference (androidx.preference.Preference)1 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)1 LayoutPreference (com.android.settingslib.widget.LayoutPreference)1 ShadowApplication (org.robolectric.shadows.ShadowApplication)1