diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-03-09 17:46:00 -0500 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2016-03-09 17:46:00 -0500 |
commit | 808bf7004a4360a4cc7095f97c235c92d3679f8b (patch) | |
tree | f5225f5785f057923cfa5bd5c4806f5958b56e88 /platform/android/MapboxGLAndroidSDK | |
parent | 7cceca4b4576c21c315b445889bad770e7dc4e53 (diff) | |
download | qtlocation-mapboxgl-808bf7004a4360a4cc7095f97c235c92d3679f8b.tar.gz |
[android] #4076 - MapboxMapOptions fix
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK')
2 files changed, 178 insertions, 120 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index ec61a767c2..a31da56f42 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -13,7 +13,6 @@ import android.content.IntentFilter; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; -import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.PointF; @@ -39,7 +38,6 @@ import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.view.GestureDetector; -import android.view.Gravity; import android.view.InputDevice; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -112,8 +110,6 @@ import java.util.concurrent.CopyOnWriteArrayList; */ public class MapView extends FrameLayout { - private static final String TAG = "MapView"; - private MapboxMap mMapboxMap; private List<Icon> mIcons; @@ -151,7 +147,7 @@ public class MapView extends FrameLayout { @UiThread public MapView(@NonNull Context context) { super(context); - initialize(context, null); + initialize(context, MapboxMapOptions.createFromAttributes(context, null)); } @UiThread @@ -172,7 +168,7 @@ public class MapView extends FrameLayout { initialize(context, options); } - private void initialize(@NonNull Context context, @Nullable MapboxMapOptions options) { + private void initialize(@NonNull Context context, @NonNull MapboxMapOptions options) { mInitialLoad = true; mOnMapChangedListener = new CopyOnWriteArrayList<>(); mMapboxMap = new MapboxMap(this); @@ -209,11 +205,6 @@ public class MapView extends FrameLayout { mRotateGestureDetector = new RotateGestureDetector(context, new RotateGestureListener()); mShoveGestureDetector = new ShoveGestureDetector(context, new ShoveGestureListener()); - // Shows the zoom controls - if (!context.getPackageManager() - .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) { - mMapboxMap.getUiSettings().setZoomControlsEnabled(true); - } mZoomButtonsController = new ZoomButtonsController(this); mZoomButtonsController.setZoomSpeed(MapboxConstants.ANIMATION_DURATION); mZoomButtonsController.setOnZoomListener(new OnZoomListener()); @@ -235,69 +226,69 @@ public class MapView extends FrameLayout { mScreenDensity = context.getResources().getDisplayMetrics().density; -// // Load the attributes -// TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MapView, 0, 0); -// try { -// // Debug mode -// mMapboxMap.setDebugActive(typedArray.getBoolean(R.styleable.MapView_debug_active, false)); -// -// // Move camera -// CameraPosition cameraPosition = new CameraPosition.Builder(typedArray).build(); -// mMapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); -// -// // Access token -// String accessToken = typedArray.getString(R.styleable.MapView_access_token); -// if (accessToken != null) { -// setAccessToken(typedArray.getString(R.styleable.MapView_access_token)); -// } -// -// // Style url -// String styleUrl = typedArray.getString(R.styleable.MapView_style_url); -// if (styleUrl != null) { -// mMapboxMap.setStyleUrl(styleUrl); -// } -// -// // Enable gestures -// UiSettings uiSettings = mMapboxMap.getUiSettings(); -// uiSettings.setZoomGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_zoom_enabled, true)); -// uiSettings.setScrollGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_scroll_enabled, true)); -// uiSettings.setRotateGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_rotate_enabled, true)); -// uiSettings.setTiltGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_tilt_enabled, true)); -// uiSettings.setZoomControlsEnabled(typedArray.getBoolean(R.styleable.MapView_zoom_controls_enabled, false)); -// -// // Zoom -// uiSettings.setMaxZoom(typedArray.getFloat(R.styleable.MapView_zoom_max, (float) MapboxConstants.MAXIMUM_ZOOM)); -// uiSettings.setMinZoom(typedArray.getFloat(R.styleable.MapView_zoom_min, (float) MapboxConstants.MINIMUM_ZOOM)); -// -// // Compass -// uiSettings.setCompassEnabled(typedArray.getBoolean(R.styleable.MapView_compass_enabled, true)); -// uiSettings.setCompassGravity(typedArray.getInt(R.styleable.MapView_compass_gravity, Gravity.TOP | Gravity.END)); -// uiSettings.setCompassMargins((int) (typedArray.getDimension(R.styleable.MapView_compass_margin_left, DIMENSION_TEN_DP) * mScreenDensity) -// , ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_top, DIMENSION_TEN_DP * mScreenDensity)) -// , ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_right, DIMENSION_TEN_DP * mScreenDensity)) -// , ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_bottom, DIMENSION_TEN_DP * mScreenDensity))); -// -// // Logo -// uiSettings.setLogoEnabled(typedArray.getBoolean(R.styleable.MapView_logo_visibility, true)); -// uiSettings.setLogoGravity(typedArray.getInt(R.styleable.MapView_logo_gravity, Gravity.BOTTOM | Gravity.START)); -// uiSettings.setLogoMargins((int) (typedArray.getDimension(R.styleable.MapView_logo_margin_left, DIMENSION_SIXTEEN_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_top, DIMENSION_SIXTEEN_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_right, DIMENSION_SIXTEEN_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_bottom, DIMENSION_SIXTEEN_DP) * mScreenDensity)); -// -// // Attribution -// uiSettings.setAttributionEnabled(typedArray.getBoolean(R.styleable.MapView_attribution_visibility, true)); -// uiSettings.setAttributionGravity(typedArray.getInt(R.styleable.MapView_attribution_gravity, Gravity.BOTTOM)); -// uiSettings.setAttributionMargins((int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_left, DIMENSION_SEVENTY_SIX_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_top, DIMENSION_SEVEN_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_right, DIMENSION_SEVEN_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_bottom, DIMENSION_SEVEN_DP) * mScreenDensity)); -// -// // User location -// mMapboxMap.setMyLocationEnabled(typedArray.getBoolean(R.styleable.MapView_my_location_enabled, false)); -// } finally { -// typedArray.recycle(); -// } + setInitialState(options); + + // Shows the zoom controls + if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) { + mMapboxMap.getUiSettings().setZoomControlsEnabled(true); + } + } + + private void setInitialState(MapboxMapOptions options) { + mMapboxMap.setDebugActive(options.getDebugActive()); + + CameraPosition position = options.getCamera(); + if (position != null) { + mMapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(position)); + } + + String accessToken = options.getAccessToken(); + if (!TextUtils.isEmpty(accessToken)) { + mMapboxMap.setAccessToken(accessToken); + } + + String style = options.getStyle(); + if (!TextUtils.isEmpty(style)) { + mMapboxMap.setStyleUrl(style); + } + + mMapboxMap.setMyLocationEnabled(options.getLocationEnabled()); + + // Enable gestures + UiSettings uiSettings = mMapboxMap.getUiSettings(); + uiSettings.setZoomGesturesEnabled(options.getZoomGesturesEnabled()); + uiSettings.setScrollGesturesEnabled(options.getScrollGesturesEnabled()); + uiSettings.setRotateGesturesEnabled(options.getRotateGesturesEnabled()); + uiSettings.setTiltGesturesEnabled(options.getTiltGesturesEnabled()); + uiSettings.setZoomControlsEnabled(options.getZoomControlsEnabled()); + + // Zoom + uiSettings.setMaxZoom(options.getMaxZoom()); + uiSettings.setMinZoom(options.getMinZoom()); + + // Compass + uiSettings.setCompassEnabled(options.getCompassEnabled()); + uiSettings.setCompassGravity(options.getCompassGravity()); + int[] compassMargins = options.getCompassMargins(); + if (compassMargins != null) { + uiSettings.setCompassMargins(compassMargins[0], compassMargins[1], compassMargins[2], compassMargins[3]); + } + + // Logo + uiSettings.setLogoEnabled(options.getLogoEnabled()); + uiSettings.setLogoGravity(options.getLogoGravity()); + int[] logoMargins = options.getLogoMargins(); + if (logoMargins != null) { + uiSettings.setLogoMargins(logoMargins[0], logoMargins[1], logoMargins[2], logoMargins[3]); + } + + // Attribution + uiSettings.setAttributionEnabled(options.getAttributionEnabled()); + uiSettings.setAttributionGravity(options.getAttributionGravity()); + int[] attributionMargins = options.getAttributionMargins(); + if (attributionMargins != null) { + uiSettings.setAttributionMargins(attributionMargins[0], attributionMargins[1], attributionMargins[2], attributionMargins[3]); + } } // @@ -359,7 +350,6 @@ public class MapView extends FrameLayout { , savedInstanceState.getInt(MapboxConstants.STATE_ATTRIBUTION_MARGIN_RIGHT) , savedInstanceState.getInt(MapboxConstants.STATE_ATTRIBUTION_MARGIN_BOTTOM)); - mMapboxMap.setDebugActive(savedInstanceState.getBoolean(MapboxConstants.STATE_DEBUG_ACTIVE)); mMapboxMap.setStyleUrl(savedInstanceState.getString(MapboxConstants.STATE_STYLE_URL)); setAccessToken(savedInstanceState.getString(MapboxConstants.STATE_ACCESS_TOKEN)); @@ -435,7 +425,6 @@ public class MapView extends FrameLayout { outState.putLong(MapboxConstants.STATE_DEFAULT_TRANSITION_DURATION, mNativeMapView.getDefaultTransitionDuration()); outState.putBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED, mMapboxMap.isMyLocationEnabled()); - // TrackingSettings TrackingSettings trackingSettings = mMapboxMap.getTrackingSettings(); outState.putInt(MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, trackingSettings.getMyLocationTrackingMode()); @@ -809,12 +798,9 @@ public class MapView extends FrameLayout { * You must set a valid access token before you call {@link MapView#onCreate(Bundle)} * or an exception will be thrown. * </p> - * You can use {@link ApiAccess#getToken(Context)} to load an access token from your - * application's manifest. * * @param accessToken Your public Mapbox access token. * @see MapView#onCreate(Bundle) - * @see ApiAccess#getToken(Context) */ @UiThread public void setAccessToken(@NonNull String accessToken) { @@ -863,7 +849,7 @@ public class MapView extends FrameLayout { } } } catch (Exception e) { - Log.w(TAG, "Error checking for Telemetry Service Config: " + e); + Log.w(MapboxConstants.TAG, "Error checking for Telemetry Service Config: " + e); } throw new TelemetryServiceNotConfiguredException(); } @@ -954,12 +940,12 @@ public class MapView extends FrameLayout { return; } if (updatedMarker == null) { - Log.w(TAG, "marker was null, doing nothing"); + Log.w(MapboxConstants.TAG, "marker was null, doing nothing"); return; } if (updatedMarker.getId() == -1) { - Log.w(TAG, "marker has an id of -1, possibly was not added yet, doing nothing"); + Log.w(MapboxConstants.TAG, "marker has an id of -1, possibly was not added yet, doing nothing"); } ensureIconLoaded(updatedMarker); @@ -1048,7 +1034,7 @@ public class MapView extends FrameLayout { } if (bbox == null) { - Log.w(TAG, "bbox was null, so just returning null"); + Log.w(MapboxConstants.TAG, "bbox was null, so just returning null"); return null; } @@ -1753,7 +1739,6 @@ public class MapView extends FrameLayout { PointF centerPoint = mUserLocationView.getMarkerScreenPoint(); mNativeMapView.scaleBy(detector.getScaleFactor(), centerPoint.x / mScreenDensity, centerPoint.y / mScreenDensity); } - trackGestureEvent(MapboxEvent.GESTURE_QUICK_ZOOM, detector.getFocusX(), detector.getFocusY()); } return true; } @@ -1841,7 +1826,7 @@ public class MapView extends FrameLayout { } // This class handles a vertical two-finger shove. (If you place two fingers on screen with - // less than a 20 degree angle between them, this will detect movement on the Y-axis.) +// less than a 20 degree angle between them, this will detect movement on the Y-axis.) private class ShoveGestureListener implements ShoveGestureDetector.OnShoveGestureListener { long mBeginTime = 0; @@ -1912,7 +1897,7 @@ public class MapView extends FrameLayout { } // This class handles input events from the zoom control buttons - // Zoom controls allow single touch only devices to zoom in and out +// Zoom controls allow single touch only devices to zoom in and out private class OnZoomListener implements ZoomButtonsController.OnZoomListener { // Not used @@ -2219,9 +2204,9 @@ public class MapView extends FrameLayout { } } - // - // Connectivity events - // +// +// Connectivity events +// // This class handles connectivity changes private class ConnectivityReceiver extends BroadcastReceiver { 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 fd582c2c8c..5aff0d6569 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 @@ -4,6 +4,8 @@ import android.content.Context; import android.content.res.TypedArray; import android.os.Parcel; import android.os.Parcelable; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.Gravity; @@ -27,11 +29,11 @@ public class MapboxMapOptions implements Parcelable { private int compassMargins[]; private boolean logoEnabled = true; - private int logoGravity; + private int logoGravity = Gravity.BOTTOM | Gravity.START; private int logoMargins[]; private boolean attributionEnabled = true; - private int attributionGravity; + private int attributionGravity = Gravity.BOTTOM; private int attributionMargins[]; private float minZoom = MapboxConstants.MINIMUM_ZOOM; @@ -40,8 +42,8 @@ public class MapboxMapOptions implements Parcelable { private boolean rotateGesturesEnabled = true; private boolean scrollGesturesEnabled = true; private boolean tiltGesturesEnabled = true; - private boolean zoomControlsEnabled = true; private boolean zoomGesturesEnabled = true; + private boolean zoomControlsEnabled = false; private boolean locationEnabled; @@ -54,17 +56,35 @@ public class MapboxMapOptions implements Parcelable { private MapboxMapOptions(Parcel in) { cameraPosition = in.readParcelable(CameraPosition.class.getClassLoader()); debugActive = in.readByte() != 0; + compassEnabled = in.readByte() != 0; + compassGravity = in.readInt(); + compassMargins = in.createIntArray(); + + logoEnabled = in.readByte() != 0; + logoGravity = in.readInt(); + logoMargins = in.createIntArray(); + + attributionEnabled = in.readByte() != 0; + attributionGravity = in.readInt(); + attributionMargins = in.createIntArray(); + + minZoom = in.readFloat(); + maxZoom = in.readFloat(); + rotateGesturesEnabled = in.readByte() != 0; scrollGesturesEnabled = in.readByte() != 0; tiltGesturesEnabled = in.readByte() != 0; zoomControlsEnabled = in.readByte() != 0; zoomGesturesEnabled = in.readByte() != 0; + + locationEnabled = in.readByte() != 0; + style = in.readString(); accessToken = in.readString(); } - public static MapboxMapOptions createFromAttributes(Context context, AttributeSet attrs) { + public static MapboxMapOptions createFromAttributes(@NonNull Context context, @Nullable AttributeSet attrs) { MapboxMapOptions mapboxMapOptions = new MapboxMapOptions(); float screenDensity = context.getResources().getDisplayMetrics().density; TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MapView, 0, 0); @@ -91,30 +111,25 @@ public class MapboxMapOptions implements Parcelable { , ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_top, DIMENSION_TEN_DP * screenDensity)) , ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_right, DIMENSION_TEN_DP * screenDensity)) , ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_bottom, DIMENSION_TEN_DP * screenDensity))}); -// -// // Logo - uiSettings.setLogoEnabled(typedArray.getBoolean(R.styleable.MapView_logo_visibility, true)); - uiSettings.setLogoGravity(typedArray.getInt(R.styleable.MapView_logo_gravity, Gravity.BOTTOM | Gravity.START)); - uiSettings.setLogoMargins((int) (typedArray.getDimension(R.styleable.MapView_logo_margin_left, DIMENSION_SIXTEEN_DP) * mScreenDensity) - , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_top, DIMENSION_SIXTEEN_DP) * mScreenDensity) - , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_right, DIMENSION_SIXTEEN_DP) * mScreenDensity) - , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_bottom, DIMENSION_SIXTEEN_DP) * mScreenDensity)); -// -// // Attribution -// uiSettings.setAttributionEnabled(typedArray.getBoolean(R.styleable.MapView_attribution_visibility, true)); -// uiSettings.setAttributionGravity(typedArray.getInt(R.styleable.MapView_attribution_gravity, Gravity.BOTTOM)); -// uiSettings.setAttributionMargins((int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_left, DIMENSION_SEVENTY_SIX_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_top, DIMENSION_SEVEN_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_right, DIMENSION_SEVEN_DP) * mScreenDensity) -// , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_bottom, DIMENSION_SEVEN_DP) * mScreenDensity)); -// -// // User location -// mMapboxMap.setMyLocationEnabled(typedArray.getBoolean(R.styleable.MapView_my_location_enabled, false)); + + mapboxMapOptions.logoEnabled(typedArray.getBoolean(R.styleable.MapView_logo_visibility, true)); + mapboxMapOptions.logoGravity(typedArray.getInt(R.styleable.MapView_logo_gravity, Gravity.BOTTOM | Gravity.START)); + mapboxMapOptions.logoMargins(new int[]{(int) (typedArray.getDimension(R.styleable.MapView_logo_margin_left, DIMENSION_SIXTEEN_DP) * screenDensity) + , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_top, DIMENSION_SIXTEEN_DP) * screenDensity) + , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_right, DIMENSION_SIXTEEN_DP) * screenDensity) + , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_bottom, DIMENSION_SIXTEEN_DP) * screenDensity)}); + + mapboxMapOptions.attributionEnabled(typedArray.getBoolean(R.styleable.MapView_attribution_visibility, true)); + mapboxMapOptions.attributionGravity(typedArray.getInt(R.styleable.MapView_attribution_gravity, Gravity.BOTTOM)); + mapboxMapOptions.attributionMargins(new int[]{(int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_left, DIMENSION_SEVENTY_SIX_DP) * screenDensity) + , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_top, DIMENSION_SEVEN_DP) * screenDensity) + , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_right, DIMENSION_SEVEN_DP) * screenDensity) + , (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_bottom, DIMENSION_SEVEN_DP) * screenDensity)}); + + mapboxMapOptions.locationEnabled(typedArray.getBoolean(R.styleable.MapView_my_location_enabled, false)); } finally { typedArray.recycle(); } - - return mapboxMapOptions; } @@ -163,21 +178,36 @@ public class MapboxMapOptions implements Parcelable { return this; } - public MapboxMapOptions logoEnabled(boolean enabled){ - logoEnabled = enabled; - return this + public MapboxMapOptions logoEnabled(boolean enabled) { + logoEnabled = enabled; + return this; } - public MapboxMapOptions logoGravity(int gravity){ + public MapboxMapOptions logoGravity(int gravity) { logoGravity = gravity; return this; } - public MapboxMapOptions logoMargins(int[]margins){ + public MapboxMapOptions logoMargins(int[] margins) { logoMargins = margins; return this; } + public MapboxMapOptions attributionEnabled(boolean enabled) { + attributionEnabled = enabled; + return this; + } + + public MapboxMapOptions attributionGravity(int gravity) { + attributionGravity = gravity; + return this; + } + + public MapboxMapOptions attributionMargins(int[] margins) { + attributionMargins = margins; + return this; + } + public MapboxMapOptions rotateGesturesEnabled(boolean enabled) { rotateGesturesEnabled = enabled; return this; @@ -203,6 +233,11 @@ public class MapboxMapOptions implements Parcelable { return this; } + public MapboxMapOptions locationEnabled(boolean locationEnabled) { + this.locationEnabled = locationEnabled; + return this; + } + public CameraPosition getCamera() { return cameraPosition; } @@ -255,7 +290,7 @@ public class MapboxMapOptions implements Parcelable { return scrollGesturesEnabled; } - public boolean getTitltGesturesEnabeld() { + public boolean getTiltGesturesEnabled() { return tiltGesturesEnabled; } @@ -267,6 +302,26 @@ public class MapboxMapOptions implements Parcelable { return zoomGesturesEnabled; } + public boolean getAttributionEnabled() { + return attributionEnabled; + } + + public int getAttributionGravity() { + return attributionGravity; + } + + public int[] getAttributionMargins() { + return attributionMargins; + } + + public boolean getLocationEnabled() { + return locationEnabled; + } + + public boolean getDebugActive() { + return debugActive; + } + public static final Parcelable.Creator<MapboxMapOptions> CREATOR = new Parcelable.Creator<MapboxMapOptions>() { public MapboxMapOptions createFromParcel(Parcel in) { @@ -287,12 +342,30 @@ public class MapboxMapOptions implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(cameraPosition, flags); dest.writeByte((byte) (debugActive ? 1 : 0)); + dest.writeByte((byte) (compassEnabled ? 1 : 0)); + dest.writeInt(compassGravity); + dest.writeIntArray(compassMargins); + + dest.writeByte((byte) (logoEnabled ? 1 : 0)); + dest.writeInt(logoGravity); + dest.writeIntArray(logoMargins); + + dest.writeByte((byte) (attributionEnabled ? 1 : 0)); + dest.writeInt(attributionGravity); + dest.writeIntArray(attributionMargins); + + dest.writeFloat(minZoom); + dest.writeFloat(maxZoom); + dest.writeByte((byte) (rotateGesturesEnabled ? 1 : 0)); dest.writeByte((byte) (scrollGesturesEnabled ? 1 : 0)); dest.writeByte((byte) (tiltGesturesEnabled ? 1 : 0)); dest.writeByte((byte) (zoomControlsEnabled ? 1 : 0)); dest.writeByte((byte) (zoomGesturesEnabled ? 1 : 0)); + + dest.writeByte((byte) (locationEnabled ? 1 : 0)); + dest.writeString(style); dest.writeString(accessToken); } |