Upgrade to Mapbox Android SDK 5.0.2

TODO: We cannot get metricsEnabled before initialize the mapbox. So we
should change it from constant to property maybe.
This commit is contained in:
Jack Feng
2017-09-01 10:10:26 +08:00
parent 369bfe50d5
commit 91074ef739
6 changed files with 158 additions and 52 deletions
@@ -3,6 +3,7 @@ package com.mapbox.reactnativemapboxgl;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
@@ -124,7 +125,14 @@ public class RNMGLAnnotationOptionsFactory {
if ((drawable instanceof BitmapDrawable) && width == intrinsicWidth && height == intrinsicHeight) {
icon = iconFactory.fromBitmap(((BitmapDrawable)drawable).getBitmap());
} else {
icon = iconFactory.fromDrawable(drawable, width, height);
// Conversion taken from mapbox-gl-native/issues/7897#issuecomment-277302450
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
//DrawableCompat.setTint(drawable, colorRes);
drawable.draw(canvas);
icon = iconFactory.fromBitmap(bitmap);
}
iconCache.put(cacheKey, icon);