Search in sources :

Example 1 with ServerPreferencesAdder

use of org.odk.collect.android.preferences.ServerPreferencesAdder in project collect by opendatakit.

the class ServerPreferencesFragment method addServerPreferences.

public void addServerPreferences() {
    if (!new ServerPreferencesAdder(this).add()) {
        return;
    }
    EditTextPreference serverUrlPreference = findPreference(ProjectKeys.KEY_SERVER_URL);
    EditTextPreference usernamePreference = findPreference(ProjectKeys.KEY_USERNAME);
    passwordPreference = findPreference(ProjectKeys.KEY_PASSWORD);
    serverUrlPreference.setOnPreferenceChangeListener(createChangeListener());
    serverUrlPreference.setSummary(serverUrlPreference.getText());
    usernamePreference.setOnPreferenceChangeListener(createChangeListener());
    usernamePreference.setSummary(usernamePreference.getText());
    usernamePreference.setOnBindEditTextListener(editText -> {
        editText.setFilters(new InputFilter[] { new ControlCharacterFilter() });
    });
    passwordPreference.setOnPreferenceChangeListener(createChangeListener());
    maskPasswordSummary(passwordPreference.getText());
    passwordPreference.setOnBindEditTextListener(editText -> {
        editText.setFilters(new InputFilter[] { new ControlCharacterFilter() });
    });
}
Also used : ServerPreferencesAdder(org.odk.collect.android.preferences.ServerPreferencesAdder) EditTextPreference(androidx.preference.EditTextPreference) ControlCharacterFilter(org.odk.collect.android.preferences.filters.ControlCharacterFilter)

Aggregations

EditTextPreference (androidx.preference.EditTextPreference)1 ServerPreferencesAdder (org.odk.collect.android.preferences.ServerPreferencesAdder)1 ControlCharacterFilter (org.odk.collect.android.preferences.filters.ControlCharacterFilter)1