diff options
author | Chumva <faiver.unknown@gmail.com> | 2019-10-16 17:14:37 +0300 |
---|---|---|
committer | Chumva <faiver.unknown@gmail.com> | 2019-10-16 17:14:37 +0300 |
commit | cdede9d97e03fa5edb7c10b239e107be8972852f (patch) | |
tree | b2e964a5ed915826ef5af6aacca52f765dc21f41 | |
parent | e0809531150c897576787175ce37db394adbc9a5 (diff) | |
download | Osmand-cdede9d97e03fa5edb7c10b239e107be8972852f.tar.gz |
Add speed system pref
-rw-r--r-- | OsmAnd/res/xml/general_profile_settings.xml | 5 | ||||
-rw-r--r-- | OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java | 20 |
2 files changed, 24 insertions, 1 deletions
diff --git a/OsmAnd/res/xml/general_profile_settings.xml b/OsmAnd/res/xml/general_profile_settings.xml index eedbd410af..bf059a374d 100644 --- a/OsmAnd/res/xml/general_profile_settings.xml +++ b/OsmAnd/res/xml/general_profile_settings.xml @@ -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" /> diff --git a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java index 447c5e8a36..ba5299fc04 100644 --- a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java @@ -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() { |