Commit 36b22e3b authored by 7c00's avatar 7c00

Fix #130

parent aa8fcd64
...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
buildscript { buildscript {
ext.kotlin_version = '1.2.0' ext.kotlin_version = '1.2.20'
repositories { repositories {
jcenter() jcenter()
...@@ -27,5 +27,5 @@ android { ...@@ -27,5 +27,5 @@ android {
dependencies { dependencies {
provided 'com.facebook.react:react-native:+' provided 'com.facebook.react:react-native:+'
compile 'com.amap.api:navi-3dmap:5.3.0_3dmap5.3.0' compile 'com.amap.api:navi-3dmap:5.3.0_3dmap5.3.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
} }
...@@ -135,6 +135,7 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay { ...@@ -135,6 +135,7 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
fun updateIcon() { fun updateIcon() {
icon?.let { icon?.let {
if (it.width != 0 && it.height != 0) {
val bitmap = Bitmap.createBitmap( val bitmap = Bitmap.createBitmap(
it.width, it.height, Bitmap.Config.ARGB_8888) it.width, it.height, Bitmap.Config.ARGB_8888)
it.draw(Canvas(bitmap)) it.draw(Canvas(bitmap))
...@@ -142,6 +143,7 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay { ...@@ -142,6 +143,7 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
marker?.setIcon(bitmapDescriptor) marker?.setIcon(bitmapDescriptor)
} }
} }
}
fun setImage(name: String) { fun setImage(name: String) {
val drawable = context.resources.getIdentifier(name, "drawable", context.packageName) val drawable = context.resources.getIdentifier(name, "drawable", context.packageName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment