Skip to content

Commit

Permalink
feat: updated compileSdk version (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
kikoso authored Dec 6, 2024
1 parent 8887ee2 commit 89e1131
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion maps-compose-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
}

namespace = "com.google.maps.android.compose.utils"
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
2 changes: 1 addition & 1 deletion maps-compose-widgets/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
}

namespace = "com.google.maps.android.compose.widgets"
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
2 changes: 1 addition & 1 deletion maps-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
}

namespace = "com.google.maps.android.compose"
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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<Int?>(mapColorScheme)
var mapColorScheme by mutableStateOf(mapColorScheme)
}

/** Used to store things in the tag which must be retrievable across recompositions */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
}
}

0 comments on commit 89e1131

Please sign in to comment.