use of org.odk.collect.android.preferences.filters.ControlCharacterFilter in project collect by opendatakit.
the class ServerPreferencesFragment method addGooglePreferences.
public void addGooglePreferences() {
addPreferencesFromResource(R.xml.google_preferences);
selectedGoogleAccountPreference = findPreference(PreferenceKeys.KEY_SELECTED_GOOGLE_ACCOUNT);
EditTextPreference googleSheetsUrlPreference = (EditTextPreference) findPreference(PreferenceKeys.KEY_GOOGLE_SHEETS_URL);
googleSheetsUrlPreference.setOnPreferenceChangeListener(createChangeListener());
String currentGoogleSheetsURL = googleSheetsUrlPreference.getText();
if (currentGoogleSheetsURL != null && currentGoogleSheetsURL.length() > 0) {
googleSheetsUrlPreference.setSummary(currentGoogleSheetsURL + "\n\n" + getString(R.string.google_sheets_url_hint));
}
googleSheetsUrlPreference.getEditText().setFilters(new InputFilter[] { new ControlCharacterFilter(), new WhitespaceFilter() });
initAccountPreferences();
}
use of org.odk.collect.android.preferences.filters.ControlCharacterFilter in project collect by opendatakit.
the class ServerPreferencesFragment method addAggregatePreferences.
public void addAggregatePreferences() {
addPreferencesFromResource(R.xml.aggregate_preferences);
serverUrlPreference = (EditTextPreference) findPreference(PreferenceKeys.KEY_SERVER_URL);
usernamePreference = (EditTextPreference) findPreference(PreferenceKeys.KEY_USERNAME);
passwordPreference = (EditTextPreference) findPreference(PreferenceKeys.KEY_PASSWORD);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
String urlListString = prefs.getString(KNOWN_URL_LIST, "");
if (urlListString.isEmpty()) {
urlList = new ArrayList<>();
} else {
urlList = new Gson().fromJson(urlListString, new TypeToken<List<String>>() {
}.getType());
}
if (urlList.size() == 0) {
addUrlToPreferencesList(getString(R.string.default_server_url), prefs);
}
urlDropdownSetup();
serverUrlPreference.getEditText().setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down, 0);
serverUrlPreference.getEditText().setOnTouchListener(this);
serverUrlPreference.setOnPreferenceChangeListener(createChangeListener());
serverUrlPreference.setSummary(serverUrlPreference.getText());
serverUrlPreference.getEditText().setFilters(new InputFilter[] { new ControlCharacterFilter(), new WhitespaceFilter() });
usernamePreference.setOnPreferenceChangeListener(createChangeListener());
usernamePreference.setSummary(usernamePreference.getText());
usernamePreference.getEditText().setFilters(new InputFilter[] { new ControlCharacterFilter() });
passwordPreference.setOnPreferenceChangeListener(createChangeListener());
maskPasswordSummary(passwordPreference.getText());
passwordPreference.getEditText().setFilters(new InputFilter[] { new ControlCharacterFilter() });
}
use of org.odk.collect.android.preferences.filters.ControlCharacterFilter in project collect by opendatakit.
the class ServerPreferencesFragment method addOtherPreferences.
public void addOtherPreferences() {
addAggregatePreferences();
addPreferencesFromResource(R.xml.other_preferences);
formListUrlPreference = (EditTextPreference) findPreference(KEY_FORMLIST_URL);
submissionUrlPreference = (EditTextPreference) findPreference(KEY_SUBMISSION_URL);
InputFilter[] filters = { new ControlCharacterFilter(), new WhitespaceFilter() };
serverUrlPreference.getEditText().setFilters(filters);
formListUrlPreference.setOnPreferenceChangeListener(createChangeListener());
formListUrlPreference.setSummary(formListUrlPreference.getText());
formListUrlPreference.getEditText().setFilters(filters);
submissionUrlPreference.setOnPreferenceChangeListener(createChangeListener());
submissionUrlPreference.setSummary(submissionUrlPreference.getText());
submissionUrlPreference.getEditText().setFilters(filters);
}
Aggregations