diff --git a/maps-compose-utils/build.gradle.kts b/maps-compose-utils/build.gradle.kts index 019112701..f9ffc0a0d 100644 --- a/maps-compose-utils/build.gradle.kts +++ b/maps-compose-utils/build.gradle.kts @@ -10,7 +10,7 @@ android { } namespace = "com.google.maps.android.compose.utils" - compileSdk = 34 + compileSdk = 35 defaultConfig { minSdk = 21 diff --git a/maps-compose-widgets/build.gradle.kts b/maps-compose-widgets/build.gradle.kts index 3884970f6..d9d71c791 100644 --- a/maps-compose-widgets/build.gradle.kts +++ b/maps-compose-widgets/build.gradle.kts @@ -10,7 +10,7 @@ android { } namespace = "com.google.maps.android.compose.widgets" - compileSdk = 34 + compileSdk = 35 defaultConfig { minSdk = 21 diff --git a/maps-compose/build.gradle.kts b/maps-compose/build.gradle.kts index 3b88cf16c..7f54638df 100644 --- a/maps-compose/build.gradle.kts +++ b/maps-compose/build.gradle.kts @@ -10,7 +10,7 @@ android { } namespace = "com.google.maps.android.compose" - compileSdk = 34 + compileSdk = 35 defaultConfig { minSdk = 21 diff --git a/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt b/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt index 1c948c4c1..b7595b235 100644 --- a/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt +++ b/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt @@ -15,6 +15,7 @@ package com.google.maps.android.compose import android.content.ComponentCallbacks +import android.content.ComponentCallbacks2 import android.content.res.Configuration import android.location.Location import android.os.Bundle @@ -27,7 +28,6 @@ import androidx.compose.runtime.CompositionContext import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.Stable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCompositionContext @@ -149,9 +149,11 @@ public fun GoogleMap( modifier = modifier, factory = { context -> MapView(context, googleMapOptionsFactory()).also { mapView -> - val componentCallbacks = object : ComponentCallbacks { + val componentCallbacks = object : ComponentCallbacks2 { override fun onConfigurationChanged(newConfig: Configuration) {} + @Deprecated("Deprecated in Java", ReplaceWith("onTrimMemory(level)")) override fun onLowMemory() { mapView.onLowMemory() } + override fun onTrimMemory(level: Int) { mapView.onLowMemory() } } context.registerComponentCallbacks(componentCallbacks) @@ -255,7 +257,7 @@ internal class MapUpdaterState( var locationSource by mutableStateOf(locationSource) var mapProperties by mutableStateOf(mapProperties) var mapUiSettings by mutableStateOf(mapUiSettings) - var mapColorScheme by mutableStateOf(mapColorScheme) + var mapColorScheme by mutableStateOf(mapColorScheme) } /** Used to store things in the tag which must be retrievable across recompositions */ diff --git a/maps-compose/src/main/java/com/google/maps/android/compose/streetview/StreetView.kt b/maps-compose/src/main/java/com/google/maps/android/compose/streetview/StreetView.kt index 98227a241..c9d398a6d 100644 --- a/maps-compose/src/main/java/com/google/maps/android/compose/streetview/StreetView.kt +++ b/maps-compose/src/main/java/com/google/maps/android/compose/streetview/StreetView.kt @@ -15,6 +15,7 @@ package com.google.maps.android.compose.streetview import android.content.ComponentCallbacks +import android.content.ComponentCallbacks2 import android.content.res.Configuration import android.os.Bundle import android.util.Log @@ -118,7 +119,7 @@ private fun StreetViewLifecycle(streetView: StreetViewPanoramaView) { val previousState = remember { mutableStateOf(Lifecycle.Event.ON_CREATE) } DisposableEffect(context, lifecycle, streetView) { val streetViewLifecycleObserver = streetView.lifecycleObserver(previousState) - val callbacks = streetView.componentCallbacks() + val callbacks = streetView.componentCallbacks2() lifecycle.addObserver(streetViewLifecycleObserver) context.registerComponentCallbacks(callbacks) @@ -177,11 +178,16 @@ private fun StreetViewPanoramaView.lifecycleObserver(previousState: MutableState previousState.value = event } -private fun StreetViewPanoramaView.componentCallbacks(): ComponentCallbacks = - object : ComponentCallbacks { +private fun StreetViewPanoramaView.componentCallbacks2(): ComponentCallbacks2 = + object : ComponentCallbacks2 { override fun onConfigurationChanged(config: Configuration) {} + @Deprecated("Deprecated in Java", ReplaceWith("onTrimMemory(level)")) override fun onLowMemory() { - this@componentCallbacks.onLowMemory() + this@componentCallbacks2.onLowMemory() + } + + override fun onTrimMemory(level: Int) { + this@componentCallbacks2.onLowMemory() } } \ No newline at end of file