use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class KeyboardLayoutPickerControllerTest method test_createPreferenceHierarchy_shouldAddOnePreference.
@Test
public void test_createPreferenceHierarchy_shouldAddOnePreference() {
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
mController.displayPreference(screen);
// We create a keyboard layouts in initializeOneLayout()
assertThat(screen.getPreferenceCount()).isEqualTo(1);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class KeyboardLayoutPickerControllerTest method test_createPreferenceHierarchy_shouldAddTwoPreference.
@Test
public void test_createPreferenceHierarchy_shouldAddTwoPreference() {
initializeTwoLayouts();
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
mController.displayPreference(screen);
// We create two keyboard layouts in initializeOneLayout()
assertThat(screen.getPreferenceCount()).isEqualTo(2);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class UserDictionaryListControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContentProvider = new FakeProvider();
ShadowContentResolver.registerProviderInternal(UserDictionary.AUTHORITY, mContentProvider);
mContext = RuntimeEnvironment.application;
mController = spy(new UserDictionaryListPreferenceController(mContext, "controller_key"));
mPreference = new Preference(mContext);
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
mPreferenceScreen = preferenceManager.createPreferenceScreen(mContext);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class WifiCallingPreferenceControllerTest method setUp.
@Before
@UiThreadTest
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
mQueryImsState = new MockWifiCallingQueryImsState(mContext, SUB_ID);
mQueryImsState.setIsEnabledByUser(true);
mQueryImsState.setIsProvisionedOnDevice(true);
mController = new TestWifiCallingPreferenceController(mContext, "wifi_calling");
mController.mCarrierConfigManager = mCarrierConfigManager;
mController.init(SUB_ID);
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
mCarrierConfig = new PersistableBundle();
when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(mCarrierConfig);
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(mController.getPreferenceKey());
mScreen.addPreference(mPreference);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class WifiTetherMaximizeCompatibilityPreferenceControllerTest method setUp.
@Before
public void setUp() {
mContext = spy(ApplicationProvider.getApplicationContext());
mConfig = new SoftApConfiguration.Builder().setSsid("test_Ssid").setPassphrase(null, SoftApConfiguration.SECURITY_TYPE_OPEN).setBridgedModeOpportunisticShutdownEnabled(true).build();
doReturn(mWifiManager).when(mContext).getSystemService(Context.WIFI_SERVICE);
doReturn(true).when(mWifiManager).isBridgedApConcurrencySupported();
doReturn(mConfig).when(mWifiManager).getSoftApConfiguration();
mController = new WifiTetherMaximizeCompatibilityPreferenceController(mContext, mListener);
if (Looper.myLooper() == null) {
Looper.prepare();
}
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
mPreference = new SwitchPreference(mContext);
mPreference.setKey(WifiTetherMaximizeCompatibilityPreferenceController.PREF_KEY);
screen.addPreference(mPreference);
mController.displayPreference(screen);
}
Aggregations