use of android.preference.EditTextPreference in project Osmand by osmandapp.
the class SettingsBaseActivity method registerEditTextPreference.
public void registerEditTextPreference(OsmandPreference<String> b, PreferenceScreen screen) {
EditTextPreference p = (EditTextPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
screenPreferences.put(b.getId(), p);
editTextPreferences.put(b.getId(), b);
}
use of android.preference.EditTextPreference in project OpenBikeSharing by bparmentier.
the class SettingsFragment method updatePreference.
private void updatePreference(String key) {
if (key.equals(PREF_KEY_API_URL)) {
Preference preference = findPreference(key);
// if (preference instanceof EditTextPreference){
EditTextPreference editTextPreference = (EditTextPreference) preference;
editTextPreference.setSummary(editTextPreference.getText());
// }
} else if (key.equals(PREF_KEY_NETWORK_ID)) {
Preference preference = findPreference(key);
String networkName = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString(PREF_KEY_NETWORK_NAME, "");
String networkCity = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString(PREF_KEY_NETWORK_CITY, "");
if (!networkName.isEmpty() && !networkCity.isEmpty()) {
preference.setSummary(networkName + " (" + networkCity + ")");
}
}
}
use of android.preference.EditTextPreference in project Gladys-Android-App by LeptitGeek.
the class settingsActivity method updatePreferences.
private void updatePreferences(Preference p) {
if (p instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) p;
p.setSummary(editTextPref.getText());
}
}
use of android.preference.EditTextPreference in project openScale by oliexdev.
the class BluetoothPreferences method updatePrefSummary.
private void updatePrefSummary(Preference p) {
if (smartAssignEnable.isChecked()) {
ignoreOutOfRangeEnable.setEnabled(true);
} else {
ignoreOutOfRangeEnable.setEnabled(false);
}
if (p instanceof ListPreference) {
ListPreference listPref = (ListPreference) p;
p.setSummary(listPref.getTitle());
}
if (p instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) p;
if (p.getTitle().toString().contains("assword")) {
p.setSummary("******");
} else {
p.setSummary(editTextPref.getText());
}
}
if (p instanceof MultiSelectListPreference) {
MultiSelectListPreference editMultiListPref = (MultiSelectListPreference) p;
CharSequence[] entries = editMultiListPref.getEntries();
CharSequence[] entryValues = editMultiListPref.getEntryValues();
List<String> currentEntries = new ArrayList<>();
Set<String> currentEntryValues = editMultiListPref.getValues();
for (int i = 0; i < entries.length; i++) if (currentEntryValues.contains(entryValues[i]))
currentEntries.add(entries[i].toString());
p.setSummary(currentEntries.toString());
}
}
use of android.preference.EditTextPreference in project openScale by oliexdev.
the class GraphPreferences method updatePrefSummary.
private void updatePrefSummary(Preference p) {
if (p instanceof ListPreference) {
ListPreference listPref = (ListPreference) p;
p.setSummary(listPref.getEntry());
}
if (p instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) p;
if (p.getTitle().toString().contains("assword")) {
p.setSummary("******");
} else {
p.setSummary(editTextPref.getText());
}
}
if (p instanceof MultiSelectListPreference) {
MultiSelectListPreference editMultiListPref = (MultiSelectListPreference) p;
CharSequence[] entries = editMultiListPref.getEntries();
CharSequence[] entryValues = editMultiListPref.getEntryValues();
List<String> currentEntries = new ArrayList<>();
Set<String> currentEntryValues = editMultiListPref.getValues();
for (int i = 0; i < entries.length; i++) {
if (currentEntryValues.contains(entryValues[i].toString()))
currentEntries.add(entries[i].toString());
}
p.setSummary(currentEntries.toString());
}
}
Aggregations