diff options
author | Tobrun <tobrun@mapbox.com> | 2017-12-19 19:38:11 +0100 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2017-12-19 19:38:11 +0100 |
commit | af52538a81768977648c9d95190ba8c12e28f78a (patch) | |
tree | a2a4eaed0d7e0704b76e6a33694d0a2a1ebbe2b3 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | |
parent | f242227a677880298429b26b1e6fc3a2d33a046f (diff) | |
download | qtlocation-mapboxgl-af52538a81768977648c9d95190ba8c12e28f78a.tar.gz |
Saving/restoring MyLocationViewSettings (#10746) (#10748)
[android] saving/restoring MyLocationViewSettings, updated BitmapUtils
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 48c83628d6..2719d7f016 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; -import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Parcel; @@ -20,6 +19,7 @@ import android.view.Gravity; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; +import com.mapbox.mapboxsdk.utils.BitmapUtils; import com.mapbox.mapboxsdk.utils.ColorUtils; import java.util.Arrays; @@ -161,19 +161,6 @@ public class MapboxMapOptions implements Parcelable { localIdeographFontFamily = in.readString(); } - static Bitmap getBitmapFromDrawable(Drawable drawable) { - if (drawable instanceof BitmapDrawable) { - return ((BitmapDrawable) drawable).getBitmap(); - } else { - 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()); - drawable.draw(canvas); - return bitmap; - } - } - /** * Creates a MapboxMapsOptions from the attribute set.s * @@ -1130,7 +1117,7 @@ public class MapboxMapOptions implements Parcelable { dest.writeIntArray(compassMargins); dest.writeByte((byte) (fadeCompassFacingNorth ? 1 : 0)); dest.writeParcelable(compassImage != null - ? getBitmapFromDrawable(compassImage) : null, flags); + ? BitmapUtils.getBitmapFromDrawable(compassImage) : null, flags); dest.writeByte((byte) (logoEnabled ? 1 : 0)); dest.writeInt(logoGravity); @@ -1154,11 +1141,11 @@ public class MapboxMapOptions implements Parcelable { dest.writeByte((byte) (myLocationEnabled ? 1 : 0)); dest.writeParcelable(myLocationForegroundDrawable != null - ? getBitmapFromDrawable(myLocationForegroundDrawable) : null, flags); + ? BitmapUtils.getBitmapFromDrawable(myLocationForegroundDrawable) : null, flags); dest.writeParcelable(myLocationForegroundBearingDrawable != null - ? getBitmapFromDrawable(myLocationForegroundBearingDrawable) : null, flags); + ? BitmapUtils.getBitmapFromDrawable(myLocationForegroundBearingDrawable) : null, flags); dest.writeParcelable(myLocationBackgroundDrawable != null - ? getBitmapFromDrawable(myLocationBackgroundDrawable) : null, flags); + ? BitmapUtils.getBitmapFromDrawable(myLocationBackgroundDrawable) : null, flags); dest.writeInt(myLocationForegroundTintColor); dest.writeInt(myLocationBackgroundTintColor); dest.writeIntArray(myLocationBackgroundPadding); |