Skip to content

Commit

Permalink
Clear dark map theme if app is in light mode (#19)
Browse files Browse the repository at this point in the history
Fixes an issue where the tour map would display the
dark mode view when the app was set to a light theme.

The fix instead is to clear out the map settings to ensure
that the dark mode is unset.
  • Loading branch information
jocmp committed Oct 22, 2023
1 parent 80a4420 commit 203f904
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/edu/gvsu/art/gallery/ui/TourDetailScreen.kt
Expand Up @@ -135,7 +135,7 @@ private fun MapView(
) {
val coroutineScope = rememberCoroutineScope()
val context = LocalContext.current
val darkTheme = isAppInDarkTheme()
val isDarkTheme = isAppInDarkTheme()
val boundingPadding = with(LocalDensity.current) { 32.dp.roundToPx() }
val map = rememberMapViewWithLifecycle()
val (googleMap, setGoogleMap) = remember { mutableStateOf<GoogleMap?>(null) }
Expand All @@ -149,13 +149,15 @@ private fun MapView(
coroutineScope.launch {
if (googleMap == null) {
val awaitedMap = mapView.awaitMap()
if (darkTheme) {
if (isDarkTheme) {
awaitedMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
context,
R.raw.google_maps_dark
)
)
} else {
awaitedMap.setMapStyle(null)
}
val boundsBuilder = LatLngBounds.builder()

Expand Down

0 comments on commit 203f904

Please sign in to comment.