use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class NetworkProviderDownloadedSimsCategoryControllerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
if (Looper.myLooper() == null) {
Looper.prepare();
}
mPreferenceManager = new PreferenceManager(mContext);
mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
mPreferenceCategory = new PreferenceCategory(mContext);
mPreferenceCategory.setKey(KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
mAddMorePreference = new Preference(mContext);
mAddMorePreference.setKey(KEY_ADD_MORE);
mAddMorePreference.setVisible(true);
mPreferenceScreen.addPreference(mPreferenceCategory);
mPreferenceScreen.addPreference(mAddMorePreference);
mCategoryController = new NetworkProviderDownloadedSimsCategoryController(mContext, KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM, mLifecycle);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class NetworkProviderDownloadedSimListControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
if (Looper.myLooper() == null) {
Looper.prepare();
}
mPreferenceManager = new PreferenceManager(mContext);
mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(KEY_PREFERENCE_DOWNLOADED_SIM);
mController = new MockNetworkProviderDownloadedSimListController(mContext, mLifecycle);
mAddMorePreference = new Preference(mContext);
mAddMorePreference.setKey(KEY_ADD_MORE);
mAddMorePreference.setVisible(true);
mLifecycleRegistry = new LifecycleRegistry(mLifecycleOwner);
when(mLifecycleOwner.getLifecycle()).thenReturn(mLifecycleRegistry);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class WifiSwitchPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
final Context context = spy(ApplicationProvider.getApplicationContext());
doReturn(mWifiManager).when(context).getSystemService(Context.WIFI_SERVICE);
mController = new WifiSwitchPreferenceController(context, mock(Lifecycle.class));
if (Looper.myLooper() == null) {
Looper.prepare();
}
final PreferenceManager preferenceManager = new PreferenceManager(context);
mScreen = preferenceManager.createPreferenceScreen(context);
mPreference = new RestrictedSwitchPreference(context);
mPreference.setKey(WifiSwitchPreferenceController.KEY);
mScreen.addPreference(mPreference);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class VpnPreferenceControllerTest method setUp.
@Before
@UiThreadTest
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
when(mContext.getSystemService(VpnManager.class)).thenReturn(mVpnManager);
if (Looper.myLooper() == null) {
Looper.prepare();
}
PreferenceManager preferenceManager = new PreferenceManager(mContext);
mScreen = preferenceManager.createPreferenceScreen(mContext);
when(mPreference.getKey()).thenReturn(VPN_PREFERENCE_KEY);
mScreen.addPreference(mPreference);
mController = spy(new VpnPreferenceController(mContext));
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mLifecycle.addObserver(mController);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class DeleteSimProfilePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscriptionInfo));
when(mSubscriptionInfo.getSubscriptionId()).thenReturn(SUB_ID);
when(mSubscriptionInfo.isEmbedded()).thenReturn(true);
if (Looper.myLooper() == null) {
Looper.prepare();
}
PreferenceManager preferenceManager = new PreferenceManager(mContext);
mScreen = preferenceManager.createPreferenceScreen(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(PREF_KEY);
mScreen.addPreference(mPreference);
mController = new DeleteSimProfilePreferenceController(mContext, PREF_KEY);
}
Aggregations