Skip to content

Commit 80b33e8

Browse files
committed
Fix warnings when building
1 parent f33bfb5 commit 80b33e8

File tree

1 file changed

+10
-4
lines changed
  • libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose

1 file changed

+10
-4
lines changed

libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMap.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package io.element.android.libraries.maplibre.compose
1010

1111
import android.content.ComponentCallbacks
12+
import android.content.ComponentCallbacks2
1213
import android.content.Context
1314
import android.content.res.Configuration
1415
import android.os.Bundle
@@ -235,11 +236,16 @@ private fun MapView.lifecycleObserver(previousState: MutableState<Lifecycle.Even
235236
previousState.value = event
236237
}
237238

238-
private fun MapView.componentCallbacks(): ComponentCallbacks =
239-
object : ComponentCallbacks {
240-
override fun onConfigurationChanged(config: Configuration) {}
239+
private fun MapView.componentCallbacks(): ComponentCallbacks2 =
240+
object : ComponentCallbacks2 {
241+
override fun onConfigurationChanged(config: Configuration) = Unit
241242

242-
override fun onLowMemory() {
243+
// We need to override this method, even if it's deprecated
244+
@Suppress("DEPRECATION")
245+
override fun onLowMemory() = Unit
246+
247+
override fun onTrimMemory(level: Int) {
248+
// We call the `MapView.onLowMemory` method for any memory trim level
243249
this@componentCallbacks.onLowMemory()
244250
}
245251
}

0 commit comments

Comments
 (0)