use of android.preference.DialogPreference in project robolectric by robolectric.
the class ShadowDialogPreferenceTest method inflate_shouldCreateDialogPreference.
@Test
public void inflate_shouldCreateDialogPreference() {
final PreferenceScreen screen = inflatePreferenceActivity();
final DialogPreference preference = (DialogPreference) screen.findPreference("dialog");
assertThat(preference.getTitle().toString()).isEqualTo("Dialog Preference");
assertThat(preference.getSummary().toString()).isEqualTo("This is the dialog summary");
assertThat(preference.getDialogMessage().toString()).isEqualTo("This is the dialog message");
assertThat(preference.getPositiveButtonText().toString()).isEqualTo("YES");
assertThat(preference.getNegativeButtonText().toString()).isEqualTo("NO");
}
use of android.preference.DialogPreference in project xabber-android by redsolution.
the class PreferenceSummaryHelper method updateSummary.
public static void updateSummary(PreferenceGroup group) {
for (int index = 0; index < group.getPreferenceCount(); index++) {
Preference preference = group.getPreference(index);
if (preference instanceof PreferenceGroup) {
updateSummary((PreferenceGroup) preference);
}
String titleAndSummary = preference.getTitle().toString();
if (!isTitleAndSummary(titleAndSummary)) {
continue;
}
preference.setTitle(getPreferenceTitle(titleAndSummary));
if (preference instanceof DialogPreference) {
((DialogPreference) preference).setDialogTitle(preference.getTitle());
}
preference.setSummary(getPreferenceSummary(titleAndSummary));
}
}
use of android.preference.DialogPreference in project Osmand by osmandapp.
the class SettingsOsmEditingActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
getToolbar().setTitle(R.string.osm_settings);
@SuppressWarnings("deprecation") PreferenceScreen grp = getPreferenceScreen();
DialogPreference loginDialogPreference = new OsmLoginDataDialogPreference(this, null);
grp.addPreference(loginDialogPreference);
CheckBoxPreference poiEdit = createCheckBoxPreference(settings.OFFLINE_EDITION, R.string.offline_edition, R.string.offline_edition_descr);
grp.addPreference(poiEdit);
Preference pref = new Preference(this);
pref.setTitle(R.string.local_openstreetmap_settings);
pref.setSummary(R.string.local_openstreetmap_settings_descr);
pref.setKey("local_openstreetmap_points");
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
final Intent favorites = new Intent(SettingsOsmEditingActivity.this, appCustomization.getFavoritesActivity());
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
getMyApplication().getSettings().FAVORITES_TAB.set(R.string.osm_edits);
startActivity(favorites);
return true;
}
});
grp.addPreference(pref);
}
use of android.preference.DialogPreference in project xabber-android by redsolution.
the class PreferenceSummaryHelperActivity method updateSummary.
public static void updateSummary(PreferenceGroup group) {
for (int index = 0; index < group.getPreferenceCount(); index++) {
Preference preference = group.getPreference(index);
if (preference instanceof PreferenceGroup) {
updateSummary((PreferenceGroup) preference);
}
String titleAndSummary = preference.getTitle().toString();
if (!isTitleAndSummary(titleAndSummary)) {
continue;
}
preference.setTitle(getPreferenceTitle(titleAndSummary));
if (preference instanceof DialogPreference) {
((DialogPreference) preference).setDialogTitle(preference.getTitle());
}
preference.setSummary(getPreferenceSummary(titleAndSummary));
}
}
Aggregations