Search in sources :

Example 76 with EditTextPreference

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);
}
Also used : EditTextPreference(android.preference.EditTextPreference)

Example 77 with EditTextPreference

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;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) RingtonePreference(com.xabber.android.ui.widget.RingtonePreference) CheckBoxPreference(android.preference.CheckBoxPreference) EditTextPreference(android.preference.EditTextPreference) ListPreference(android.preference.ListPreference) Preference(android.preference.Preference) SwitchPreference(android.preference.SwitchPreference) CheckBoxPreference(android.preference.CheckBoxPreference) EditTextPreference(android.preference.EditTextPreference) ListPreference(android.preference.ListPreference) View(android.view.View)

Aggregations

EditTextPreference (android.preference.EditTextPreference)77 ListPreference (android.preference.ListPreference)32 Preference (android.preference.Preference)32 CheckBoxPreference (android.preference.CheckBoxPreference)17 SharedPreferences (android.content.SharedPreferences)11 PreferenceScreen (android.preference.PreferenceScreen)11 Test (org.junit.Test)9 MultiSelectListPreference (android.preference.MultiSelectListPreference)8 OnPreferenceChangeListener (android.preference.Preference.OnPreferenceChangeListener)8 Intent (android.content.Intent)7 ArrayList (java.util.ArrayList)7 DialogInterface (android.content.DialogInterface)6 Bundle (android.os.Bundle)6 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)5 View (android.view.View)5 SwitchPreference (android.preference.SwitchPreference)4 EditText (android.widget.EditText)4 File (java.io.File)4 Activity (android.app.Activity)3 AlertDialog (android.app.AlertDialog)3