Search in sources :

Example 96 with Preference

use of android.preference.Preference in project simplefacebook by androidquery.

the class SettingsActivity method initView.

private void initView() {
    Preference p = findPreference("logout");
    p.setOnPreferenceClickListener(this);
    p = findPreference("share");
    p.setOnPreferenceClickListener(this);
    p.setTitle(p.getTitle() + " @Facebook");
    p = findPreference("share_others");
    p.setOnPreferenceClickListener(this);
    p = findPreference("review");
    p.setOnPreferenceClickListener(this);
    p = findPreference("report");
    p.setOnPreferenceClickListener(this);
    p = findPreference("version");
    String version = getVersion();
    p.setSummary(version);
    p = findPreference("feedback");
    p.setOnPreferenceClickListener(this);
}
Also used : Preference(android.preference.Preference)

Example 97 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 98 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 99 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 100 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)

Aggregations

Preference (android.preference.Preference)173 CheckBoxPreference (android.preference.CheckBoxPreference)50 ListPreference (android.preference.ListPreference)49 PreferenceScreen (android.preference.PreferenceScreen)36 Intent (android.content.Intent)32 EditTextPreference (android.preference.EditTextPreference)26 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 Test (org.junit.Test)15 PreferenceGroup (android.preference.PreferenceGroup)13 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