react-native-google-maps-plus 1.6.1-dev.8 → 1.6.1-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -57,6 +57,8 @@ class LocationHandler(
|
|
|
57
57
|
this.interval = interval ?: INTERVAL_DEFAULT
|
|
58
58
|
this.minUpdateInterval = minUpdateInterval ?: MIN_UPDATE_INTERVAL
|
|
59
59
|
buildLocationRequest(this.priority, this.interval, this.minUpdateInterval)
|
|
60
|
+
stop()
|
|
61
|
+
start()
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
fun showLocationDialog() {
|
|
@@ -2,9 +2,11 @@ package com.rngooglemapsplus
|
|
|
2
2
|
|
|
3
3
|
import android.graphics.Bitmap
|
|
4
4
|
import android.graphics.Canvas
|
|
5
|
+
import android.util.Base64
|
|
5
6
|
import android.util.LruCache
|
|
6
7
|
import androidx.core.graphics.createBitmap
|
|
7
8
|
import com.caverock.androidsvg.SVG
|
|
9
|
+
import com.caverock.androidsvg.SVGExternalFileResolver
|
|
8
10
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
9
11
|
import com.google.android.gms.maps.model.BitmapDescriptor
|
|
10
12
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory
|
|
@@ -20,6 +22,7 @@ import kotlinx.coroutines.SupervisorJob
|
|
|
20
22
|
import kotlinx.coroutines.ensureActive
|
|
21
23
|
import kotlinx.coroutines.launch
|
|
22
24
|
import kotlinx.coroutines.withContext
|
|
25
|
+
import java.net.URLDecoder
|
|
23
26
|
import kotlin.coroutines.coroutineContext
|
|
24
27
|
|
|
25
28
|
class MapMarkerBuilder(
|
|
@@ -35,6 +38,42 @@ class MapMarkerBuilder(
|
|
|
35
38
|
|
|
36
39
|
private val jobsById = mutableMapOf<String, Job>()
|
|
37
40
|
|
|
41
|
+
init {
|
|
42
|
+
SVG.registerExternalFileResolver(
|
|
43
|
+
object : SVGExternalFileResolver() {
|
|
44
|
+
override fun resolveImage(filename: String?): Bitmap? {
|
|
45
|
+
if (filename.isNullOrBlank()) return null
|
|
46
|
+
|
|
47
|
+
return runCatching {
|
|
48
|
+
when {
|
|
49
|
+
filename.startsWith("data:image/svg+xml") -> {
|
|
50
|
+
val svgContent =
|
|
51
|
+
if ("base64," in filename) {
|
|
52
|
+
val base64 = filename.substringAfter("base64,")
|
|
53
|
+
String(Base64.decode(base64, Base64.DEFAULT), Charsets.UTF_8)
|
|
54
|
+
} else {
|
|
55
|
+
URLDecoder.decode(filename.substringAfter(","), "UTF-8")
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
val svg = SVG.getFromString(svgContent)
|
|
59
|
+
val width = (svg.documentWidth.takeIf { it > 0 } ?: 128f).toInt()
|
|
60
|
+
val height = (svg.documentHeight.takeIf { it > 0 } ?: 128f).toInt()
|
|
61
|
+
|
|
62
|
+
createBitmap(width, height).apply {
|
|
63
|
+
Canvas(this).also(svg::renderToCanvas)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
else -> null
|
|
68
|
+
}
|
|
69
|
+
}.getOrNull()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
override fun isFormatSupported(mimeType: String?): Boolean = mimeType?.startsWith("image/") == true
|
|
73
|
+
},
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
38
77
|
fun build(
|
|
39
78
|
m: RNMarker,
|
|
40
79
|
icon: BitmapDescriptor?,
|
package/package.json
CHANGED