Skip to content

Commit 293a1d8

Browse files
committed
refactor: move magic number to constant
1 parent 4e7fbb4 commit 293a1d8

File tree

1 file changed

+3
-1
lines changed
  • cardinal-android/app/src/main/java/earth/maps/cardinal/data

1 file changed

+3
-1
lines changed

cardinal-android/app/src/main/java/earth/maps/cardinal/data/GeoUtils.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ object GeoUtils {
3232
private const val METERS_TO_MILES = 1609.34
3333
private const val METERS_TO_FEET = 3.28084
3434

35+
private const val SHORT_DISTANCE_THRESHOLD_METERS = 200.0
36+
3537
/**
3638
* Formats a distance in meters to a human-readable string based on the unit preference.
3739
*
@@ -98,7 +100,7 @@ object GeoUtils {
98100
* @return Formatted short distance string (e.g., "150 m" or "490 ft")
99101
*/
100102
fun formatShortDistance(meters: Double, unitPreference: Int): String {
101-
if (meters > 200.0) {
103+
if (meters > SHORT_DISTANCE_THRESHOLD_METERS) {
102104
return formatDistance(meters, unitPreference)
103105
}
104106
return when (unitPreference) {

0 commit comments

Comments
 (0)