Units: add imperial with meters.

Fixes of #1609.
This commit is contained in:
Dennis Guse
2023-06-15 18:23:50 +02:00
parent 9f1ea4d745
commit eb8d28dfc1
17 changed files with 46 additions and 35 deletions
@@ -70,7 +70,8 @@ public class DefaultsSettingsFragment extends PreferenceFragmentCompat implement
int entriesId = switch (unitSystem) {
case METRIC -> R.array.stats_rate_metric_options;
case IMPERIAL, NAUTICAL_IMPERIAL -> R.array.stats_rate_imperial_options;
case IMPERIAL_FEET, IMPERIAL_METER, NAUTICAL_IMPERIAL ->
R.array.stats_rate_imperial_options;
};
String[] entries = getResources().getStringArray(entriesId);
@@ -228,7 +228,7 @@ public class PreferencesUtils {
if (!Locale.US.equals(Locale.getDefault())) {
setUnit(UnitSystem.METRIC);
} else {
setUnit(UnitSystem.IMPERIAL);
setUnit(UnitSystem.IMPERIAL_FEET);
}
}
}
@@ -455,7 +455,7 @@ public class PreferencesUtils {
entries[i] = displayValue;
}
}
case IMPERIAL, NAUTICAL_IMPERIAL -> {
case IMPERIAL_FEET, NAUTICAL_IMPERIAL -> {
if (value == recordingDistanceIntervalDefault) {
entries[i] = resources.getString(R.string.value_integer_feet_recommended, (int) distance.toFT());
} else {
@@ -499,7 +499,7 @@ public class PreferencesUtils {
entries[i] = displayValue;
}
}
case IMPERIAL, NAUTICAL_IMPERIAL -> {
case IMPERIAL_FEET, NAUTICAL_IMPERIAL -> {
if (value == maxRecordingDistanceDefault) {
entries[i] = resources.getString(R.string.value_integer_feet_recommended, (int) distance.toFT());
} else {
@@ -576,7 +576,7 @@ public class PreferencesUtils {
entries[i] = displayValue;
}
}
case IMPERIAL, NAUTICAL_IMPERIAL -> {
case IMPERIAL_FEET, NAUTICAL_IMPERIAL -> {
if (value == recordingGPSAccuracyDefault) {
entries[i] = resources.getString(R.string.value_integer_feet_recommended, (int) distance.toFT());
} else if (value == recordingGPSAccuracyExcellent) {
@@ -618,7 +618,7 @@ public class PreferencesUtils {
entries[i] = resources.getString(R.string.value_float_kilometer_hour, value);
}
}
case IMPERIAL -> {
case IMPERIAL_FEET -> {
double valueMPH = Speed.ofKMH(value).toMPH();
if (value == idleSpeedDefault) {
entries[i] = resources.getString(R.string.value_float_mile_hour_recommended, valueMPH);
@@ -4,7 +4,10 @@ import de.dennisguse.opentracks.R;
public enum UnitSystem {
METRIC(R.string.stats_units_metric),
IMPERIAL(R.string.stats_units_imperial),
IMPERIAL_FEET(R.string.stats_units_imperial_feet),
IMPERIAL_METER(R.string.stats_units_imperial_meter),
NAUTICAL_IMPERIAL(R.string.stats_units_nautical); // Nautical miles with feet
private final int preferenceIdentifier;