Search in sources :

Example 41 with ListPreferenceEx

use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.

the class MonitoringSettingsFragment method setupSaveTrackPrecisionPref.

private void setupSaveTrackPrecisionPref() {
    Float[] entryValues = new Float[] { 0.f, 1.0f, 2.0f, 5.0f, 10.0f, 15.0f, 20.0f, 50.0f, 100.0f };
    String[] entries = new String[entryValues.length];
    entries[0] = getString(R.string.shared_string_not_selected);
    for (int i = 1; i < entryValues.length; i++) {
        entries[i] = entryValues[i].intValue() + " " + getString(R.string.m) + "  (" + Math.round(entryValues[i] / 0.3048f) + " " + getString(R.string.foot) + ")";
    }
    ListPreferenceEx saveTrackPrecision = (ListPreferenceEx) findPreference(settings.SAVE_TRACK_PRECISION.getId());
    saveTrackPrecision.setEntries(entries);
    saveTrackPrecision.setEntryValues(entryValues);
    SpannableStringBuilder stringBuilder = new SpannableStringBuilder(getString(R.string.monitoring_min_accuracy_descr));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_accuracy_descr_side_effect));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_accuracy_descr_recommendation));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_accuracy_descr_remark));
    saveTrackPrecision.setDescription(stringBuilder.toString());
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx) SpannableString(android.text.SpannableString) SpannableStringBuilder(android.text.SpannableStringBuilder)

Aggregations

ListPreferenceEx (net.osmand.plus.settings.preferences.ListPreferenceEx)41 SpannableString (android.text.SpannableString)13 ArrayList (java.util.ArrayList)5 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)4 SpannableStringBuilder (android.text.SpannableStringBuilder)3 Camera (android.hardware.Camera)2 MultiSelectBooleanPreference (net.osmand.plus.settings.preferences.MultiSelectBooleanPreference)2 SwitchPreferenceEx (net.osmand.plus.settings.preferences.SwitchPreferenceEx)2 RoutingParameter (net.osmand.router.GeneralRouter.RoutingParameter)2 Context (android.content.Context)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 FragmentManager (androidx.fragment.app.FragmentManager)1 EditTextPreference (androidx.preference.EditTextPreference)1 Preference (androidx.preference.Preference)1 PreferenceScreen (androidx.preference.PreferenceScreen)1 Map (java.util.Map)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 BooleanPreference (net.osmand.plus.settings.backend.preferences.BooleanPreference)1 CommonPreference (net.osmand.plus.settings.backend.preferences.CommonPreference)1