use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class DeviceNamePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
mResources = spy(mContext.getResources());
when(mContext.getResources()).thenReturn(mResources);
if (Looper.myLooper() == null) {
Looper.prepare();
}
PreferenceManager preferenceManager = new PreferenceManager(mContext);
mScreen = preferenceManager.createPreferenceScreen(mContext);
mPreference = new ValidatedEditTextPreference(mContext);
mPreference.setKey(TEST_PREFERENCE_KEY);
mScreen.addPreference(mPreference);
final SoftApConfiguration configuration = new SoftApConfiguration.Builder().setSsid("test-ap").build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(configuration);
mController = new DeviceNamePreferenceController(mContext, TEST_PREFERENCE_KEY);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class AirplaneModePreferenceControllerTest method setUp.
@Before
public void setUp() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
mResolver = mContext.getContentResolver();
doReturn(mPackageManager).when(mContext).getPackageManager();
mController = new AirplaneModePreferenceController(mContext, SettingsSlicesContract.KEY_AIRPLANE_MODE);
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mPreference = new RestrictedSwitchPreference(mContext);
mPreference.setKey(SettingsSlicesContract.KEY_AIRPLANE_MODE);
mScreen.addPreference(mPreference);
mController.setFragment(null);
}
Aggregations