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 {
|
fun Bundle.toMapbox(): Bundle {
|
||||||
val newBundle = Bundle(this)
|
val newBundle = Bundle(this)
|
||||||
|
val oldLoader = newBundle.classLoader
|
||||||
|
newBundle.classLoader = GmsLatLng::class.java.classLoader
|
||||||
for (key in newBundle.keySet()) {
|
for (key in newBundle.keySet()) {
|
||||||
val value = newBundle.get(key)
|
val value = newBundle.get(key)
|
||||||
when (value) {
|
when (value) {
|
||||||
@ -60,6 +62,7 @@ fun Bundle.toMapbox(): Bundle {
|
|||||||
is Bundle -> newBundle.putBundle(key, value.toMapbox())
|
is Bundle -> newBundle.putBundle(key, value.toMapbox())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
newBundle.classLoader = oldLoader
|
||||||
return newBundle
|
return newBundle
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +75,8 @@ fun CameraPosition.toGms(): GmsCameraPosition =
|
|||||||
|
|
||||||
fun Bundle.toGms(): Bundle {
|
fun Bundle.toGms(): Bundle {
|
||||||
val newBundle = Bundle(this)
|
val newBundle = Bundle(this)
|
||||||
|
val oldLoader = newBundle.classLoader
|
||||||
|
newBundle.classLoader = LatLng::class.java.classLoader
|
||||||
for (key in newBundle.keySet()) {
|
for (key in newBundle.keySet()) {
|
||||||
val value = newBundle.get(key)
|
val value = newBundle.get(key)
|
||||||
when (value) {
|
when (value) {
|
||||||
@ -81,8 +86,9 @@ fun Bundle.toGms(): Bundle {
|
|||||||
is Bundle -> newBundle.putBundle(key, value.toGms())
|
is Bundle -> newBundle.putBundle(key, value.toGms())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
newBundle.classLoader = oldLoader
|
||||||
return newBundle
|
return newBundle
|
||||||
}
|
}
|
||||||
|
|
||||||
fun VisibleRegion.toGms(): GmsVisibleRegion =
|
fun VisibleRegion.toGms(): GmsVisibleRegion =
|
||||||
GmsVisibleRegion(nearLeft.toGms(), nearRight.toGms(), farLeft.toGms(), farRight.toGms(), latLngBounds.toGms())
|
GmsVisibleRegion(nearLeft.toGms(), nearRight.toGms(), farLeft.toGms(), farRight.toGms(), latLngBounds.toGms())
|
||||||
|
Loading…
Reference in New Issue
Block a user