Search in sources :

Example 81 with PreferenceManager

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);
}
Also used : PreferenceScreen(androidx.preference.PreferenceScreen) PreferenceManager(androidx.preference.PreferenceManager) Test(org.junit.Test)

Example 82 with PreferenceManager

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);
}
Also used : PreferenceScreen(androidx.preference.PreferenceScreen) PreferenceManager(androidx.preference.PreferenceManager) Test(org.junit.Test)

Example 83 with PreferenceManager

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);
}
Also used : Preference(androidx.preference.Preference) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Example 84 with PreferenceManager

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);
}
Also used : PersistableBundle(android.os.PersistableBundle) Preference(androidx.preference.Preference) PreferenceManager(androidx.preference.PreferenceManager) MockWifiCallingQueryImsState(com.android.settings.network.ims.MockWifiCallingQueryImsState) Before(org.junit.Before) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 85 with PreferenceManager

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);
}
Also used : PreferenceScreen(androidx.preference.PreferenceScreen) SwitchPreference(androidx.preference.SwitchPreference) SoftApConfiguration(android.net.wifi.SoftApConfiguration) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Aggregations

PreferenceManager (androidx.preference.PreferenceManager)87 Before (org.junit.Before)67 Preference (androidx.preference.Preference)23 PreferenceCategory (androidx.preference.PreferenceCategory)22 PreferenceScreen (androidx.preference.PreferenceScreen)19 Test (org.junit.Test)18 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)15 Context (android.content.Context)5 LifecycleRegistry (androidx.lifecycle.LifecycleRegistry)5 ArrayList (java.util.ArrayList)5 NotificationChannel (android.app.NotificationChannel)4 ShortcutInfo (android.content.pm.ShortcutInfo)4 View (android.view.View)4 NotificationChannelGroup (android.app.NotificationChannelGroup)3 ConversationChannel (android.app.people.ConversationChannel)3 PackageInfo (android.content.pm.PackageInfo)3 PersistableBundle (android.os.PersistableBundle)3 BluetoothManager (android.bluetooth.BluetoothManager)2 SoftApConfiguration (android.net.wifi.SoftApConfiguration)2 WifiManager (android.net.wifi.WifiManager)2