Search in sources :

Example 6 with SwitchBar

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

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

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

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

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

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

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

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

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

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)

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