Add speed system pref

This commit is contained in:
Chumva 2019-10-16 17:14:37 +03:00
parent e080953115
commit cdede9d97e
2 changed files with 24 additions and 1 deletions

View file

@ -53,6 +53,11 @@
android:layout="@layout/preference_with_descr"
android:title="@string/angular_measeurement" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="default_speed_system"
android:layout="@layout/preference_with_descr"
android:title="@string/default_speed_system" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />

View file

@ -48,6 +48,7 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
setupUnitsOfLengthPref();
setupCoordinatesFormatPref();
setupAngularUnitsPref();
setupSpeedSystemPref();
setupKalmanFilterPref();
setupMagneticFieldSensorPref();
@ -202,7 +203,24 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
ListPreferenceEx angularUnits = (ListPreferenceEx) findPreference(settings.ANGULAR_UNITS.getId());
angularUnits.setEntries(entries);
angularUnits.setEntryValues(entryValues);
angularUnits.setIcon(getContentIcon(R.drawable.ic_action_angular_unit));
angularUnits.setIcon(getIcon(R.drawable.ic_action_angular_unit));
}
private void setupSpeedSystemPref() {
OsmandSettings.SpeedConstants[] speedConstants = OsmandSettings.SpeedConstants.values();
String[] entries = new String[speedConstants.length];
Integer[] entryValues = new Integer[speedConstants.length];
for (int i = 0; i < entries.length; i++) {
entries[i] = speedConstants[i].toHumanString(app);
entryValues[i] = speedConstants[i].ordinal();
}
ListPreferenceEx speedSystem = (ListPreferenceEx) findPreference(settings.SPEED_SYSTEM.getId());
speedSystem.setEntries(entries);
speedSystem.setEntryValues(entryValues);
speedSystem.setDescription(R.string.default_speed_system_descr);
speedSystem.setIcon(getContentIcon(R.drawable.ic_action_speed));
}
private void setupKalmanFilterPref() {