mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-24 19:55:51 +01:00
Mapbox: Ensure we have the required class loader in place when converting types
This commit is contained in:
parent
93636a704d
commit
14dfd3e794
@ -51,6 +51,8 @@ fun ICancelableCallback.toMapbox(): MapboxMap.CancelableCallback =
|
||||
|
||||
fun Bundle.toMapbox(): Bundle {
|
||||
val newBundle = Bundle(this)
|
||||
val oldLoader = newBundle.classLoader
|
||||
newBundle.classLoader = GmsLatLng::class.java.classLoader
|
||||
for (key in newBundle.keySet()) {
|
||||
val value = newBundle.get(key)
|
||||
when (value) {
|
||||
@ -60,6 +62,7 @@ fun Bundle.toMapbox(): Bundle {
|
||||
is Bundle -> newBundle.putBundle(key, value.toMapbox())
|
||||
}
|
||||
}
|
||||
newBundle.classLoader = oldLoader
|
||||
return newBundle
|
||||
}
|
||||
|
||||
@ -72,6 +75,8 @@ fun CameraPosition.toGms(): GmsCameraPosition =
|
||||
|
||||
fun Bundle.toGms(): Bundle {
|
||||
val newBundle = Bundle(this)
|
||||
val oldLoader = newBundle.classLoader
|
||||
newBundle.classLoader = LatLng::class.java.classLoader
|
||||
for (key in newBundle.keySet()) {
|
||||
val value = newBundle.get(key)
|
||||
when (value) {
|
||||
@ -81,6 +86,7 @@ fun Bundle.toGms(): Bundle {
|
||||
is Bundle -> newBundle.putBundle(key, value.toGms())
|
||||
}
|
||||
}
|
||||
newBundle.classLoader = oldLoader
|
||||
return newBundle
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user