Skip to content

Commit

Permalink
Make requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrocalles committed Jun 2, 2024
1 parent a6caa35 commit 2c5bff7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import com.mapbox.mapboxsdk.geometry.LatLng
import java.time.format.DateTimeFormatter
import java.util.Locale

const val KM_TO_M = 1000.0

/**
* Composable to display a list of events.
*
Expand Down Expand Up @@ -78,6 +80,7 @@ fun ListDrawer(
eventsList.forEach { event ->
item {
val canModifyEvent = event.creator.userId == userId
val spaceBetweenItems = 12.dp

EventListItem(
event = event,
Expand All @@ -90,7 +93,7 @@ fun ListDrawer(
canModifyEvent = canModifyEvent,
distance = userLocation?.let { event.location.toLatLng().distanceTo(it) },
)
Spacer(modifier = Modifier.height(12.dp))
Spacer(modifier = Modifier.height(spaceBetweenItems))
}
}
}
Expand Down Expand Up @@ -133,7 +136,7 @@ fun EventListItem(
val fmt = { format: String, value: Double ->
String.format(Locale.getDefault(), format, value)
}
if (it < 1000) fmt("%.0fm", it) else fmt("%.1fkm", it / 1000.0)
if (it < KM_TO_M) fmt("%.0fm", it) else fmt("%.1fkm", it / KM_TO_M)
}
?.let { "$it" } ?: ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ object GPSServiceModule {
@Singleton
@Provides
fun provideGPSService(application: Application): GPSService {
val context = application.applicationContext
return GPSServiceImpl(context)
return GPSServiceImpl(application.applicationContext)
}
}

0 comments on commit 2c5bff7

Please sign in to comment.