Search in sources :

Example 11 with SwitchBar

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

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 12 with SwitchBar

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

the class BatterySaverSettingsTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mBatterySaverSettings = new BatterySaverSettings();
    mBatterySaverSettings.mSwitchBar = new SwitchBar(mContext);
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) Before(org.junit.Before)

Example 13 with SwitchBar

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

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();
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SettingsActivity(com.android.settings.SettingsActivity) SwitchBarController(com.android.settings.widget.SwitchBarController)

Example 14 with SwitchBar

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

the class DevelopmentSwitchBarControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycle = new Lifecycle();
    mSwitchBar = new SwitchBar(RuntimeEnvironment.application);
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 15 with SwitchBar

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

the class BatterySaverSettingsTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mBatterySaverSettings = new BatterySaverSettings();
    mBatterySaverSettings.mSwitchBar = new SwitchBar(mContext);
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) 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