use of android.preference.EditTextPreference in project Gadgetbridge by Freeyourgadget.
the class SettingsActivity method setLocationPreferences.
private void setLocationPreferences(Location location) {
String latitude = String.format(Locale.US, "%.6g", location.getLatitude());
String longitude = String.format(Locale.US, "%.6g", location.getLongitude());
LOG.info("got location. Lat: " + latitude + " Lng: " + longitude);
GB.toast(SettingsActivity.this, getString(R.string.toast_aqurired_networklocation), 2000, 0);
EditTextPreference pref_latitude = (EditTextPreference) findPreference("location_latitude");
EditTextPreference pref_longitude = (EditTextPreference) findPreference("location_longitude");
pref_latitude.setText(latitude);
pref_longitude.setText(longitude);
pref_latitude.setSummary(latitude);
pref_longitude.setSummary(longitude);
}
use of android.preference.EditTextPreference in project xabber-android by redsolution.
the class BaseSettingsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
onInflate(savedInstanceState);
PreferenceSummaryHelperActivity.updateSummary(getPreferenceScreen());
if (savedInstanceState == null)
operation(Operation.read);
PreferenceScreen preferenceScreen = getPreferenceScreen();
for (int index = 0; index < preferenceScreen.getPreferenceCount(); index++) {
Preference preference = preferenceScreen.getPreference(index);
preference.setOnPreferenceChangeListener(this);
if (preference instanceof EditTextPreference)
onPreferenceChange(preference, ((EditTextPreference) preference).getText());
else if (preference instanceof CheckBoxPreference)
onPreferenceChange(preference, ((CheckBoxPreference) preference).isChecked());
else if (preference instanceof ListPreference)
onPreferenceChange(preference, ((ListPreference) preference).getValue());
}
return view;
}
Aggregations