mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-31 13:01:15 +00:00
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:
+9
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user