Search in sources :

Example 6 with PreferenceManager

use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FirmwareVersionPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    final Context context = RuntimeEnvironment.application;
    final PreferenceManager preferenceManager = new PreferenceManager(context);
    mController = new FirmwareVersionPreferenceController(context, KEY);
    mPreference = new Preference(context);
    mPreference.setKey(KEY);
    mScreen = preferenceManager.createPreferenceScreen(context);
    mScreen.addPreference(mPreference);
}
Also used : Context(android.content.Context) Preference(androidx.preference.Preference) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Example 7 with PreferenceManager

use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class HardwareInfoPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mController = new HardwareInfoPreferenceController(mContext, KEY);
    mPreference = new Preference(mContext);
    mPreference.setKey(KEY);
    final PreferenceManager preferenceManager = new PreferenceManager(mContext);
    mPreferenceScreen = preferenceManager.createPreferenceScreen(mContext);
    mPreferenceScreen.addPreference(mPreference);
}
Also used : HardwareInfoPreferenceController(com.android.settings.deviceinfo.HardwareInfoPreferenceController) Preference(androidx.preference.Preference) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Example 8 with PreferenceManager

use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InputMethodAndSubtypePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mPreferenceManager = new PreferenceManager(mContext);
    when(mFragment.getContext()).thenReturn(mContext);
    when(mFragment.getResources()).thenReturn(mContext.getResources());
    when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
    mController = new InputMethodAndSubtypePreferenceController(mContext, "pref_key");
    mController.initialize(mFragment, "");
}
Also used : PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Example 9 with PreferenceManager

use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InputMethodAndSubtypePreferenceControllerTest method displayPreference_hasInputMethodSubType_shouldAddPreference.

@Test
public void displayPreference_hasInputMethodSubType_shouldAddPreference() {
    final PreferenceManager preferenceManager = new PreferenceManager(mContext);
    final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
    mController.displayPreference(screen);
    assertThat(screen.getPreferenceCount()).isEqualTo(0);
    final List<InputMethodInfo> imis = new ArrayList<>();
    imis.add(createInputMethodInfo("test", mContext));
    ShadowInputMethodManagerWithMethodList.getShadow().setInputMethodList(imis);
    mController.initialize(mFragment, "");
    mController.displayPreference(screen);
    assertThat(screen.getPreferenceCount()).isEqualTo(2);
}
Also used : PreferenceScreen(androidx.preference.PreferenceScreen) ArrayList(java.util.ArrayList) PreferenceManager(androidx.preference.PreferenceManager) InputMethodInfo(android.view.inputmethod.InputMethodInfo) Test(org.junit.Test)

Example 10 with PreferenceManager

use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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)

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