use of android.preference.EditTextPreference in project android-uploader by nightscout.
the class SettingsActivityTest method testValidation_RestApi_Valid.
@Test
public void testValidation_RestApi_Valid() {
EditTextPreference editTextPreference = (EditTextPreference) setUpPreferenceFragment(SettingsActivity.MainPreferenceFragment.class).findPreference(PreferenceKeys.API_URIS);
assertThat(editTextPreference.getOnPreferenceChangeListener().onPreferenceChange(editTextPreference, "http://example.com"), is(true));
}
use of android.preference.EditTextPreference in project android-uploader by nightscout.
the class SettingsActivityTest method testAlert_Mongo_InvalidShowsDialog.
@Test
public void testAlert_Mongo_InvalidShowsDialog() {
EditTextPreference editTextPreference = (EditTextPreference) setUpPreferenceFragment(SettingsActivity.MainPreferenceFragment.class).findPreference(PreferenceKeys.MONGO_URI);
editTextPreference.getOnPreferenceChangeListener().onPreferenceChange(editTextPreference, "invalidMongo");
ShadowAlertDialog alertDialog = getShadowApplication().getLatestAlertDialog();
assertThat(alertDialog, is(not(nullValue())));
assertThat(alertDialog.getMessage().toString(), is(getContext().getString(R.string.illegal_mongo_uri)));
}
use of android.preference.EditTextPreference in project android-uploader by nightscout.
the class SettingsActivityTest method testValidation_RestApi_MultipleValid.
@Test
public void testValidation_RestApi_MultipleValid() {
EditTextPreference editTextPreference = (EditTextPreference) setUpPreferenceFragment(SettingsActivity.MainPreferenceFragment.class).findPreference(PreferenceKeys.API_URIS);
assertThat(editTextPreference.getOnPreferenceChangeListener().onPreferenceChange(editTextPreference, "http://example.com validUri.com"), is(true));
}
use of android.preference.EditTextPreference in project Anki-Android by Ramblurr.
the class Preferences method updateEditTextPreference.
private void updateEditTextPreference(String key) {
EditTextPreference pref = (EditTextPreference) getPreferenceScreen().findPreference(key);
String entry;
try {
entry = pref.getText();
} catch (NullPointerException e) {
Log.e(AnkiDroidApp.TAG, "Error getting set preference value of " + key + ": " + e);
entry = "?";
}
if (mListsToUpdate.containsKey(key)) {
pref.setSummary(replaceString(mListsToUpdate.get(key), entry));
} else {
String oldsum = (String) pref.getSummary();
if (oldsum.contains("XXX")) {
mListsToUpdate.put(key, oldsum);
pref.setSummary(replaceString(oldsum, entry));
} else {
pref.setSummary(entry);
}
}
}
use of android.preference.EditTextPreference in project Anki-Android by Ramblurr.
the class CramDeckOptions method buildLists.
protected void buildLists() {
ListPreference newOrderPref = (ListPreference) findPreference("order");
newOrderPref.setEntries(R.array.cram_deck_conf_order_labels);
newOrderPref.setEntryValues(R.array.cram_deck_conf_order_values);
newOrderPref.setValue(mPref.getString("order", "0"));
if (mPresetSearchSuffix != null) {
EditTextPreference searchPref = (EditTextPreference) findPreference("search");
searchPref.setText(mPresetSearchSuffix);
}
}
Aggregations