Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions maps-compose-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ android {
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
// Keep the library free of compiler warnings, so new deprecations are fixed when they appear.
allWarningsAsErrors.set(true)
freeCompilerArgs.addAll(
"-Xexplicit-api=strict",
"-opt-in=kotlin.RequiresOptIn"
Expand Down
2 changes: 2 additions & 0 deletions maps-compose-widgets/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ android {
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
// Keep the library free of compiler warnings, so new deprecations are fixed when they appear.
allWarningsAsErrors.set(true)
freeCompilerArgs.addAll(
"-Xexplicit-api=strict",
"-opt-in=kotlin.RequiresOptIn"
Expand Down
2 changes: 2 additions & 0 deletions maps-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ android {
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
// Keep the library free of compiler warnings, so new deprecations are fixed when they appear.
allWarningsAsErrors.set(true)
freeCompilerArgs.addAll(
"-Xexplicit-api=strict",
"-opt-in=kotlin.RequiresOptIn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public inline fun rememberCameraPositionState(
"com.google.maps.android.compose.rememberCameraPositionState",
),
)
// This deprecated overload exists to pass the custom `key` to rememberSaveable, so it keeps doing
// so until the overload itself is removed. Dropping the key here would silently change behaviour
// for apps that still call it.
@Suppress("DEPRECATION")
@Composable
public inline fun rememberCameraPositionState(
key: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ public class MarkerState private constructor(position: LatLng) {
""",
),
)
// This deprecated overload exists to pass the custom `key` to rememberSaveable, so it keeps doing
// so until the overload itself is removed. Dropping the key here would silently change behaviour
// for apps that still call it.
@Suppress("DEPRECATION")
public fun rememberMarkerState(key: String? = null, position: LatLng = LatLng(0.0, 0.0)): MarkerState =
rememberSaveable(key = key, saver = MarkerState.Saver) {
MarkerState(position)
Expand Down Expand Up @@ -338,6 +342,8 @@ public fun MarkerComposable(
@UiComposable @Composable
() -> Unit,
) {
// The library can use its own experimental API.
@OptIn(MapsComposeExperimentalApi::class)
val icon = rememberComposeBitmapDescriptor(*keys) { content() }

MarkerImpl(
Expand Down Expand Up @@ -494,6 +500,8 @@ public fun MarkerInfoWindowComposable(
@UiComposable @Composable
() -> Unit,
) {
// The library can use its own experimental API.
@OptIn(MapsComposeExperimentalApi::class)
val icon = rememberComposeBitmapDescriptor(*keys) { content() }

MarkerImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ import androidx.compose.runtime.rememberCompositionContext
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner
import com.google.android.gms.maps.StreetViewPanoramaOptions
import com.google.android.gms.maps.StreetViewPanoramaView
import com.google.android.gms.maps.model.StreetViewPanoramaOrientation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.ComposeNode
import androidx.compose.runtime.currentComposer
import com.google.android.gms.maps.StreetViewPanorama
import com.google.android.gms.maps.model.StreetViewPanoramaCamera
import com.google.android.gms.maps.model.StreetViewPanoramaLocation
import com.google.maps.android.compose.MapNode

internal class StreetViewPanoramaPropertiesNode(
Expand All @@ -39,13 +41,13 @@ internal class StreetViewPanoramaPropertiesNode(
panorama.setOnStreetViewPanoramaLongClickListener {
eventListeners.onLongClick(it)
}
// Both Java listener interfaces lack @NonNull, so GMS can deliver null. Guard the
// assignments to prevent the Kotlin compiler's implicit null-check from crashing.
panorama.setOnStreetViewPanoramaCameraChangeListener {
it?.let { cameraPositionState.rawPanoramaCamera = it }
// GMS can deliver null to both listeners even though their parameters are declared
// non-null, so take them as nullable and guard the assignments.
panorama.setOnStreetViewPanoramaCameraChangeListener { camera: StreetViewPanoramaCamera? ->
camera?.let { cameraPositionState.rawPanoramaCamera = it }
}
panorama.setOnStreetViewPanoramaChangeListener {
it?.let { cameraPositionState.rawLocation = it }
panorama.setOnStreetViewPanoramaChangeListener { location: StreetViewPanoramaLocation? ->
location?.let { cameraPositionState.rawLocation = it }
}
}

Expand Down
Loading