Search in sources :

Example 86 with Preference

use of android.preference.Preference in project androidannotations by androidannotations.

the class PreferenceAnnotationsFragmentTest method testPreferenceChangeHandled.

@Test
public void testPreferenceChangeHandled() {
    assertThat(fragment.preferenceWithKeyChanged).isFalse();
    Preference preference = fragment.findPreference(fragment.getString(R.string.listPreferenceKey));
    preference.getOnPreferenceChangeListener().onPreferenceChange(preference, new Object());
    assertThat(fragment.preferenceWithKeyChanged).isTrue();
}
Also used : Preference(android.preference.Preference) Test(org.junit.Test)

Example 87 with Preference

use of android.preference.Preference in project androidannotations by androidannotations.

the class PreferenceEventsHandledActivityTest method testPreferenceChangeCastedParameterPassed.

@Test
public void testPreferenceChangeCastedParameterPassed() {
    Preference preference = activity.findPreference(activity.getString(R.string.checkBoxWithCastPrefKey));
    preference.getOnPreferenceChangeListener().onPreferenceChange(preference, true);
    assertThat(activity.preference).isSameAs(preference);
}
Also used : Preference(android.preference.Preference) Test(org.junit.Test)

Example 88 with Preference

use of android.preference.Preference in project androidannotations by androidannotations.

the class PreferenceEventsHandledActivityTest method testConventionPreferenceChangeHandled.

@Test
public void testConventionPreferenceChangeHandled() {
    assertThat(activity.conventionPrefChanged).isFalse();
    Preference preference = activity.findPreference(activity.getString(R.string.conventionKey));
    preference.getOnPreferenceChangeListener().onPreferenceChange(preference, new Object());
    assertThat(activity.conventionPrefChanged).isTrue();
}
Also used : Preference(android.preference.Preference) Test(org.junit.Test)

Example 89 with Preference

use of android.preference.Preference in project androidannotations by androidannotations.

the class PreferenceEventsHandledActivityTest method testPreferenceClickHandled.

@Test
public void testPreferenceClickHandled() {
    assertThat(activity.preferenceWithKeyClicked).isFalse();
    Preference preference = activity.findPreference(activity.getString(R.string.listPreferenceKey));
    preference.getOnPreferenceClickListener().onPreferenceClick(preference);
    assertThat(activity.preferenceWithKeyClicked).isTrue();
}
Also used : Preference(android.preference.Preference) Test(org.junit.Test)

Example 90 with Preference

use of android.preference.Preference in project androidannotations by androidannotations.

the class PreferenceEventsHandledActivityTest method testPreferenceClickCastedParameterPassed.

@Test
public void testPreferenceClickCastedParameterPassed() {
    Preference preference = activity.findPreference(activity.getString(R.string.checkBoxWithCastPrefKey));
    preference.getOnPreferenceClickListener().onPreferenceClick(preference);
    assertThat(activity.preference).isSameAs(preference);
}
Also used : Preference(android.preference.Preference) Test(org.junit.Test)

Aggregations

Preference (android.preference.Preference)183 CheckBoxPreference (android.preference.CheckBoxPreference)54 ListPreference (android.preference.ListPreference)54 PreferenceScreen (android.preference.PreferenceScreen)37 Intent (android.content.Intent)33 EditTextPreference (android.preference.EditTextPreference)29 OnPreferenceChangeListener (android.preference.Preference.OnPreferenceChangeListener)23 PreferenceCategory (android.preference.PreferenceCategory)23 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)21 SharedPreferences (android.content.SharedPreferences)19 ChromeSwitchPreference (org.chromium.chrome.browser.preferences.ChromeSwitchPreference)16 PreferenceGroup (android.preference.PreferenceGroup)15 Test (org.junit.Test)15 Uri (android.net.Uri)12 Bundle (android.os.Bundle)12 ArrayList (java.util.ArrayList)11 Resources (android.content.res.Resources)10 SwitchPreference (android.preference.SwitchPreference)10 View (android.view.View)10 ChromeBasePreference (org.chromium.chrome.browser.preferences.ChromeBasePreference)10