summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java22
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java1076
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java441
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java6
-rwxr-xr-xplatform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java208
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java20
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java24
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/ViewSettings.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java74
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java6
10 files changed, 946 insertions, 933 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java
index d321c3ec59..22f42c1d51 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java
@@ -35,8 +35,8 @@ import com.mapbox.mapboxsdk.exceptions.InvalidAccessTokenException;
*/
public final class MapFragment extends Fragment {
- private MapView mMap;
- private OnMapReadyCallback mOnMapReadyCallback;
+ private MapView map;
+ private OnMapReadyCallback onMapReadyCallback;
/**
* Creates a MapFragment instance
@@ -106,7 +106,7 @@ public final class MapFragment extends Fragment {
options.myLocationBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_background));
}
- return mMap = new MapView(inflater.getContext(), options);
+ return map = new MapView(inflater.getContext(), options);
}
/**
@@ -150,7 +150,7 @@ public final class MapFragment extends Fragment {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- mMap.onCreate(savedInstanceState);
+ map.onCreate(savedInstanceState);
}
/**
@@ -159,7 +159,7 @@ public final class MapFragment extends Fragment {
@Override
public void onStart() {
super.onStart();
- mMap.getMapAsync(mOnMapReadyCallback);
+ map.getMapAsync(onMapReadyCallback);
}
/**
@@ -168,7 +168,7 @@ public final class MapFragment extends Fragment {
@Override
public void onResume() {
super.onResume();
- mMap.onResume();
+ map.onResume();
}
/**
@@ -177,7 +177,7 @@ public final class MapFragment extends Fragment {
@Override
public void onPause() {
super.onPause();
- mMap.onPause();
+ map.onPause();
}
/**
@@ -188,7 +188,7 @@ public final class MapFragment extends Fragment {
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
- mMap.onSaveInstanceState(outState);
+ map.onSaveInstanceState(outState);
}
/**
@@ -205,7 +205,7 @@ public final class MapFragment extends Fragment {
@Override
public void onLowMemory() {
super.onLowMemory();
- mMap.onLowMemory();
+ map.onLowMemory();
}
/**
@@ -214,7 +214,7 @@ public final class MapFragment extends Fragment {
@Override
public void onDestroyView() {
super.onDestroyView();
- mMap.onDestroy();
+ map.onDestroy();
}
/**
@@ -223,6 +223,6 @@ public final class MapFragment extends Fragment {
* @param onMapReadyCallback The callback to be invoked.
*/
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
- mOnMapReadyCallback = onMapReadyCallback;
+ this.onMapReadyCallback = onMapReadyCallback;
}
}
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 9b7c691c3d..a7823c270f 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
@@ -112,52 +112,52 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
public class MapView extends FrameLayout {
- private MapboxMap mMapboxMap;
- private boolean mInitialLoad;
- private boolean mDestroyed;
-
- private List<Icon> mIcons;
- private int mAverageIconHeight;
- private int mAverageIconWidth;
-
- private NativeMapView mNativeMapView;
- private boolean mHasSurface = false;
-
- private ViewGroup mMarkerViewContainer;
- private CompassView mCompassView;
- private ImageView mLogoView;
- private ImageView mAttributionsView;
- private MyLocationView mMyLocationView;
- private LocationListener mMyLocationListener;
-
- private CopyOnWriteArrayList<OnMapChangedListener> mOnMapChangedListener;
- private ZoomButtonsController mZoomButtonsController;
- private ConnectivityReceiver mConnectivityReceiver;
- private float mScreenDensity = 1.0f;
-
- private TrackballLongPressTimeOut mCurrentTrackballLongPressTimeOut;
- private GestureDetectorCompat mGestureDetector;
- private ScaleGestureDetector mScaleGestureDetector;
- private RotateGestureDetector mRotateGestureDetector;
- private ShoveGestureDetector mShoveGestureDetector;
- private boolean mTwoTap = false;
- private boolean mZoomStarted = false;
- private boolean mDragStarted = false;
- private boolean mQuickZoom = false;
- private boolean mScrollInProgress = false;
-
- private int mContentPaddingLeft;
- private int mContentPaddingTop;
- private int mContentPaddingRight;
- private int mContentPaddingBottom;
-
- private PointF mFocalPoint;
-
- private String mStyleUrl;
- private String mInitalStyle;
-
- private List<OnMapReadyCallback> mOnMapReadyCallbackList;
- private SnapshotRequest mSnapshotRequest;
+ private MapboxMap mapboxMap;
+ private boolean initialLoad;
+ private boolean destroyed;
+
+ private List<Icon> icons;
+ private int averageIconHeight;
+ private int averageIconWidth;
+
+ private NativeMapView nativeMapView;
+ private boolean hasSurface = false;
+
+ private ViewGroup markerViewContainer;
+ private CompassView compassView;
+ private ImageView logoView;
+ private ImageView attributionsView;
+ private MyLocationView myLocationView;
+ private LocationListener myLocationListener;
+
+ private CopyOnWriteArrayList<OnMapChangedListener> onMapChangedListener;
+ private ZoomButtonsController zoomButtonsController;
+ private ConnectivityReceiver connectivityReceiver;
+ private float screenDensity = 1.0f;
+
+ private TrackballLongPressTimeOut currentTrackballLongPressTimeOut;
+ private GestureDetectorCompat gestureDetector;
+ private ScaleGestureDetector scaleGestureDetector;
+ private RotateGestureDetector rotateGestureDetector;
+ private ShoveGestureDetector shoveGestureDetector;
+ private boolean twoTap = false;
+ private boolean zoomStarted = false;
+ private boolean dragStarted = false;
+ private boolean quickZoom = false;
+ private boolean scrollInProgress = false;
+
+ private int contentPaddingLeft;
+ private int contentPaddingTop;
+ private int contentPaddingRight;
+ private int contentPaddingBottom;
+
+ private PointF focalPoint;
+
+ private String styleUrl;
+ private String initalStyle;
+
+ private List<OnMapReadyCallback> onMapReadyCallbackList;
+ private SnapshotRequest snapshotRequest;
@UiThread
public MapView(@NonNull Context context) {
@@ -190,18 +190,18 @@ public class MapView extends FrameLayout {
return;
}
- mInitialLoad = true;
- mOnMapReadyCallbackList = new ArrayList<>();
- mOnMapChangedListener = new CopyOnWriteArrayList<>();
- mMapboxMap = new MapboxMap(this);
- mIcons = new ArrayList<>();
+ initialLoad = true;
+ onMapReadyCallbackList = new ArrayList<>();
+ onMapChangedListener = new CopyOnWriteArrayList<>();
+ mapboxMap = new MapboxMap(this);
+ icons = new ArrayList<>();
View view = LayoutInflater.from(context).inflate(R.layout.mapview_internal, this);
setWillNotDraw(false);
// Reference the TextureView
SurfaceView surfaceView = (SurfaceView) view.findViewById(R.id.surfaceView);
- mNativeMapView = new NativeMapView(this);
+ nativeMapView = new NativeMapView(this);
// Ensure this view is interactable
setClickable(true);
@@ -213,51 +213,51 @@ public class MapView extends FrameLayout {
surfaceView.getHolder().addCallback(new SurfaceCallback());
// Touch gesture detectors
- mGestureDetector = new GestureDetectorCompat(context, new GestureListener());
- mGestureDetector.setIsLongpressEnabled(true);
- mScaleGestureDetector = new ScaleGestureDetector(context, new ScaleGestureListener());
- ScaleGestureDetectorCompat.setQuickScaleEnabled(mScaleGestureDetector, true);
- mRotateGestureDetector = new RotateGestureDetector(context, new RotateGestureListener());
- mShoveGestureDetector = new ShoveGestureDetector(context, new ShoveGestureListener());
+ gestureDetector = new GestureDetectorCompat(context, new GestureListener());
+ gestureDetector.setIsLongpressEnabled(true);
+ scaleGestureDetector = new ScaleGestureDetector(context, new ScaleGestureListener());
+ ScaleGestureDetectorCompat.setQuickScaleEnabled(scaleGestureDetector, true);
+ rotateGestureDetector = new RotateGestureDetector(context, new RotateGestureListener());
+ shoveGestureDetector = new ShoveGestureDetector(context, new ShoveGestureListener());
- mZoomButtonsController = new ZoomButtonsController(this);
- mZoomButtonsController.setZoomSpeed(MapboxConstants.ANIMATION_DURATION);
- mZoomButtonsController.setOnZoomListener(new OnZoomListener());
+ zoomButtonsController = new ZoomButtonsController(this);
+ zoomButtonsController.setZoomSpeed(MapboxConstants.ANIMATION_DURATION);
+ zoomButtonsController.setOnZoomListener(new OnZoomListener());
// Connectivity
onConnectivityChanged(isConnected());
- mMarkerViewContainer = (ViewGroup) view.findViewById(R.id.markerViewContainer);
+ markerViewContainer = (ViewGroup) view.findViewById(R.id.markerViewContainer);
- mMyLocationView = (MyLocationView) view.findViewById(R.id.userLocationView);
- mMyLocationView.setMapboxMap(mMapboxMap);
+ myLocationView = (MyLocationView) view.findViewById(R.id.userLocationView);
+ myLocationView.setMapboxMap(mapboxMap);
- mCompassView = (CompassView) view.findViewById(R.id.compassView);
- mCompassView.setMapboxMap(mMapboxMap);
+ compassView = (CompassView) view.findViewById(R.id.compassView);
+ compassView.setMapboxMap(mapboxMap);
- mLogoView = (ImageView) view.findViewById(R.id.logoView);
+ logoView = (ImageView) view.findViewById(R.id.logoView);
// Setup Attributions control
- mAttributionsView = (ImageView) view.findViewById(R.id.attributionView);
- mAttributionsView.setOnClickListener(new AttributionOnClickListener(this));
+ attributionsView = (ImageView) view.findViewById(R.id.attributionView);
+ attributionsView.setOnClickListener(new AttributionOnClickListener(this));
- mScreenDensity = context.getResources().getDisplayMetrics().density;
+ screenDensity = context.getResources().getDisplayMetrics().density;
setInitialState(options);
// Shows the zoom controls
if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) {
- mMapboxMap.getUiSettings().setZoomControlsEnabled(true);
+ mapboxMap.getUiSettings().setZoomControlsEnabled(true);
}
}
private void setInitialState(MapboxMapOptions options) {
- mMapboxMap.setDebugActive(options.getDebugActive());
+ mapboxMap.setDebugActive(options.getDebugActive());
CameraPosition position = options.getCamera();
if (position != null) {
- mMapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(position));
- mMyLocationView.setTilt(position.tilt);
+ mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(position));
+ myLocationView.setTilt(position.tilt);
}
// api base url
@@ -269,27 +269,29 @@ public class MapView extends FrameLayout {
// access token
String accessToken = options.getAccessToken();
if (!TextUtils.isEmpty(accessToken)) {
- mMapboxMap.setAccessToken(accessToken);
+ mapboxMap.setAccessToken(accessToken);
}
// style url
String style = options.getStyle();
if (!TextUtils.isEmpty(style)) {
- mInitalStyle = style;
+ initalStyle = style;
}
// MyLocationView
- MyLocationViewSettings myLocationViewSettings = mMapboxMap.getMyLocationViewSettings();
- myLocationViewSettings.setForegroundDrawable(options.getMyLocationForegroundDrawable(), options.getMyLocationForegroundBearingDrawable());
+ MyLocationViewSettings myLocationViewSettings = mapboxMap.getMyLocationViewSettings();
+ myLocationViewSettings.setForegroundDrawable(
+ options.getMyLocationForegroundDrawable(), options.getMyLocationForegroundBearingDrawable());
myLocationViewSettings.setForegroundTintColor(options.getMyLocationForegroundTintColor());
- myLocationViewSettings.setBackgroundDrawable(options.getMyLocationBackgroundDrawable(), options.getMyLocationBackgroundPadding());
+ myLocationViewSettings.setBackgroundDrawable(
+ options.getMyLocationBackgroundDrawable(), options.getMyLocationBackgroundPadding());
myLocationViewSettings.setBackgroundTintColor(options.getMyLocationBackgroundTintColor());
myLocationViewSettings.setAccuracyAlpha(options.getMyLocationAccuracyAlpha());
myLocationViewSettings.setAccuracyTintColor(options.getMyLocationAccuracyTintColor());
- mMapboxMap.setMyLocationEnabled(options.getLocationEnabled());
+ mapboxMap.setMyLocationEnabled(options.getLocationEnabled());
// Enable gestures
- UiSettings uiSettings = mMapboxMap.getUiSettings();
+ UiSettings uiSettings = mapboxMap.getUiSettings();
uiSettings.setZoomGesturesEnabled(options.getZoomGesturesEnabled());
uiSettings.setZoomGestureChangeAllowed(options.getZoomGesturesEnabled());
uiSettings.setScrollGesturesEnabled(options.getScrollGesturesEnabled());
@@ -303,8 +305,8 @@ public class MapView extends FrameLayout {
uiSettings.setZoomControlsEnabled(options.getZoomControlsEnabled());
// Zoom
- mMapboxMap.setMaxZoom(options.getMaxZoom());
- mMapboxMap.setMinZoom(options.getMinZoom());
+ mapboxMap.setMaxZoom(options.getMaxZoom());
+ mapboxMap.setMinZoom(options.getMinZoom());
// Compass
uiSettings.setCompassEnabled(options.getCompassEnabled());
@@ -342,8 +344,8 @@ public class MapView extends FrameLayout {
}
int attributionTintColor = options.getAttributionTintColor();
- uiSettings.setAttributionTintColor(attributionTintColor != -1 ?
- attributionTintColor : ColorUtils.getPrimaryColor(getContext()));
+ uiSettings.setAttributionTintColor(attributionTintColor != -1
+ ? attributionTintColor : ColorUtils.getPrimaryColor(getContext()));
}
//
@@ -363,10 +365,10 @@ public class MapView extends FrameLayout {
*/
@UiThread
public void onCreate(@Nullable Bundle savedInstanceState) {
- String accessToken = mMapboxMap.getAccessToken();
+ String accessToken = mapboxMap.getAccessToken();
if (TextUtils.isEmpty(accessToken)) {
accessToken = MapboxAccountManager.getInstance().getAccessToken();
- mMapboxMap.setAccessToken(accessToken);
+ mapboxMap.setAccessToken(accessToken);
} else {
// user provided access token through xml attributes, need to start MapboxAccountManager
MapboxAccountManager.start(getContext(), accessToken);
@@ -380,10 +382,10 @@ public class MapView extends FrameLayout {
// Get previous camera position
CameraPosition cameraPosition = savedInstanceState.getParcelable(MapboxConstants.STATE_CAMERA_POSITION);
if (cameraPosition != null) {
- mMapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
+ mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
- UiSettings uiSettings = mMapboxMap.getUiSettings();
+ UiSettings uiSettings = mapboxMap.getUiSettings();
uiSettings.setZoomGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED));
uiSettings.setZoomGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE));
uiSettings.setScrollGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_SCROLL_ENABLED));
@@ -397,10 +399,10 @@ public class MapView extends FrameLayout {
// Compass
uiSettings.setCompassEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_COMPASS_ENABLED));
uiSettings.setCompassGravity(savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_GRAVITY));
- uiSettings.setCompassMargins(savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_LEFT)
- , savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_TOP)
- , savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_RIGHT)
- , savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_BOTTOM));
+ uiSettings.setCompassMargins(savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_LEFT),
+ savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_TOP),
+ savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_RIGHT),
+ savedInstanceState.getInt(MapboxConstants.STATE_COMPASS_MARGIN_BOTTOM));
// Logo
uiSettings.setLogoEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_LOGO_ENABLED));
@@ -418,21 +420,23 @@ 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));
+ mapboxMap.setDebugActive(savedInstanceState.getBoolean(MapboxConstants.STATE_DEBUG_ACTIVE));
+ mapboxMap.setStyleUrl(savedInstanceState.getString(MapboxConstants.STATE_STYLE_URL));
// User location
try {
- mMapboxMap.setMyLocationEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED));
+ mapboxMap.setMyLocationEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED));
} catch (SecurityException ignore) {
// User did not accept location permissions
}
- TrackingSettings trackingSettings = mMapboxMap.getTrackingSettings();
+ TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
//noinspection ResourceType
- trackingSettings.setMyLocationTrackingMode(savedInstanceState.getInt(MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, MyLocationTracking.TRACKING_NONE));
+ trackingSettings.setMyLocationTrackingMode(
+ savedInstanceState.getInt(MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, MyLocationTracking.TRACKING_NONE));
//noinspection ResourceType
- trackingSettings.setMyBearingTrackingMode(savedInstanceState.getInt(MapboxConstants.STATE_MY_BEARING_TRACKING_MODE, MyBearingTracking.NONE));
+ trackingSettings.setMyBearingTrackingMode(
+ savedInstanceState.getInt(MapboxConstants.STATE_MY_BEARING_TRACKING_MODE, MyBearingTracking.NONE));
} else if (savedInstanceState == null) {
// Start Telemetry (authorization determined in initial MapboxEventManager constructor)
Log.i(MapView.class.getCanonicalName(), "MapView start Telemetry...");
@@ -441,35 +445,35 @@ public class MapView extends FrameLayout {
}
// Initialize EGL
- mNativeMapView.initializeDisplay();
- mNativeMapView.initializeContext();
+ nativeMapView.initializeDisplay();
+ nativeMapView.initializeContext();
// Add annotation deselection listener
addOnMapChangedListener(new OnMapChangedListener() {
@Override
public void onMapChanged(@MapChange int change) {
- if (change == WILL_START_RENDERING_MAP && mInitialLoad) {
- mInitialLoad = false;
+ if (change == WILL_START_RENDERING_MAP && initialLoad) {
+ initialLoad = false;
reloadIcons();
reloadMarkers();
adjustTopOffsetPixels();
- if (mOnMapReadyCallbackList.size() > 0) {
- Iterator<OnMapReadyCallback> iterator = mOnMapReadyCallbackList.iterator();
+ if (onMapReadyCallbackList.size() > 0) {
+ Iterator<OnMapReadyCallback> iterator = onMapReadyCallbackList.iterator();
while (iterator.hasNext()) {
OnMapReadyCallback callback = iterator.next();
- callback.onMapReady(mMapboxMap);
+ callback.onMapReady(mapboxMap);
iterator.remove();
}
- mMapboxMap.getMarkerViewManager().scheduleViewMarkerInvalidation();
+ mapboxMap.getMarkerViewManager().scheduleViewMarkerInvalidation();
}
} else if (change == REGION_IS_CHANGING || change == REGION_DID_CHANGE || change == DID_FINISH_LOADING_MAP) {
- mMapboxMap.getMarkerViewManager().scheduleViewMarkerInvalidation();
+ mapboxMap.getMarkerViewManager().scheduleViewMarkerInvalidation();
- mCompassView.update(getDirection());
- mMyLocationView.update();
- mMapboxMap.getMarkerViewManager().update();
+ compassView.update(getDirection());
+ myLocationView.update();
+ mapboxMap.getMarkerViewManager().update();
- for (InfoWindow infoWindow : mMapboxMap.getInfoWindows()) {
+ for (InfoWindow infoWindow : mapboxMap.getInfoWindows()) {
infoWindow.update();
}
}
@@ -496,18 +500,18 @@ public class MapView extends FrameLayout {
@UiThread
public void onSaveInstanceState(@NonNull Bundle outState) {
outState.putBoolean(MapboxConstants.STATE_HAS_SAVED_STATE, true);
- outState.putParcelable(MapboxConstants.STATE_CAMERA_POSITION, mMapboxMap.getCameraPosition());
- outState.putBoolean(MapboxConstants.STATE_DEBUG_ACTIVE, mMapboxMap.isDebugActive());
- outState.putString(MapboxConstants.STATE_STYLE_URL, mStyleUrl);
- outState.putBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED, mMapboxMap.isMyLocationEnabled());
+ outState.putParcelable(MapboxConstants.STATE_CAMERA_POSITION, mapboxMap.getCameraPosition());
+ outState.putBoolean(MapboxConstants.STATE_DEBUG_ACTIVE, mapboxMap.isDebugActive());
+ outState.putString(MapboxConstants.STATE_STYLE_URL, styleUrl);
+ outState.putBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED, mapboxMap.isMyLocationEnabled());
// TrackingSettings
- TrackingSettings trackingSettings = mMapboxMap.getTrackingSettings();
+ TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
outState.putInt(MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, trackingSettings.getMyLocationTrackingMode());
outState.putInt(MapboxConstants.STATE_MY_BEARING_TRACKING_MODE, trackingSettings.getMyBearingTrackingMode());
// UiSettings
- UiSettings uiSettings = mMapboxMap.getUiSettings();
+ UiSettings uiSettings = mapboxMap.getUiSettings();
outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED, uiSettings.isZoomGesturesEnabled());
outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE, uiSettings.isZoomGestureChangeAllowed());
outState.putBoolean(MapboxConstants.STATE_SCROLL_ENABLED, uiSettings.isScrollGesturesEnabled());
@@ -548,12 +552,12 @@ public class MapView extends FrameLayout {
*/
@UiThread
public void onDestroy() {
- mDestroyed = true;
- mNativeMapView.terminateContext();
- mNativeMapView.terminateDisplay();
- mNativeMapView.destroySurface();
- mNativeMapView.destroy();
- mNativeMapView = null;
+ destroyed = true;
+ nativeMapView.terminateContext();
+ nativeMapView.terminateDisplay();
+ nativeMapView.destroySurface();
+ nativeMapView.destroy();
+ nativeMapView = null;
}
/**
@@ -562,12 +566,12 @@ public class MapView extends FrameLayout {
@UiThread
public void onPause() {
// Register for connectivity changes
- if (mConnectivityReceiver != null) {
- getContext().unregisterReceiver(mConnectivityReceiver);
- mConnectivityReceiver = null;
+ if (connectivityReceiver != null) {
+ getContext().unregisterReceiver(connectivityReceiver);
+ connectivityReceiver = null;
}
- mMyLocationView.onPause();
+ myLocationView.onPause();
}
/**
@@ -576,29 +580,29 @@ public class MapView extends FrameLayout {
@UiThread
public void onResume() {
// Register for connectivity changes
- mConnectivityReceiver = new ConnectivityReceiver();
- getContext().registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
+ connectivityReceiver = new ConnectivityReceiver();
+ getContext().registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
- mNativeMapView.update();
- mMyLocationView.onResume();
+ nativeMapView.update();
+ myLocationView.onResume();
- if (mStyleUrl == null) {
+ if (styleUrl == null) {
// user supplied style through xml
// user has failed to supply a style url
- setStyleUrl(mInitalStyle == null ? Style.MAPBOX_STREETS : mInitalStyle);
+ setStyleUrl(initalStyle == null ? Style.MAPBOX_STREETS : initalStyle);
}
}
void setFocalPoint(PointF focalPoint) {
if (focalPoint == null) {
// resetting focal point,
- UiSettings uiSettings = mMapboxMap.getUiSettings();
+ UiSettings uiSettings = mapboxMap.getUiSettings();
// need to validate if we need to reset focal point with user provided one
if (uiSettings.getFocalPoint() != null) {
focalPoint = uiSettings.getFocalPoint();
}
}
- mFocalPoint = focalPoint;
+ this.focalPoint = focalPoint;
}
/**
@@ -606,7 +610,7 @@ public class MapView extends FrameLayout {
*/
@UiThread
public void onLowMemory() {
- mNativeMapView.onLowMemory();
+ nativeMapView.onLowMemory();
}
// Called when debug mode is enabled to update a FPS counter
@@ -616,7 +620,7 @@ public class MapView extends FrameLayout {
post(new Runnable() {
@Override
public void run() {
- MapboxMap.OnFpsChangedListener listener = mMapboxMap.getOnFpsChangedListener();
+ MapboxMap.OnFpsChangedListener listener = mapboxMap.getOnFpsChangedListener();
if (listener != null) {
listener.onFpsChanged(fps);
}
@@ -629,7 +633,7 @@ public class MapView extends FrameLayout {
//
LatLng getLatLng() {
- return mNativeMapView.getLatLng();
+ return nativeMapView.getLatLng();
}
//
@@ -637,12 +641,12 @@ public class MapView extends FrameLayout {
//
double getTilt() {
- return mNativeMapView.getPitch();
+ return nativeMapView.getPitch();
}
void setTilt(Double pitch) {
- mMyLocationView.setTilt(pitch);
- mNativeMapView.setPitch(pitch, 0);
+ myLocationView.setTilt(pitch);
+ nativeMapView.setPitch(pitch, 0);
}
@@ -651,11 +655,11 @@ public class MapView extends FrameLayout {
//
double getDirection() {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- double direction = -mNativeMapView.getBearing();
+ double direction = -nativeMapView.getBearing();
while (direction > 360) {
direction -= 360;
@@ -668,29 +672,29 @@ public class MapView extends FrameLayout {
}
void setDirection(@FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) double direction) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
setDirection(direction, false);
}
void setDirection(@FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) double direction, boolean animated) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
long duration = animated ? MapboxConstants.ANIMATION_DURATION : 0;
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Out of range directions are normalised in setBearing
- mNativeMapView.setBearing(-direction, duration);
+ nativeMapView.setBearing(-direction, duration);
}
void resetNorth() {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mMyLocationView.setBearing(0);
- mNativeMapView.cancelTransitions();
- mNativeMapView.resetNorth();
+ myLocationView.setBearing(0);
+ nativeMapView.cancelTransitions();
+ nativeMapView.resetNorth();
}
//
@@ -698,27 +702,27 @@ public class MapView extends FrameLayout {
//
int getContentPaddingLeft() {
- return mContentPaddingLeft;
+ return contentPaddingLeft;
}
int getContentPaddingTop() {
- return mContentPaddingTop;
+ return contentPaddingTop;
}
int getContentPaddingRight() {
- return mContentPaddingRight;
+ return contentPaddingRight;
}
int getContentPaddingBottom() {
- return mContentPaddingBottom;
+ return contentPaddingBottom;
}
int getContentWidth() {
- return getWidth() - mContentPaddingLeft - mContentPaddingRight;
+ return getWidth() - contentPaddingLeft - contentPaddingRight;
}
int getContentHeight() {
- return getHeight() - mContentPaddingBottom - mContentPaddingTop;
+ return getHeight() - contentPaddingBottom - contentPaddingTop;
}
//
@@ -726,38 +730,38 @@ public class MapView extends FrameLayout {
//
double getZoom() {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- return mNativeMapView.getZoom();
+ return nativeMapView.getZoom();
}
void setMinZoom(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double minZoom) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.setMinZoom(minZoom);
+ nativeMapView.setMinZoom(minZoom);
}
double getMinZoom() {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- return mNativeMapView.getMinZoom();
+ return nativeMapView.getMinZoom();
}
void setMaxZoom(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double maxZoom) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.setMaxZoom(maxZoom);
+ nativeMapView.setMaxZoom(maxZoom);
}
double getMaxZoom() {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- return mNativeMapView.getMaxZoom();
+ return nativeMapView.getMaxZoom();
}
// Zoom in or out
@@ -767,16 +771,16 @@ public class MapView extends FrameLayout {
private void zoom(boolean zoomIn, float x, float y) {
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
if (zoomIn) {
- mNativeMapView.scaleBy(2.0, x / mScreenDensity, y / mScreenDensity, MapboxConstants.ANIMATION_DURATION);
+ nativeMapView.scaleBy(2.0, x / screenDensity, y / screenDensity, MapboxConstants.ANIMATION_DURATION);
} else {
- mNativeMapView.scaleBy(0.5, x / mScreenDensity, y / mScreenDensity, MapboxConstants.ANIMATION_DURATION);
+ nativeMapView.scaleBy(0.5, x / screenDensity, y / screenDensity, MapboxConstants.ANIMATION_DURATION);
}
// work around to invalidate camera position
- postDelayed(new ZoomInvalidator(mMapboxMap), MapboxConstants.ANIMATION_DURATION);
+ postDelayed(new ZoomInvalidator(mapboxMap), MapboxConstants.ANIMATION_DURATION);
}
//
@@ -784,24 +788,24 @@ public class MapView extends FrameLayout {
//
boolean isDebugActive() {
- if (mDestroyed) {
+ if (destroyed) {
return false;
}
- return mNativeMapView.getDebug();
+ return nativeMapView.getDebug();
}
void setDebugActive(boolean debugActive) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.setDebug(debugActive);
+ nativeMapView.setDebug(debugActive);
}
void cycleDebugOptions() {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.cycleDebugOptions();
+ nativeMapView.cycleDebugOptions();
}
//
@@ -837,17 +841,17 @@ public class MapView extends FrameLayout {
* @see Style
*/
public void setStyleUrl(@NonNull String url) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
// stopgap for https://github.com/mapbox/mapbox-gl-native/issues/6242
- if (TextUtils.isEmpty(mNativeMapView.getAccessToken())) {
+ if (TextUtils.isEmpty(nativeMapView.getAccessToken())) {
setAccessToken(MapboxAccountManager.getInstance().getAccessToken());
}
- mStyleUrl = url;
- mNativeMapView.setStyleUrl(url);
+ styleUrl = url;
+ nativeMapView.setStyleUrl(url);
}
/**
@@ -880,7 +884,7 @@ public class MapView extends FrameLayout {
@UiThread
@NonNull
public String getStyleUrl() {
- return mStyleUrl;
+ return styleUrl;
}
//
@@ -889,7 +893,7 @@ public class MapView extends FrameLayout {
@UiThread
void setApiBaseUrl(@NonNull String baseUrl) {
- mNativeMapView.setApiBaseUrl(baseUrl);
+ nativeMapView.setApiBaseUrl(baseUrl);
}
//
@@ -915,7 +919,7 @@ public class MapView extends FrameLayout {
@Deprecated
@UiThread
public void setAccessToken(@NonNull String accessToken) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
// validateAccessToken does the null check
@@ -923,7 +927,7 @@ public class MapView extends FrameLayout {
accessToken = accessToken.trim();
}
MapboxAccountManager.validateAccessToken(accessToken);
- mNativeMapView.setAccessToken(accessToken);
+ nativeMapView.setAccessToken(accessToken);
}
/**
@@ -941,10 +945,10 @@ public class MapView extends FrameLayout {
@UiThread
@Nullable
public String getAccessToken() {
- if (mDestroyed) {
+ if (destroyed) {
return "";
}
- return mNativeMapView.getAccessToken();
+ return nativeMapView.getAccessToken();
}
//
@@ -952,19 +956,19 @@ public class MapView extends FrameLayout {
//
LatLng fromScreenLocation(@NonNull PointF point) {
- if (mDestroyed) {
+ if (destroyed) {
return new LatLng();
}
- point.set(point.x / mScreenDensity, point.y / mScreenDensity);
- return mNativeMapView.latLngForPixel(point);
+ point.set(point.x / screenDensity, point.y / screenDensity);
+ return nativeMapView.latLngForPixel(point);
}
PointF toScreenLocation(@NonNull LatLng location) {
- if (mDestroyed || location == null) {
+ if (destroyed || location == null) {
return new PointF();
}
- PointF pointF = mNativeMapView.pixelForLatLng(location);
- pointF.set(pointF.x * mScreenDensity, pointF.y * mScreenDensity);
+ PointF pointF = nativeMapView.pixelForLatLng(location);
+ pointF.set(pointF.x * screenDensity, pointF.y * screenDensity);
return pointF;
}
@@ -976,27 +980,27 @@ public class MapView extends FrameLayout {
Icon icon = marker.getIcon();
// calculating average before adding
- int iconSize = mIcons.size() + 1;
+ int iconSize = icons.size() + 1;
// TODO replace former if case with anchor implementation,
// current workaround for having extra pixels is diving height by 2
if (icon == null) {
icon = IconFactory.getInstance(getContext()).defaultMarker();
Bitmap bitmap = icon.getBitmap();
- mAverageIconHeight = mAverageIconHeight + (bitmap.getHeight() / 2 - mAverageIconHeight) / iconSize;
- mAverageIconWidth = mAverageIconHeight + (bitmap.getWidth() - mAverageIconHeight) / iconSize;
+ averageIconHeight = averageIconHeight + (bitmap.getHeight() / 2 - averageIconHeight) / iconSize;
+ averageIconWidth = averageIconHeight + (bitmap.getWidth() - averageIconHeight) / iconSize;
marker.setIcon(icon);
} else {
Bitmap bitmap = icon.getBitmap();
- mAverageIconHeight = mAverageIconHeight + (bitmap.getHeight() - mAverageIconHeight) / iconSize;
- mAverageIconWidth = mAverageIconHeight + (bitmap.getWidth() - mAverageIconHeight) / iconSize;
+ averageIconHeight = averageIconHeight + (bitmap.getHeight() - averageIconHeight) / iconSize;
+ averageIconWidth = averageIconHeight + (bitmap.getWidth() - averageIconHeight) / iconSize;
}
- if (!mIcons.contains(icon)) {
- mIcons.add(icon);
+ if (!icons.contains(icon)) {
+ icons.add(icon);
loadIcon(icon);
} else {
- Icon oldIcon = mIcons.get(mIcons.indexOf(icon));
+ Icon oldIcon = icons.get(icons.indexOf(icon));
if (!oldIcon.getBitmap().sameAs(icon.getBitmap())) {
throw new IconBitmapChangedException();
}
@@ -1005,7 +1009,7 @@ public class MapView extends FrameLayout {
}
void loadIcon(Icon icon) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
Bitmap bitmap = icon.getBitmap();
@@ -1021,7 +1025,7 @@ public class MapView extends FrameLayout {
density = DisplayMetrics.DENSITY_DEFAULT;
}
float scale = density / DisplayMetrics.DENSITY_DEFAULT;
- mNativeMapView.addAnnotationIcon(
+ nativeMapView.addAnnotationIcon(
id,
bitmap.getWidth(),
bitmap.getHeight(),
@@ -1029,15 +1033,15 @@ public class MapView extends FrameLayout {
}
void reloadIcons() {
- int count = mIcons.size();
+ int count = icons.size();
for (int i = 0; i < count; i++) {
- Icon icon = mIcons.get(i);
+ Icon icon = icons.get(i);
loadIcon(icon);
}
}
void updateMarker(@NonNull Marker updatedMarker) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
if (updatedMarker == null) {
@@ -1054,12 +1058,12 @@ public class MapView extends FrameLayout {
ensureIconLoaded(updatedMarker);
}
- mNativeMapView.updateMarker(updatedMarker);
+ nativeMapView.updateMarker(updatedMarker);
}
void updatePolygon(Polygon polygon) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
@@ -1073,11 +1077,11 @@ public class MapView extends FrameLayout {
return;
}
- mNativeMapView.updatePolygon(polygon);
+ nativeMapView.updatePolygon(polygon);
}
void updatePolyline(Polyline polyline) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
@@ -1091,7 +1095,7 @@ public class MapView extends FrameLayout {
return;
}
- mNativeMapView.updatePolyline(polyline);
+ nativeMapView.updatePolyline(polyline);
}
private void ensureIconLoaded(Marker marker) {
@@ -1100,85 +1104,85 @@ public class MapView extends FrameLayout {
icon = IconFactory.getInstance(getContext()).defaultMarker();
marker.setIcon(icon);
}
- if (!mIcons.contains(icon)) {
- mIcons.add(icon);
+ if (!icons.contains(icon)) {
+ icons.add(icon);
loadIcon(icon);
} else {
- Icon oldIcon = mIcons.get(mIcons.indexOf(icon));
+ Icon oldIcon = icons.get(icons.indexOf(icon));
if (!oldIcon.getBitmap().sameAs(icon.getBitmap())) {
throw new IconBitmapChangedException();
}
}
// this seems to be a costly operation according to the profiler so I'm trying to save some calls
- Marker previousMarker = marker.getId() != -1 ? (Marker) mMapboxMap.getAnnotation(marker.getId()) : null;
+ Marker previousMarker = marker.getId() != -1 ? (Marker) mapboxMap.getAnnotation(marker.getId()) : null;
if (previousMarker == null || previousMarker.getIcon() == null || previousMarker.getIcon() != marker.getIcon()) {
marker.setTopOffsetPixels(getTopOffsetPixelsForIcon(icon));
}
}
long addMarker(@NonNull Marker marker) {
- if (mDestroyed) {
- return 0l;
+ if (destroyed) {
+ return 0L;
}
- return mNativeMapView.addMarker(marker);
+ return nativeMapView.addMarker(marker);
}
long[] addMarkers(@NonNull List<Marker> markerList) {
- if (mDestroyed) {
+ if (destroyed) {
return new long[]{};
}
- return mNativeMapView.addMarkers(markerList);
+ return nativeMapView.addMarkers(markerList);
}
long addPolyline(@NonNull Polyline polyline) {
- if (mDestroyed) {
- return 0l;
+ if (destroyed) {
+ return 0L;
}
- return mNativeMapView.addPolyline(polyline);
+ return nativeMapView.addPolyline(polyline);
}
long[] addPolylines(@NonNull List<Polyline> polylines) {
- if (mDestroyed) {
+ if (destroyed) {
return new long[]{};
}
- return mNativeMapView.addPolylines(polylines);
+ return nativeMapView.addPolylines(polylines);
}
long addPolygon(@NonNull Polygon polygon) {
- if (mDestroyed) {
- return 0l;
+ if (destroyed) {
+ return 0L;
}
- return mNativeMapView.addPolygon(polygon);
+ return nativeMapView.addPolygon(polygon);
}
long[] addPolygons(@NonNull List<Polygon> polygons) {
- if (mDestroyed) {
+ if (destroyed) {
return new long[]{};
}
- return mNativeMapView.addPolygons(polygons);
+ return nativeMapView.addPolygons(polygons);
}
void removeAnnotation(long id) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.removeAnnotation(id);
+ nativeMapView.removeAnnotation(id);
}
void removeAnnotations(@NonNull long[] ids) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.removeAnnotations(ids);
+ nativeMapView.removeAnnotations(ids);
}
List<Marker> getMarkersInRect(@NonNull RectF rect) {
- if (mDestroyed || rect == null) {
+ if (destroyed || rect == null) {
return new ArrayList<>();
}
- long[] ids = mNativeMapView.queryPointAnnotations(rect);
+ long[] ids = nativeMapView.queryPointAnnotations(rect);
List<Long> idsList = new ArrayList<>(ids.length);
for (int i = 0; i < ids.length; i++) {
@@ -1186,7 +1190,7 @@ public class MapView extends FrameLayout {
}
List<Marker> annotations = new ArrayList<>(ids.length);
- List<Annotation> annotationList = mMapboxMap.getAnnotations();
+ List<Annotation> annotationList = mapboxMap.getAnnotations();
int count = annotationList.size();
for (int i = 0; i < count; i++) {
Annotation annotation = annotationList.get(i);
@@ -1199,11 +1203,11 @@ public class MapView extends FrameLayout {
}
public List<MarkerView> getMarkerViewsInRect(@NonNull RectF rect) {
- if (mDestroyed || rect == null) {
+ if (destroyed || rect == null) {
return new ArrayList<>();
}
- long[] ids = mNativeMapView.queryPointAnnotations(rect);
+ long[] ids = nativeMapView.queryPointAnnotations(rect);
List<Long> idsList = new ArrayList<>(ids.length);
for (int i = 0; i < ids.length; i++) {
@@ -1211,7 +1215,7 @@ public class MapView extends FrameLayout {
}
List<MarkerView> annotations = new ArrayList<>(ids.length);
- List<Annotation> annotationList = mMapboxMap.getAnnotations();
+ List<Annotation> annotationList = mapboxMap.getAnnotations();
int count = annotationList.size();
for (int i = 0; i < count; i++) {
Annotation annotation = annotationList.get(i);
@@ -1227,52 +1231,52 @@ public class MapView extends FrameLayout {
* @return the ViewGroup containing the marker views
*/
public ViewGroup getMarkerViewContainer() {
- return mMarkerViewContainer;
+ return markerViewContainer;
}
int getTopOffsetPixelsForIcon(Icon icon) {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- return (int) (mNativeMapView.getTopOffsetPixelsForAnnotationSymbol(icon.getId())
- * mScreenDensity);
+ return (int) (nativeMapView.getTopOffsetPixelsForAnnotationSymbol(icon.getId())
+ * screenDensity);
}
void setContentPadding(int left, int top, int right, int bottom) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
-// if (left == mContentPaddingLeft && top == mContentPaddingTop && right == mContentPaddingRight && bottom == mContentPaddingBottom) {
+// if (left == contentPaddingLeft && top == contentPaddingTop && right == contentPaddingRight && bottom == contentPaddingBottom) {
// return;
// }
- mContentPaddingLeft = left;
- mContentPaddingTop = top;
- mContentPaddingRight = right;
- mContentPaddingBottom = bottom;
+ contentPaddingLeft = left;
+ contentPaddingTop = top;
+ contentPaddingRight = right;
+ contentPaddingBottom = bottom;
- int[] userLocationViewPadding = mMapboxMap.getMyLocationViewSettings().getPadding();
+ int[] userLocationViewPadding = mapboxMap.getMyLocationViewSettings().getPadding();
left += userLocationViewPadding[0];
top += userLocationViewPadding[1];
right += userLocationViewPadding[2];
bottom += userLocationViewPadding[3];
- mNativeMapView.setContentPadding(top / mScreenDensity, left / mScreenDensity, bottom / mScreenDensity, right / mScreenDensity);
+ nativeMapView.setContentPadding(top / screenDensity, left / screenDensity, bottom / screenDensity, right / screenDensity);
}
public void invalidateContentPadding() {
- setContentPadding(mContentPaddingLeft, mContentPaddingTop, mContentPaddingRight, mContentPaddingBottom);
+ setContentPadding(contentPaddingLeft, contentPaddingTop, contentPaddingRight, contentPaddingBottom);
}
double getMetersPerPixelAtLatitude(@FloatRange(from = -180, to = 180) double latitude) {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- return mNativeMapView.getMetersPerPixelAtLatitude(latitude, getZoom()) / mScreenDensity;
+ return nativeMapView.getMetersPerPixelAtLatitude(latitude, getZoom()) / screenDensity;
}
//
@@ -1280,18 +1284,18 @@ public class MapView extends FrameLayout {
//
void jumpTo(double bearing, LatLng center, double pitch, double zoom) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.cancelTransitions();
- mNativeMapView.jumpTo(bearing, center, pitch, zoom);
+ nativeMapView.cancelTransitions();
+ nativeMapView.jumpTo(bearing, center, pitch, zoom);
}
void easeTo(double bearing, LatLng center, long duration, double pitch, double zoom, boolean easingInterpolator, @Nullable final MapboxMap.CancelableCallback cancelableCallback) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Register callbacks early enough
if (cancelableCallback != null) {
@@ -1308,14 +1312,14 @@ public class MapView extends FrameLayout {
});
}
- mNativeMapView.easeTo(bearing, center, duration, pitch, zoom, easingInterpolator);
+ nativeMapView.easeTo(bearing, center, duration, pitch, zoom, easingInterpolator);
}
void flyTo(double bearing, LatLng center, long duration, double pitch, double zoom, @Nullable final MapboxMap.CancelableCallback cancelableCallback) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Register callbacks early enough
if (cancelableCallback != null) {
@@ -1332,11 +1336,11 @@ public class MapView extends FrameLayout {
});
}
- mNativeMapView.flyTo(bearing, center, duration, pitch, zoom);
+ nativeMapView.flyTo(bearing, center, duration, pitch, zoom);
}
private void adjustTopOffsetPixels() {
- List<Annotation> annotations = mMapboxMap.getAnnotations();
+ List<Annotation> annotations = mapboxMap.getAnnotations();
int count = annotations.size();
for (int i = 0; i < count; i++) {
Annotation annotation = annotations.get(i);
@@ -1347,26 +1351,26 @@ public class MapView extends FrameLayout {
}
}
- for (Marker marker : mMapboxMap.getSelectedMarkers()) {
+ for (Marker marker : mapboxMap.getSelectedMarkers()) {
if (marker.isInfoWindowShown()) {
marker.hideInfoWindow();
- marker.showInfoWindow(mMapboxMap, this);
+ marker.showInfoWindow(mapboxMap, this);
}
}
}
private void reloadMarkers() {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- List<Annotation> annotations = mMapboxMap.getAnnotations();
+ List<Annotation> annotations = mapboxMap.getAnnotations();
int count = annotations.size();
for (int i = 0; i < count; i++) {
Annotation annotation = annotations.get(i);
if (annotation instanceof Marker) {
Marker marker = (Marker) annotation;
- mNativeMapView.removeAnnotation(annotation.getId());
- long newId = mNativeMapView.addMarker(marker);
+ nativeMapView.removeAnnotation(annotation.getId());
+ long newId = nativeMapView.addMarker(marker);
marker.setId(newId);
}
}
@@ -1389,80 +1393,80 @@ public class MapView extends FrameLayout {
return;
}
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- if (!mHasSurface) {
+ if (!hasSurface) {
return;
}
- mNativeMapView.render();
+ nativeMapView.render();
}
@Override
protected void onSizeChanged(int width, int height, int oldw, int oldh) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
if (!isInEditMode()) {
- mNativeMapView.resizeView((int) (width / mScreenDensity), (int) (height / mScreenDensity));
+ nativeMapView.resizeView((int) (width / screenDensity), (int) (height / screenDensity));
}
}
double getScale() {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- return mNativeMapView.getScale();
+ return nativeMapView.getScale();
}
private class SurfaceCallback implements SurfaceHolder.Callback {
- private Surface mSurface;
+ private Surface surface;
@Override
public void surfaceCreated(SurfaceHolder holder) {
- mNativeMapView.createSurface(mSurface = holder.getSurface());
- mHasSurface = true;
+ nativeMapView.createSurface(surface = holder.getSurface());
+ hasSurface = true;
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mNativeMapView.resizeFramebuffer(width, height);
+ nativeMapView.resizeFramebuffer(width, height);
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
- mHasSurface = false;
+ hasSurface = false;
- if (mNativeMapView != null) {
- mNativeMapView.destroySurface();
+ if (nativeMapView != null) {
+ nativeMapView.destroySurface();
}
- mSurface.release();
+ surface.release();
}
}
CameraPosition invalidateCameraPosition() {
- if (mDestroyed) {
+ if (destroyed) {
return new CameraPosition.Builder().build();
}
- CameraPosition position = new CameraPosition.Builder(mNativeMapView.getCameraValues()).build();
- mMyLocationView.setCameraPosition(position);
+ CameraPosition position = new CameraPosition.Builder(nativeMapView.getCameraValues()).build();
+ myLocationView.setCameraPosition(position);
return position;
}
double getBearing() {
- if (mDestroyed) {
+ if (destroyed) {
return 0;
}
- double direction = -mNativeMapView.getBearing();
+ double direction = -nativeMapView.getBearing();
while (direction > 360) {
direction -= 360;
@@ -1475,27 +1479,27 @@ public class MapView extends FrameLayout {
}
void setBearing(float bearing) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mMyLocationView.setBearing(bearing);
- mNativeMapView.setBearing(bearing);
+ myLocationView.setBearing(bearing);
+ nativeMapView.setBearing(bearing);
}
void setBearing(float bearing, long duration) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mMyLocationView.setBearing(bearing);
- mNativeMapView.setBearing(bearing, duration);
+ myLocationView.setBearing(bearing);
+ nativeMapView.setBearing(bearing, duration);
}
void setBearing(double bearing, float focalX, float focalY) {
- if (mDestroyed) {
+ if (destroyed) {
return;
}
- mMyLocationView.setBearing(bearing);
- mNativeMapView.setBearing(bearing, focalX, focalY);
+ myLocationView.setBearing(bearing);
+ nativeMapView.setBearing(bearing, focalX, focalY);
}
//
@@ -1508,16 +1512,16 @@ public class MapView extends FrameLayout {
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// Required by ZoomButtonController (from Android SDK documentation)
- if (mMapboxMap.getUiSettings().isZoomControlsEnabled()) {
- mZoomButtonsController.setVisible(false);
+ if (mapboxMap.getUiSettings().isZoomControlsEnabled()) {
+ zoomButtonsController.setVisible(false);
}
// make sure we don't leak location listener
- if (mMyLocationListener != null) {
+ if (myLocationListener != null) {
// cleanup to prevent memory leak
LocationServices services = LocationServices.getLocationServices(getContext());
- services.removeLocationListener(mMyLocationListener);
- mMyLocationListener = null;
+ services.removeLocationListener(myLocationListener);
+ myLocationListener = null;
}
}
@@ -1530,12 +1534,12 @@ public class MapView extends FrameLayout {
// Required by ZoomButtonController (from Android SDK documentation)
if (visibility == View.VISIBLE) {
- if (mMapboxMap != null && mMapboxMap.getUiSettings().isZoomControlsEnabled()) {
- mZoomButtonsController.setVisible(true);
+ if (mapboxMap != null && mapboxMap.getUiSettings().isZoomControlsEnabled()) {
+ zoomButtonsController.setVisible(true);
}
} else {
- if (mMapboxMap != null && mMapboxMap.getUiSettings().isZoomControlsEnabled()) {
- mZoomButtonsController.setVisible(false);
+ if (mapboxMap != null && mapboxMap.getUiSettings().isZoomControlsEnabled()) {
+ zoomButtonsController.setVisible(false);
}
}
}
@@ -1571,7 +1575,7 @@ public class MapView extends FrameLayout {
evt.put(MapboxEvent.KEY_GESTURE_ID, gestureId);
evt.put(MapboxEvent.KEY_LATITUDE, tapLatLng.getLatitude());
evt.put(MapboxEvent.KEY_LONGITUDE, tapLatLng.getLongitude());
- evt.put(MapboxEvent.KEY_ZOOM, mMapboxMap.getCameraPosition().zoom);
+ evt.put(MapboxEvent.KEY_ZOOM, mapboxMap.getCameraPosition().zoom);
MapboxEventManager.getMapboxEventManager().pushEvent(evt);
}
@@ -1602,7 +1606,7 @@ public class MapView extends FrameLayout {
evt.put(MapboxEvent.ATTRIBUTE_CREATED, MapboxEventManager.generateCreateDate());
evt.put(MapboxEvent.KEY_LATITUDE, tapLatLng.getLatitude());
evt.put(MapboxEvent.KEY_LONGITUDE, tapLatLng.getLongitude());
- evt.put(MapboxEvent.KEY_ZOOM, mMapboxMap.getCameraPosition().zoom);
+ evt.put(MapboxEvent.KEY_ZOOM, mapboxMap.getCameraPosition().zoom);
MapboxEventManager.getMapboxEventManager().pushEvent(evt);
}
@@ -1611,7 +1615,7 @@ public class MapView extends FrameLayout {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
// Check and ignore non touch or left clicks
- if (mDestroyed) {
+ if (destroyed) {
return super.onTouchEvent(event);
}
@@ -1620,22 +1624,22 @@ public class MapView extends FrameLayout {
}
// Check two finger gestures first
- mRotateGestureDetector.onTouchEvent(event);
- mScaleGestureDetector.onTouchEvent(event);
- mShoveGestureDetector.onTouchEvent(event);
+ rotateGestureDetector.onTouchEvent(event);
+ scaleGestureDetector.onTouchEvent(event);
+ shoveGestureDetector.onTouchEvent(event);
// Handle two finger tap
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
// First pointer down
- mNativeMapView.setGestureInProgress(true);
+ nativeMapView.setGestureInProgress(true);
break;
case MotionEvent.ACTION_POINTER_DOWN:
// Second pointer down
- mTwoTap = event.getPointerCount() == 2
- && mMapboxMap.getUiSettings().isZoomGesturesEnabled();
- if (mTwoTap) {
+ twoTap = event.getPointerCount() == 2
+ && mapboxMap.getUiSettings().isZoomGesturesEnabled();
+ if (twoTap) {
// Confirmed 2nd Finger Down
trackGestureEvent(MapboxEvent.GESTURE_TWO_FINGER_SINGLETAP, event.getX(), event.getY());
}
@@ -1649,38 +1653,38 @@ public class MapView extends FrameLayout {
// First pointer up
long tapInterval = event.getEventTime() - event.getDownTime();
boolean isTap = tapInterval <= ViewConfiguration.getTapTimeout();
- boolean inProgress = mRotateGestureDetector.isInProgress()
- || mScaleGestureDetector.isInProgress()
- || mShoveGestureDetector.isInProgress();
+ boolean inProgress = rotateGestureDetector.isInProgress()
+ || scaleGestureDetector.isInProgress()
+ || shoveGestureDetector.isInProgress();
- if (mTwoTap && isTap && !inProgress) {
- if (mFocalPoint != null) {
- zoom(false, mFocalPoint.x / mScreenDensity, mFocalPoint.y / mScreenDensity);
+ if (twoTap && isTap && !inProgress) {
+ if (focalPoint != null) {
+ zoom(false, focalPoint.x / screenDensity, focalPoint.y / screenDensity);
} else {
PointF focalPoint = TwoFingerGestureDetector.determineFocalPoint(event);
zoom(false, focalPoint.x, focalPoint.y);
}
- mTwoTap = false;
+ twoTap = false;
return true;
}
// Scroll / Pan Has Stopped
- if (mScrollInProgress) {
+ if (scrollInProgress) {
trackGestureDragEndEvent(event.getX(), event.getY());
- mScrollInProgress = false;
+ scrollInProgress = false;
}
- mTwoTap = false;
- mNativeMapView.setGestureInProgress(false);
+ twoTap = false;
+ nativeMapView.setGestureInProgress(false);
break;
case MotionEvent.ACTION_CANCEL:
- mTwoTap = false;
- mNativeMapView.setGestureInProgress(false);
+ twoTap = false;
+ nativeMapView.setGestureInProgress(false);
break;
}
- boolean retVal = mGestureDetector.onTouchEvent(event);
+ boolean retVal = gestureDetector.onTouchEvent(event);
return retVal || super.onTouchEvent(event);
}
@@ -1692,8 +1696,8 @@ public class MapView extends FrameLayout {
@SuppressLint("ResourceType")
public boolean onDown(MotionEvent event) {
// Show the zoom controls
- if (mMapboxMap.getUiSettings().isZoomControlsEnabled()) {
- mZoomButtonsController.setVisible(true);
+ if (mapboxMap.getUiSettings().isZoomControlsEnabled()) {
+ zoomButtonsController.setVisible(true);
}
return true;
}
@@ -1701,7 +1705,7 @@ public class MapView extends FrameLayout {
// Called for double taps
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
- if (mDestroyed || !mMapboxMap.getUiSettings().isZoomGesturesEnabled()) {
+ if (destroyed || !mapboxMap.getUiSettings().isZoomGesturesEnabled()) {
return false;
}
@@ -1711,16 +1715,16 @@ public class MapView extends FrameLayout {
case MotionEvent.ACTION_MOVE:
break;
case MotionEvent.ACTION_UP:
- if (mQuickZoom) {
+ if (quickZoom) {
// insert here?
- mQuickZoom = false;
+ quickZoom = false;
break;
}
// Single finger double tap
- if (mFocalPoint != null) {
+ if (focalPoint != null) {
// User provided focal point
- zoom(true, mFocalPoint.x, mFocalPoint.y);
+ zoom(true, focalPoint.x, focalPoint.y);
} else {
// Zoom in on gesture
zoom(true, e.getX(), e.getY());
@@ -1734,27 +1738,27 @@ public class MapView extends FrameLayout {
}
@Override
- public boolean onSingleTapUp(MotionEvent e) {
- if (mDestroyed) {
+ public boolean onSingleTapUp(MotionEvent motionEvent) {
+ if (destroyed) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
return true;
}
@Override
- public boolean onSingleTapConfirmed(MotionEvent e) {
- List<Marker> selectedMarkers = mMapboxMap.getSelectedMarkers();
+ public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
+ List<Marker> selectedMarkers = mapboxMap.getSelectedMarkers();
- PointF tapPoint = new PointF(e.getX(), e.getY());
- float toleranceSides = 4 * mScreenDensity;
- float toleranceTopBottom = 10 * mScreenDensity;
+ PointF tapPoint = new PointF(motionEvent.getX(), motionEvent.getY());
+ float toleranceSides = 4 * screenDensity;
+ float toleranceTopBottom = 10 * screenDensity;
- RectF tapRect = new RectF((tapPoint.x - mAverageIconWidth / 2 - toleranceSides) / mScreenDensity,
- (tapPoint.y - mAverageIconHeight / 2 - toleranceTopBottom) / mScreenDensity,
- (tapPoint.x + mAverageIconWidth / 2 + toleranceSides) / mScreenDensity,
- (tapPoint.y + mAverageIconHeight / 2 + toleranceTopBottom) / mScreenDensity);
+ RectF tapRect = new RectF((tapPoint.x - averageIconWidth / 2 - toleranceSides) / screenDensity,
+ (tapPoint.y - averageIconHeight / 2 - toleranceTopBottom) / screenDensity,
+ (tapPoint.x + averageIconWidth / 2 + toleranceSides) / screenDensity,
+ (tapPoint.y + averageIconHeight / 2 + toleranceTopBottom) / screenDensity);
List<Marker> nearbyMarkers = getMarkersInRect(tapRect);
long newSelectedMarkerId = -1;
@@ -1776,7 +1780,7 @@ public class MapView extends FrameLayout {
}
if (newSelectedMarkerId >= 0) {
- List<Annotation> annotations = mMapboxMap.getAnnotations();
+ List<Annotation> annotations = mapboxMap.getAnnotations();
int count = annotations.size();
for (int i = 0; i < count; i++) {
Annotation annotation = annotations.get(i);
@@ -1785,7 +1789,7 @@ public class MapView extends FrameLayout {
if (selectedMarkers.isEmpty() || !selectedMarkers.contains(annotation)) {
// only handle click if no marker view is available
if (!(annotation instanceof MarkerView)) {
- mMapboxMap.selectMarker((Marker) annotation);
+ mapboxMap.selectMarker((Marker) annotation);
}
}
break;
@@ -1793,29 +1797,29 @@ public class MapView extends FrameLayout {
}
}
} else {
- if (mMapboxMap.getUiSettings().isDeselectMarkersOnTap()) {
+ if (mapboxMap.getUiSettings().isDeselectMarkersOnTap()) {
// deselect any selected marker
- mMapboxMap.deselectMarkers();
+ mapboxMap.deselectMarkers();
}
// notify app of map click
- MapboxMap.OnMapClickListener listener = mMapboxMap.getOnMapClickListener();
+ MapboxMap.OnMapClickListener listener = mapboxMap.getOnMapClickListener();
if (listener != null) {
LatLng point = fromScreenLocation(tapPoint);
listener.onMapClick(point);
}
}
- trackGestureEvent(MapboxEvent.GESTURE_SINGLETAP, e.getX(), e.getY());
+ trackGestureEvent(MapboxEvent.GESTURE_SINGLETAP, motionEvent.getX(), motionEvent.getY());
return true;
}
// Called for a long press
@Override
- public void onLongPress(MotionEvent e) {
- MapboxMap.OnMapLongClickListener listener = mMapboxMap.getOnMapLongClickListener();
- if (listener != null && !mQuickZoom) {
- LatLng point = fromScreenLocation(new PointF(e.getX(), e.getY()));
+ public void onLongPress(MotionEvent motionEvent) {
+ MapboxMap.OnMapLongClickListener listener = mapboxMap.getOnMapLongClickListener();
+ if (listener != null && !quickZoom) {
+ LatLng point = fromScreenLocation(new PointF(motionEvent.getX(), motionEvent.getY()));
listener.onMapLongClick(point);
}
}
@@ -1823,7 +1827,7 @@ public class MapView extends FrameLayout {
// Called for flings
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
- if (mDestroyed || !mMapboxMap.getUiSettings().isScrollGesturesEnabled()) {
+ if (destroyed || !mapboxMap.getUiSettings().isScrollGesturesEnabled()) {
return false;
}
@@ -1841,11 +1845,11 @@ public class MapView extends FrameLayout {
double duration = speed / (deceleration * ease);
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
- mNativeMapView.moveBy(velocityX * duration / 2.0 / mScreenDensity, velocityY * duration / 2.0 / mScreenDensity, (long) (duration * 1000.0f));
+ nativeMapView.moveBy(velocityX * duration / 2.0 / screenDensity, velocityY * duration / 2.0 / screenDensity, (long) (duration * 1000.0f));
- MapboxMap.OnFlingListener listener = mMapboxMap.getOnFlingListener();
+ MapboxMap.OnFlingListener listener = mapboxMap.getOnFlingListener();
if (listener != null) {
listener.onFling();
}
@@ -1857,14 +1861,14 @@ public class MapView extends FrameLayout {
// Called for drags
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
- if (!mScrollInProgress) {
- mScrollInProgress = true;
+ if (!scrollInProgress) {
+ scrollInProgress = true;
}
- if (mDestroyed || !mMapboxMap.getUiSettings().isScrollGesturesEnabled()) {
+ if (destroyed || !mapboxMap.getUiSettings().isScrollGesturesEnabled()) {
return false;
}
- if (mDragStarted) {
+ if (dragStarted) {
return false;
}
@@ -1874,12 +1878,12 @@ public class MapView extends FrameLayout {
resetTrackingModesIfRequired();
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Scroll the map
- mNativeMapView.moveBy(-distanceX / mScreenDensity, -distanceY / mScreenDensity);
+ nativeMapView.moveBy(-distanceX / screenDensity, -distanceY / screenDensity);
- MapboxMap.OnScrollListener listener = mMapboxMap.getOnScrollListener();
+ MapboxMap.OnScrollListener listener = mapboxMap.getOnScrollListener();
if (listener != null) {
listener.onScroll();
}
@@ -1890,20 +1894,20 @@ public class MapView extends FrameLayout {
// This class handles two finger gestures and double-tap drag gestures
private class ScaleGestureListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
- long mBeginTime = 0;
- float mScaleFactor = 1.0f;
+ long beginTime = 0;
+ float scaleFactor = 1.0f;
// Called when two fingers first touch the screen
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
- if (mDestroyed || !mMapboxMap.getUiSettings().isZoomGesturesEnabled()) {
+ if (destroyed || !mapboxMap.getUiSettings().isZoomGesturesEnabled()) {
return false;
}
// reset tracking modes if gesture occurs
resetTrackingModesIfRequired();
- mBeginTime = detector.getEventTime();
+ beginTime = detector.getEventTime();
trackGestureEvent(MapboxEvent.GESTURE_PINCH_START, detector.getFocusX(), detector.getFocusY());
return true;
}
@@ -1911,58 +1915,58 @@ public class MapView extends FrameLayout {
// Called when fingers leave screen
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
- mBeginTime = 0;
- mScaleFactor = 1.0f;
- mZoomStarted = false;
+ beginTime = 0;
+ scaleFactor = 1.0f;
+ zoomStarted = false;
}
// Called each time a finger moves
// Called for pinch zooms and quickzooms/quickscales
@Override
public boolean onScale(ScaleGestureDetector detector) {
- UiSettings uiSettings = mMapboxMap.getUiSettings();
- if (mDestroyed || !uiSettings.isZoomGesturesEnabled()) {
+ UiSettings uiSettings = mapboxMap.getUiSettings();
+ if (destroyed || !uiSettings.isZoomGesturesEnabled()) {
return super.onScale(detector);
}
// If scale is large enough ignore a tap
- mScaleFactor *= detector.getScaleFactor();
- if ((mScaleFactor > 1.05f) || (mScaleFactor < 0.95f)) {
- mZoomStarted = true;
+ scaleFactor *= detector.getScaleFactor();
+ if ((scaleFactor > 1.05f) || (scaleFactor < 0.95f)) {
+ zoomStarted = true;
}
// Ignore short touches in case it is a tap
// Also ignore small scales
long time = detector.getEventTime();
- long interval = time - mBeginTime;
- if (!mZoomStarted && (interval <= ViewConfiguration.getTapTimeout())) {
+ long interval = time - beginTime;
+ if (!zoomStarted && (interval <= ViewConfiguration.getTapTimeout())) {
return false;
}
- if (!mZoomStarted) {
+ if (!zoomStarted) {
return false;
}
- if (mDragStarted) {
+ if (dragStarted) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Gesture is a quickzoom if there aren't two fingers
- mQuickZoom = !mTwoTap;
+ quickZoom = !twoTap;
// Scale the map
- if (mFocalPoint != null) {
+ if (focalPoint != null) {
// arround user provided focal point
- mNativeMapView.scaleBy(detector.getScaleFactor(), mFocalPoint.x / mScreenDensity, mFocalPoint.y / mScreenDensity);
- } else if (mQuickZoom) {
+ nativeMapView.scaleBy(detector.getScaleFactor(), focalPoint.x / screenDensity, focalPoint.y / screenDensity);
+ } else if (quickZoom) {
// around center map
- mNativeMapView.scaleBy(detector.getScaleFactor(), (getWidth() / 2) / mScreenDensity, (getHeight() / 2) / mScreenDensity);
+ nativeMapView.scaleBy(detector.getScaleFactor(), (getWidth() / 2) / screenDensity, (getHeight() / 2) / screenDensity);
} else {
// around gesture
- mNativeMapView.scaleBy(detector.getScaleFactor(), detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity);
+ nativeMapView.scaleBy(detector.getScaleFactor(), detector.getFocusX() / screenDensity, detector.getFocusY() / screenDensity);
}
return true;
@@ -1972,21 +1976,21 @@ public class MapView extends FrameLayout {
// This class handles two finger rotate gestures
private class RotateGestureListener extends RotateGestureDetector.SimpleOnRotateGestureListener {
- long mBeginTime = 0;
- float mTotalAngle = 0.0f;
- boolean mStarted = false;
+ long beginTime = 0;
+ float totalAngle = 0.0f;
+ boolean started = false;
// Called when two fingers first touch the screen
@Override
public boolean onRotateBegin(RotateGestureDetector detector) {
- if (mDestroyed || !mMapboxMap.getUiSettings().isRotateGesturesEnabled()) {
+ if (destroyed || !mapboxMap.getUiSettings().isRotateGesturesEnabled()) {
return false;
}
// reset tracking modes if gesture occurs
resetTrackingModesIfRequired();
- mBeginTime = detector.getEventTime();
+ beginTime = detector.getEventTime();
trackGestureEvent(MapboxEvent.GESTURE_ROTATION_START, detector.getFocusX(), detector.getFocusY());
return true;
}
@@ -1994,118 +1998,118 @@ public class MapView extends FrameLayout {
// Called when the fingers leave the screen
@Override
public void onRotateEnd(RotateGestureDetector detector) {
- mBeginTime = 0;
- mTotalAngle = 0.0f;
- mStarted = false;
+ beginTime = 0;
+ totalAngle = 0.0f;
+ started = false;
}
// Called each time one of the two fingers moves
// Called for rotation
@Override
public boolean onRotate(RotateGestureDetector detector) {
- if (mDestroyed || !mMapboxMap.getUiSettings().isRotateGesturesEnabled()) {
+ if (destroyed || !mapboxMap.getUiSettings().isRotateGesturesEnabled()) {
return false;
}
- if (mDragStarted) {
+ if (dragStarted) {
return false;
}
// If rotate is large enough ignore a tap
// Also is zoom already started, don't rotate
- mTotalAngle += detector.getRotationDegreesDelta();
- if (!mZoomStarted && ((mTotalAngle > 20.0f) || (mTotalAngle < -20.0f))) {
- mStarted = true;
+ totalAngle += detector.getRotationDegreesDelta();
+ if (!zoomStarted && ((totalAngle > 20.0f) || (totalAngle < -20.0f))) {
+ started = true;
}
// Ignore short touches in case it is a tap
// Also ignore small rotate
long time = detector.getEventTime();
- long interval = time - mBeginTime;
- if (!mStarted && (interval <= ViewConfiguration.getTapTimeout())) {
+ long interval = time - beginTime;
+ if (!started && (interval <= ViewConfiguration.getTapTimeout())) {
return false;
}
- if (!mStarted) {
+ if (!started) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Get rotate value
- double bearing = mNativeMapView.getBearing();
+ double bearing = nativeMapView.getBearing();
bearing += detector.getRotationDegreesDelta();
// Rotate the map
- if (mFocalPoint != null) {
+ if (focalPoint != null) {
// User provided focal point
- setBearing(bearing, mFocalPoint.x / mScreenDensity, mFocalPoint.y / mScreenDensity);
+ setBearing(bearing, focalPoint.x / screenDensity, focalPoint.y / screenDensity);
} else {
// around gesture
- setBearing(bearing, detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity);
+ setBearing(bearing, detector.getFocusX() / screenDensity, detector.getFocusY() / screenDensity);
}
return true;
}
}
// 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;
- float mTotalDelta = 0.0f;
- boolean mStarted = false;
+ long beginTime = 0;
+ float totalDelta = 0.0f;
+ boolean started = false;
@Override
public boolean onShoveBegin(ShoveGestureDetector detector) {
- if (!mMapboxMap.getUiSettings().isTiltGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isTiltGesturesEnabled()) {
return false;
}
// reset tracking modes if gesture occurs
resetTrackingModesIfRequired();
- mBeginTime = detector.getEventTime();
+ beginTime = detector.getEventTime();
trackGestureEvent(MapboxEvent.GESTURE_PITCH_START, detector.getFocusX(), detector.getFocusY());
return true;
}
@Override
public void onShoveEnd(ShoveGestureDetector detector) {
- mBeginTime = 0;
- mTotalDelta = 0.0f;
- mStarted = false;
- mDragStarted = false;
+ beginTime = 0;
+ totalDelta = 0.0f;
+ started = false;
+ dragStarted = false;
}
@Override
public boolean onShove(ShoveGestureDetector detector) {
- if (mDestroyed || !mMapboxMap.getUiSettings().isTiltGesturesEnabled()) {
+ if (destroyed || !mapboxMap.getUiSettings().isTiltGesturesEnabled()) {
return false;
}
// If tilt is large enough ignore a tap
// Also if zoom already started, don't tilt
- mTotalDelta += detector.getShovePixelsDelta();
- if (!mZoomStarted && ((mTotalDelta > 10.0f) || (mTotalDelta < -10.0f))) {
- mStarted = true;
+ totalDelta += detector.getShovePixelsDelta();
+ if (!zoomStarted && ((totalDelta > 10.0f) || (totalDelta < -10.0f))) {
+ started = true;
}
// Ignore short touches in case it is a tap
// Also ignore small tilt
long time = detector.getEventTime();
- long interval = time - mBeginTime;
- if (!mStarted && (interval <= ViewConfiguration.getTapTimeout())) {
+ long interval = time - beginTime;
+ if (!started && (interval <= ViewConfiguration.getTapTimeout())) {
return false;
}
- if (!mStarted) {
+ if (!started) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Get tilt value (scale and clamp)
double pitch = getTilt();
@@ -2113,9 +2117,9 @@ public class MapView extends FrameLayout {
pitch = Math.max(MapboxConstants.MINIMUM_TILT, Math.min(MapboxConstants.MAXIMUM_TILT, pitch));
// Tilt the map
- mMapboxMap.setTilt(pitch);
+ mapboxMap.setTilt(pitch);
- mDragStarted = true;
+ dragStarted = true;
return true;
}
@@ -2134,7 +2138,7 @@ public class MapView extends FrameLayout {
// Called when user pushes a zoom button
@Override
public void onZoom(boolean zoomIn) {
- if (!mMapboxMap.getUiSettings().isZoomGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isZoomGesturesEnabled()) {
return;
}
zoom(zoomIn);
@@ -2149,7 +2153,7 @@ public class MapView extends FrameLayout {
// down
@Override
public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
- if (mDestroyed) {
+ if (destroyed) {
return super.onKeyDown(keyCode, event);
}
@@ -2167,51 +2171,51 @@ public class MapView extends FrameLayout {
return true;
case KeyEvent.KEYCODE_DPAD_LEFT:
- if (!mMapboxMap.getUiSettings().isScrollGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isScrollGesturesEnabled()) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Move left
- mNativeMapView.moveBy(scrollDist / mScreenDensity, 0.0 / mScreenDensity);
+ nativeMapView.moveBy(scrollDist / screenDensity, 0.0 / screenDensity);
return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:
- if (!mMapboxMap.getUiSettings().isScrollGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isScrollGesturesEnabled()) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Move right
- mNativeMapView.moveBy(-scrollDist / mScreenDensity, 0.0 / mScreenDensity);
+ nativeMapView.moveBy(-scrollDist / screenDensity, 0.0 / screenDensity);
return true;
case KeyEvent.KEYCODE_DPAD_UP:
- if (!mMapboxMap.getUiSettings().isScrollGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isScrollGesturesEnabled()) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Move up
- mNativeMapView.moveBy(0.0 / mScreenDensity, scrollDist / mScreenDensity);
+ nativeMapView.moveBy(0.0 / screenDensity, scrollDist / screenDensity);
return true;
case KeyEvent.KEYCODE_DPAD_DOWN:
- if (!mMapboxMap.getUiSettings().isScrollGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isScrollGesturesEnabled()) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Move down
- mNativeMapView.moveBy(0.0 / mScreenDensity, -scrollDist / mScreenDensity);
+ nativeMapView.moveBy(0.0 / screenDensity, -scrollDist / screenDensity);
return true;
default:
@@ -2229,7 +2233,7 @@ public class MapView extends FrameLayout {
// onKeyLongPress is fired
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
- if (!mMapboxMap.getUiSettings().isZoomGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isZoomGesturesEnabled()) {
return false;
}
@@ -2259,7 +2263,7 @@ public class MapView extends FrameLayout {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
- if (!mMapboxMap.getUiSettings().isZoomGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isZoomGesturesEnabled()) {
return false;
}
@@ -2276,22 +2280,22 @@ public class MapView extends FrameLayout {
// units
@Override
public boolean onTrackballEvent(MotionEvent event) {
- if (mDestroyed) {
+ if (destroyed) {
return false;
}
// Choose the action
switch (event.getActionMasked()) {
// The trackball was rotated
case MotionEvent.ACTION_MOVE:
- if (!mMapboxMap.getUiSettings().isScrollGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isScrollGesturesEnabled()) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Scroll the map
- mNativeMapView.moveBy(-10.0 * event.getX() / mScreenDensity, -10.0 * event.getY() / mScreenDensity);
+ nativeMapView.moveBy(-10.0 * event.getX() / screenDensity, -10.0 * event.getY() / screenDensity);
return true;
// Trackball was pushed in so start tracking and tell system we are
@@ -2300,23 +2304,23 @@ public class MapView extends FrameLayout {
case MotionEvent.ACTION_DOWN:
// Set up a delayed callback to check if trackball is still
// After waiting the system long press time out
- if (mCurrentTrackballLongPressTimeOut != null) {
- mCurrentTrackballLongPressTimeOut.cancel();
- mCurrentTrackballLongPressTimeOut = null;
+ if (currentTrackballLongPressTimeOut != null) {
+ currentTrackballLongPressTimeOut.cancel();
+ currentTrackballLongPressTimeOut = null;
}
- mCurrentTrackballLongPressTimeOut = new TrackballLongPressTimeOut();
- postDelayed(mCurrentTrackballLongPressTimeOut,
+ currentTrackballLongPressTimeOut = new TrackballLongPressTimeOut();
+ postDelayed(currentTrackballLongPressTimeOut,
ViewConfiguration.getLongPressTimeout());
return true;
// Trackball was released
case MotionEvent.ACTION_UP:
- if (!mMapboxMap.getUiSettings().isZoomGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isZoomGesturesEnabled()) {
return false;
}
// Only handle if we have not already long pressed
- if (mCurrentTrackballLongPressTimeOut != null) {
+ if (currentTrackballLongPressTimeOut != null) {
// Zoom in
zoom(true);
}
@@ -2324,9 +2328,9 @@ public class MapView extends FrameLayout {
// Trackball was cancelled
case MotionEvent.ACTION_CANCEL:
- if (mCurrentTrackballLongPressTimeOut != null) {
- mCurrentTrackballLongPressTimeOut.cancel();
- mCurrentTrackballLongPressTimeOut = null;
+ if (currentTrackballLongPressTimeOut != null) {
+ currentTrackballLongPressTimeOut.cancel();
+ currentTrackballLongPressTimeOut = null;
}
return true;
@@ -2360,7 +2364,7 @@ public class MapView extends FrameLayout {
zoom(false);
// Ensure the up action is not run
- mCurrentTrackballLongPressTimeOut = null;
+ currentTrackballLongPressTimeOut = null;
}
}
}
@@ -2369,7 +2373,7 @@ public class MapView extends FrameLayout {
// such as mouse scroll events, mouse moves, joystick, trackpad
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
- if (mDestroyed) {
+ if (destroyed) {
return false;
}
// Mouse events
@@ -2379,18 +2383,18 @@ public class MapView extends FrameLayout {
switch (event.getActionMasked()) {
// Mouse scrolls
case MotionEvent.ACTION_SCROLL:
- if (!mMapboxMap.getUiSettings().isZoomGesturesEnabled()) {
+ if (!mapboxMap.getUiSettings().isZoomGesturesEnabled()) {
return false;
}
// Cancel any animation
- mNativeMapView.cancelTransitions();
+ nativeMapView.cancelTransitions();
// Get the vertical scroll amount, one click = 1
float scrollDist = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
// Scale the map by the appropriate power of two factor
- mNativeMapView.scaleBy(Math.pow(2.0, scrollDist), event.getX() / mScreenDensity, event.getY() / mScreenDensity);
+ nativeMapView.scaleBy(Math.pow(2.0, scrollDist), event.getX() / screenDensity, event.getY() / screenDensity);
return true;
@@ -2412,15 +2416,15 @@ public class MapView extends FrameLayout {
case MotionEvent.ACTION_HOVER_ENTER:
case MotionEvent.ACTION_HOVER_MOVE:
// Show the zoom controls
- if (mMapboxMap.getUiSettings().isZoomControlsEnabled()) {
- mZoomButtonsController.setVisible(true);
+ if (mapboxMap.getUiSettings().isZoomControlsEnabled()) {
+ zoomButtonsController.setVisible(true);
}
return true;
case MotionEvent.ACTION_HOVER_EXIT:
// Hide the zoom controls
- if (mMapboxMap.getUiSettings().isZoomControlsEnabled()) {
- mZoomButtonsController.setVisible(false);
+ if (mapboxMap.getUiSettings().isZoomControlsEnabled()) {
+ zoomButtonsController.setVisible(false);
}
default:
@@ -2429,9 +2433,9 @@ public class MapView extends FrameLayout {
}
}
-//
-// Connectivity events
-//
+ //
+ // Connectivity events
+ //
// This class handles connectivity changes
private class ConnectivityReceiver extends BroadcastReceiver {
@@ -2456,7 +2460,7 @@ public class MapView extends FrameLayout {
// Called when our Internet connectivity has changed
private void onConnectivityChanged(boolean isConnected) {
- mNativeMapView.setReachability(isConnected);
+ nativeMapView.setReachability(isConnected);
}
//
@@ -2474,7 +2478,7 @@ public class MapView extends FrameLayout {
*/
public void addOnMapChangedListener(@Nullable OnMapChangedListener listener) {
if (listener != null) {
- mOnMapChangedListener.add(listener);
+ onMapChangedListener.add(listener);
}
}
@@ -2486,7 +2490,7 @@ public class MapView extends FrameLayout {
*/
public void removeOnMapChangedListener(@Nullable OnMapChangedListener listener) {
if (listener != null) {
- mOnMapChangedListener.remove(listener);
+ onMapChangedListener.remove(listener);
}
}
@@ -2494,9 +2498,9 @@ public class MapView extends FrameLayout {
// Called via JNI from NativeMapView
// Forward to any listeners
protected void onMapChanged(int mapChange) {
- if (mOnMapChangedListener != null) {
+ if (onMapChangedListener != null) {
OnMapChangedListener listener;
- final Iterator<OnMapChangedListener> iterator = mOnMapChangedListener.iterator();
+ final Iterator<OnMapChangedListener> iterator = onMapChangedListener.iterator();
while (iterator.hasNext()) {
listener = iterator.next();
listener.onMapChanged(mapChange);
@@ -2509,16 +2513,16 @@ public class MapView extends FrameLayout {
//
void setMyLocationEnabled(boolean enabled) {
- mMyLocationView.setEnabled(enabled);
+ myLocationView.setEnabled(enabled);
}
Location getMyLocation() {
- return mMyLocationView.getLocation();
+ return myLocationView.getLocation();
}
void setOnMyLocationChangeListener(@Nullable final MapboxMap.OnMyLocationChangeListener listener) {
if (listener != null) {
- mMyLocationListener = new LocationListener() {
+ myLocationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
if (listener != null) {
@@ -2526,37 +2530,37 @@ public class MapView extends FrameLayout {
}
}
};
- LocationServices.getLocationServices(getContext()).addLocationListener(mMyLocationListener);
+ LocationServices.getLocationServices(getContext()).addLocationListener(myLocationListener);
} else {
- LocationServices.getLocationServices(getContext()).removeLocationListener(mMyLocationListener);
- mMyLocationListener = null;
+ LocationServices.getLocationServices(getContext()).removeLocationListener(myLocationListener);
+ myLocationListener = null;
}
}
void setMyLocationTrackingMode(@MyLocationTracking.Mode int myLocationTrackingMode) {
- if (myLocationTrackingMode != MyLocationTracking.TRACKING_NONE && !mMapboxMap.isMyLocationEnabled()) {
- mMapboxMap.setMyLocationEnabled(true);
+ if (myLocationTrackingMode != MyLocationTracking.TRACKING_NONE && !mapboxMap.isMyLocationEnabled()) {
+ mapboxMap.setMyLocationEnabled(true);
}
- mMyLocationView.setMyLocationTrackingMode(myLocationTrackingMode);
+ myLocationView.setMyLocationTrackingMode(myLocationTrackingMode);
if (myLocationTrackingMode == MyLocationTracking.TRACKING_FOLLOW) {
- setFocalPoint(new PointF(mMyLocationView.getCenterX(), mMyLocationView.getCenterY()));
+ setFocalPoint(new PointF(myLocationView.getCenterX(), myLocationView.getCenterY()));
} else {
setFocalPoint(null);
}
- MapboxMap.OnMyLocationTrackingModeChangeListener listener = mMapboxMap.getOnMyLocationTrackingModeChangeListener();
+ MapboxMap.OnMyLocationTrackingModeChangeListener listener = mapboxMap.getOnMyLocationTrackingModeChangeListener();
if (listener != null) {
listener.onMyLocationTrackingModeChange(myLocationTrackingMode);
}
}
void setMyBearingTrackingMode(@MyBearingTracking.Mode int myBearingTrackingMode) {
- if (myBearingTrackingMode != MyBearingTracking.NONE && !mMapboxMap.isMyLocationEnabled()) {
- mMapboxMap.setMyLocationEnabled(true);
+ if (myBearingTrackingMode != MyBearingTracking.NONE && !mapboxMap.isMyLocationEnabled()) {
+ mapboxMap.setMyLocationEnabled(true);
}
- mMyLocationView.setMyBearingTrackingMode(myBearingTrackingMode);
- MapboxMap.OnMyBearingTrackingModeChangeListener listener = mMapboxMap.getOnMyBearingTrackingModeChangeListener();
+ myLocationView.setMyBearingTrackingMode(myBearingTrackingMode);
+ MapboxMap.OnMyBearingTrackingModeChangeListener listener = mapboxMap.getOnMyBearingTrackingModeChangeListener();
if (listener != null) {
listener.onMyBearingTrackingModeChange(myBearingTrackingMode);
}
@@ -2568,7 +2572,7 @@ public class MapView extends FrameLayout {
}
private void resetTrackingModesIfRequired() {
- TrackingSettings trackingSettings = mMapboxMap.getTrackingSettings();
+ TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
if (trackingSettings.isDismissLocationTrackingOnGesture()) {
resetLocationTrackingMode();
}
@@ -2579,7 +2583,7 @@ public class MapView extends FrameLayout {
private void resetLocationTrackingMode() {
try {
- TrackingSettings trackingSettings = mMapboxMap.getTrackingSettings();
+ TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
trackingSettings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
} catch (SecurityException ignore) {
// User did not accept location permissions
@@ -2599,15 +2603,15 @@ public class MapView extends FrameLayout {
//
void setCompassEnabled(boolean compassEnabled) {
- mCompassView.setEnabled(compassEnabled);
+ compassView.setEnabled(compassEnabled);
}
void setCompassGravity(int gravity) {
- setWidgetGravity(mCompassView, gravity);
+ setWidgetGravity(compassView, gravity);
}
void setCompassMargins(int left, int top, int right, int bottom) {
- setWidgetMargins(mCompassView, left, top, right, bottom);
+ setWidgetMargins(compassView, left, top, right, bottom);
}
//
@@ -2615,15 +2619,15 @@ public class MapView extends FrameLayout {
//
void setLogoGravity(int gravity) {
- setWidgetGravity(mLogoView, gravity);
+ setWidgetGravity(logoView, gravity);
}
void setLogoMargins(int left, int top, int right, int bottom) {
- setWidgetMargins(mLogoView, left, top, right, bottom);
+ setWidgetMargins(logoView, left, top, right, bottom);
}
void setLogoEnabled(boolean visible) {
- mLogoView.setVisibility(visible ? View.VISIBLE : View.GONE);
+ logoView.setVisibility(visible ? View.VISIBLE : View.GONE);
}
//
@@ -2631,23 +2635,23 @@ public class MapView extends FrameLayout {
//
void setAttributionGravity(int gravity) {
- setWidgetGravity(mAttributionsView, gravity);
+ setWidgetGravity(attributionsView, gravity);
}
void setAttributionMargins(int left, int top, int right, int bottom) {
- setWidgetMargins(mAttributionsView, left, top, right, bottom);
+ setWidgetMargins(attributionsView, left, top, right, bottom);
}
void setAttributionEnabled(int visibility) {
- mAttributionsView.setVisibility(visibility);
+ attributionsView.setVisibility(visibility);
}
void setAtttibutionTintColor(int tintColor) {
- ColorUtils.setTintList(mAttributionsView, tintColor);
+ ColorUtils.setTintList(attributionsView, tintColor);
}
int getAttributionTintColor() {
- return mMapboxMap.getUiSettings().getAttributionTintColor();
+ return mapboxMap.getUiSettings().getAttributionTintColor();
}
/**
@@ -2657,29 +2661,29 @@ public class MapView extends FrameLayout {
*/
@UiThread
public void getMapAsync(final OnMapReadyCallback callback) {
- if (!mInitialLoad && callback != null) {
- callback.onMapReady(mMapboxMap);
+ if (!initialLoad && callback != null) {
+ callback.onMapReady(mapboxMap);
} else {
if (callback != null) {
- mOnMapReadyCallbackList.add(callback);
+ onMapReadyCallbackList.add(callback);
}
}
}
MapboxMap getMapboxMap() {
- return mMapboxMap;
+ return mapboxMap;
}
void setMapboxMap(MapboxMap mapboxMap) {
- mMapboxMap = mapboxMap;
+ this.mapboxMap = mapboxMap;
}
MyLocationView getUserLocationView() {
- return mMyLocationView;
+ return myLocationView;
}
NativeMapView getNativeMapView() {
- return mNativeMapView;
+ return nativeMapView;
}
//
@@ -2688,23 +2692,23 @@ public class MapView extends FrameLayout {
@UiThread
void snapshot(@NonNull final MapboxMap.SnapshotReadyCallback callback, @Nullable final Bitmap bitmap) {
- mSnapshotRequest = new SnapshotRequest(bitmap, callback);
- mNativeMapView.scheduleTakeSnapshot();
- mNativeMapView.render();
+ snapshotRequest = new SnapshotRequest(bitmap, callback);
+ nativeMapView.scheduleTakeSnapshot();
+ nativeMapView.render();
}
// Called when the snapshot method was executed
// Called via JNI from NativeMapView
// Forward to any listeners
protected void onSnapshotReady(byte[] bytes) {
- if (mSnapshotRequest != null && bytes != null) {
+ if (snapshotRequest != null && bytes != null) {
BitmapFactory.Options options = new BitmapFactory.Options();
- options.inBitmap = mSnapshotRequest.getBitmap(); // the old Bitmap to be reused
+ options.inBitmap = snapshotRequest.getBitmap(); // the old Bitmap to be reused
options.inMutable = true;
options.inSampleSize = 1;
Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);
- MapboxMap.SnapshotReadyCallback callback = mSnapshotRequest.getCallback();
+ MapboxMap.SnapshotReadyCallback callback = snapshotRequest.getCallback();
if (callback != null) {
callback.onSnapshotReady(bitmap);
}
@@ -2741,10 +2745,10 @@ public class MapView extends FrameLayout {
private void setWidgetMargins(@NonNull final View view, int left, int top, int right, int bottom) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
- left += mContentPaddingLeft;
- top += mContentPaddingTop;
- right += mContentPaddingRight;
- bottom += mContentPaddingBottom;
+ left += contentPaddingLeft;
+ top += contentPaddingTop;
+ right += contentPaddingRight;
+ bottom += contentPaddingBottom;
layoutParams.setMargins(left, top, right, bottom);
view.setLayoutParams(layoutParams);
}
@@ -2753,11 +2757,11 @@ public class MapView extends FrameLayout {
private static final int ATTRIBUTION_INDEX_IMPROVE_THIS_MAP = 2;
private static final int ATTRIBUTION_INDEX_TELEMETRY_SETTINGS = 3;
- private MapView mMapView;
+ private MapView mapView;
public AttributionOnClickListener(MapView mapView) {
super();
- mMapView = mapView;
+ this.mapView = mapView;
}
// Called when someone presses the attribution icon
@@ -2769,7 +2773,7 @@ public class MapView extends FrameLayout {
builder.setTitle(R.string.attributionsDialogTitle);
builder.setAdapter(new ArrayAdapter<>(context, R.layout.attribution_list_item, items), this);
AlertDialog dialog = builder.show();
- dialog.getWindow().setBackgroundDrawable(new ColorDrawable(mMapView.getAttributionTintColor()));
+ dialog.getWindow().setBackgroundDrawable(new ColorDrawable(mapView.getAttributionTintColor()));
}
// Called when someone selects an attribution, 'Improve this map' adds location data to the url
@@ -2820,8 +2824,8 @@ public class MapView extends FrameLayout {
}
String url = context.getResources().getStringArray(R.array.attribution_links)[which];
if (which == ATTRIBUTION_INDEX_IMPROVE_THIS_MAP) {
- LatLng latLng = mMapView.getMapboxMap().getCameraPosition().target;
- url = String.format(url, latLng.getLongitude(), latLng.getLatitude(), (int) mMapView.getZoom());
+ LatLng latLng = mapView.getMapboxMap().getCameraPosition().target;
+ url = String.format(url, latLng.getLongitude(), latLng.getLatitude(), (int) mapView.getZoom());
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
index d13c6f4ffc..a97395695d 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
@@ -64,50 +64,50 @@ import java.util.concurrent.TimeUnit;
public class MapboxMap {
private static final String TAG = MapboxMap.class.getSimpleName();
- private MapView mMapView;
- private UiSettings mUiSettings;
- private TrackingSettings mTrackingSettings;
+ private MapView mapView;
+ private UiSettings uiSettings;
+ private TrackingSettings trackingSettings;
private MyLocationViewSettings myLocationViewSettings;
- private Projection mProjection;
- private CameraPosition mCameraPosition;
- private boolean mInvalidCameraPosition;
- private LongSparseArray<Annotation> mAnnotations;
-
- private List<Marker> mSelectedMarkers;
- private MarkerViewManager mMarkerViewManager;
-
- private List<InfoWindow> mInfoWindows;
- private MapboxMap.InfoWindowAdapter mInfoWindowAdapter;
-
- private boolean mMyLocationEnabled;
- private boolean mAllowConcurrentMultipleInfoWindows;
-
- private MapboxMap.OnMapClickListener mOnMapClickListener;
- private MapboxMap.OnMapLongClickListener mOnMapLongClickListener;
- private MapboxMap.OnMarkerClickListener mOnMarkerClickListener;
- private MapboxMap.OnInfoWindowClickListener mOnInfoWindowClickListener;
- private MapboxMap.OnInfoWindowLongClickListener mOnInfoWindowLongClickListener;
- private MapboxMap.OnInfoWindowCloseListener mOnInfoWindowCloseListener;
- private MapboxMap.OnFlingListener mOnFlingListener;
- private MapboxMap.OnScrollListener mOnScrollListener;
- private MapboxMap.OnMyLocationTrackingModeChangeListener mOnMyLocationTrackingModeChangeListener;
- private MapboxMap.OnMyBearingTrackingModeChangeListener mOnMyBearingTrackingModeChangeListener;
- private MapboxMap.OnFpsChangedListener mOnFpsChangedListener;
- private MapboxMap.OnCameraChangeListener mOnCameraChangeListener;
-
- private double mMaxZoomLevel = -1;
- private double mMinZoomLevel = -1;
+ private Projection projection;
+ private CameraPosition cameraPosition;
+ private boolean invalidCameraPosition;
+ private LongSparseArray<Annotation> annotations;
+
+ private List<Marker> selectedMarkers;
+ private MarkerViewManager markerViewManager;
+
+ private List<InfoWindow> infoWindows;
+ private MapboxMap.InfoWindowAdapter infoWindowAdapter;
+
+ private boolean myLocationEnabled;
+ private boolean allowConcurrentMultipleInfoWindows;
+
+ private MapboxMap.OnMapClickListener onMapClickListener;
+ private MapboxMap.OnMapLongClickListener onMapLongClickListener;
+ private MapboxMap.OnMarkerClickListener onMarkerClickListener;
+ private MapboxMap.OnInfoWindowClickListener onInfoWindowClickListener;
+ private MapboxMap.OnInfoWindowLongClickListener onInfoWindowLongClickListener;
+ private MapboxMap.OnInfoWindowCloseListener onInfoWindowCloseListener;
+ private MapboxMap.OnFlingListener onFlingListener;
+ private MapboxMap.OnScrollListener onScrollListener;
+ private MapboxMap.OnMyLocationTrackingModeChangeListener onMyLocationTrackingModeChangeListener;
+ private MapboxMap.OnMyBearingTrackingModeChangeListener onMyBearingTrackingModeChangeListener;
+ private MapboxMap.OnFpsChangedListener onFpsChangedListener;
+ private MapboxMap.OnCameraChangeListener onCameraChangeListener;
+
+ private double maxZoomLevel = -1;
+ private double minZoomLevel = -1;
MapboxMap(@NonNull MapView mapView) {
- mMapView = mapView;
- mMapView.addOnMapChangedListener(new MapChangeCameraPositionListener());
- mUiSettings = new UiSettings(mapView);
- mTrackingSettings = new TrackingSettings(mMapView, mUiSettings);
- mProjection = new Projection(mapView);
- mAnnotations = new LongSparseArray<>();
- mSelectedMarkers = new ArrayList<>();
- mInfoWindows = new ArrayList<>();
- mMarkerViewManager = new MarkerViewManager(this, mapView);
+ this.mapView = mapView;
+ this.mapView.addOnMapChangedListener(new MapChangeCameraPositionListener());
+ uiSettings = new UiSettings(mapView);
+ trackingSettings = new TrackingSettings(this.mapView, uiSettings);
+ projection = new Projection(mapView);
+ annotations = new LongSparseArray<>();
+ selectedMarkers = new ArrayList<>();
+ infoWindows = new ArrayList<>();
+ markerViewManager = new MarkerViewManager(this, mapView);
}
// Style
@@ -174,13 +174,14 @@ public class MapboxMap {
* @param minZoom The new minimum zoom level.
*/
@UiThread
- public void setMinZoom(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double minZoom) {
+ public void setMinZoom(
+ @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double minZoom) {
if ((minZoom < MapboxConstants.MINIMUM_ZOOM) || (minZoom > MapboxConstants.MAXIMUM_ZOOM)) {
Log.e(MapboxConstants.TAG, "Not setting minZoom, value is in unsupported range: " + minZoom);
return;
}
- mMinZoomLevel = minZoom;
- mMapView.setMinZoom(minZoom);
+ minZoomLevel = minZoom;
+ mapView.setMinZoom(minZoom);
}
/**
@@ -192,10 +193,10 @@ public class MapboxMap {
*/
@UiThread
public double getMinZoom() {
- if (mMinZoomLevel == -1) {
- return mMinZoomLevel = mMapView.getMinZoom();
+ if (minZoomLevel == -1) {
+ return minZoomLevel = mapView.getMinZoom();
}
- return mMinZoomLevel;
+ return minZoomLevel;
}
//
@@ -210,13 +211,14 @@ public class MapboxMap {
* @param maxZoom The new maximum zoom level.
*/
@UiThread
- public void setMaxZoom(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double maxZoom) {
+ public void setMaxZoom(
+ @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double maxZoom) {
if ((maxZoom < MapboxConstants.MINIMUM_ZOOM) || (maxZoom > MapboxConstants.MAXIMUM_ZOOM)) {
Log.e(MapboxConstants.TAG, "Not setting maxZoom, value is in unsupported range: " + maxZoom);
return;
}
- mMaxZoomLevel = maxZoom;
- mMapView.setMaxZoom(maxZoom);
+ maxZoomLevel = maxZoom;
+ mapView.setMaxZoom(maxZoom);
}
/**
@@ -228,10 +230,10 @@ public class MapboxMap {
*/
@UiThread
public double getMaxZoom() {
- if (mMaxZoomLevel == -1) {
- return mMaxZoomLevel = mMapView.getMaxZoom();
+ if (maxZoomLevel == -1) {
+ return maxZoomLevel = mapView.getMaxZoom();
}
- return mMaxZoomLevel;
+ return maxZoomLevel;
}
//
@@ -244,7 +246,7 @@ public class MapboxMap {
* @return the UiSettings associated with this map
*/
public UiSettings getUiSettings() {
- return mUiSettings;
+ return uiSettings;
}
//
@@ -257,7 +259,7 @@ public class MapboxMap {
* @return the TrackingSettings asssociated with this map
*/
public TrackingSettings getTrackingSettings() {
- return mTrackingSettings;
+ return trackingSettings;
}
//
@@ -271,7 +273,7 @@ public class MapboxMap {
*/
public MyLocationViewSettings getMyLocationViewSettings() {
if (myLocationViewSettings == null) {
- myLocationViewSettings = new MyLocationViewSettings(mMapView, mMapView.getUserLocationView());
+ myLocationViewSettings = new MyLocationViewSettings(mapView, mapView.getUserLocationView());
}
return myLocationViewSettings;
}
@@ -281,12 +283,13 @@ public class MapboxMap {
//
/**
- * Get the Projection object that you can use to convert between screen coordinates and latitude/longitude coordinates.
+ * Get the Projection object that you can use to convert between screen coordinates and latitude/longitude
+ * coordinates.
*
* @return the Projection associated with this map
*/
public Projection getProjection() {
- return mProjection;
+ return projection;
}
//
@@ -295,15 +298,16 @@ public class MapboxMap {
/**
* Gets the current position of the camera.
- * The CameraPosition returned is a snapshot of the current position, and will not automatically update when the camera moves.
+ * The CameraPosition returned is a snapshot of the current position, and will not automatically update when the
+ * camera moves.
*
* @return The current position of the Camera.
*/
public final CameraPosition getCameraPosition() {
- if (mInvalidCameraPosition) {
+ if (invalidCameraPosition) {
invalidateCameraPosition();
}
- return mCameraPosition;
+ return cameraPosition;
}
/**
@@ -339,8 +343,8 @@ public class MapboxMap {
*/
@UiThread
public final void moveCamera(CameraUpdate update, MapboxMap.CancelableCallback callback) {
- mCameraPosition = update.getCameraPosition(this);
- mMapView.jumpTo(mCameraPosition.bearing, mCameraPosition.target, mCameraPosition.tilt, mCameraPosition.zoom);
+ cameraPosition = update.getCameraPosition(this);
+ mapView.jumpTo(cameraPosition.bearing, cameraPosition.target, cameraPosition.tilt, cameraPosition.zoom);
if (callback != null) {
callback.onFinish();
}
@@ -402,9 +406,11 @@ public class MapboxMap {
}
@UiThread
- public final void easeCamera(CameraUpdate update, int durationMs, boolean easingInterpolator, final MapboxMap.CancelableCallback callback) {
- mCameraPosition = update.getCameraPosition(this);
- mMapView.easeTo(mCameraPosition.bearing, mCameraPosition.target, getDurationNano(durationMs), mCameraPosition.tilt, mCameraPosition.zoom, easingInterpolator, new CancelableCallback() {
+ public final void easeCamera(
+ CameraUpdate update, int durationMs, boolean easingInterpolator, final MapboxMap.CancelableCallback callback) {
+ cameraPosition = update.getCameraPosition(this);
+ mapView.easeTo(cameraPosition.bearing, cameraPosition.target, getDurationNano(durationMs), cameraPosition.tilt,
+ cameraPosition.zoom, easingInterpolator, new CancelableCallback() {
@Override
public void onCancel() {
if (callback != null) {
@@ -490,8 +496,9 @@ public class MapboxMap {
*/
@UiThread
public final void animateCamera(CameraUpdate update, int durationMs, final MapboxMap.CancelableCallback callback) {
- mCameraPosition = update.getCameraPosition(this);
- mMapView.flyTo(mCameraPosition.bearing, mCameraPosition.target, getDurationNano(durationMs), mCameraPosition.tilt, mCameraPosition.zoom, new CancelableCallback() {
+ cameraPosition = update.getCameraPosition(this);
+ mapView.flyTo(cameraPosition.bearing, cameraPosition.target, getDurationNano(durationMs), cameraPosition.tilt,
+ cameraPosition.zoom, new CancelableCallback() {
@Override
public void onCancel() {
if (callback != null) {
@@ -502,8 +509,8 @@ public class MapboxMap {
@Override
public void onFinish() {
- if (mOnCameraChangeListener != null) {
- mOnCameraChangeListener.onCameraChange(mCameraPosition);
+ if (onCameraChangeListener != null) {
+ onCameraChangeListener.onCameraChange(cameraPosition);
}
if (callback != null) {
@@ -528,15 +535,15 @@ public class MapboxMap {
* Invalidates the current camera position by reconstructing it from mbgl
*/
private void invalidateCameraPosition() {
- mInvalidCameraPosition = false;
+ invalidCameraPosition = false;
- CameraPosition cameraPosition = mMapView.invalidateCameraPosition();
+ CameraPosition cameraPosition = mapView.invalidateCameraPosition();
if (cameraPosition != null) {
- mCameraPosition = cameraPosition;
+ this.cameraPosition = cameraPosition;
}
- if (mOnCameraChangeListener != null) {
- mOnCameraChangeListener.onCameraChange(mCameraPosition);
+ if (onCameraChangeListener != null) {
+ onCameraChangeListener.onCameraChange(this.cameraPosition);
}
}
@@ -548,7 +555,7 @@ public class MapboxMap {
* Resets the map view to face north.
*/
public void resetNorth() {
- mMapView.resetNorth();
+ mapView.resetNorth();
}
//
@@ -562,7 +569,7 @@ public class MapboxMap {
*/
@UiThread
public boolean isDebugActive() {
- return mMapView.isDebugActive();
+ return mapView.isDebugActive();
}
/**
@@ -575,7 +582,7 @@ public class MapboxMap {
*/
@UiThread
public void setDebugActive(boolean debugActive) {
- mMapView.setDebugActive(debugActive);
+ mapView.setDebugActive(debugActive);
}
/**
@@ -589,7 +596,7 @@ public class MapboxMap {
*/
@UiThread
public void cycleDebugOptions() {
- mMapView.cycleDebugOptions();
+ mapView.cycleDebugOptions();
}
//
@@ -619,14 +626,15 @@ public class MapboxMap {
* If you wish to wait for the map to finish loading listen for the {@link MapView#DID_FINISH_LOADING_MAP} event.
* </p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
- * An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be sent.
+ * An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
+ * sent.
*
* @param url The URL of the map style
* @see Style
*/
@UiThread
public void setStyleUrl(@NonNull String url) {
- mMapView.setStyleUrl(url);
+ mapView.setStyleUrl(url);
}
/**
@@ -638,7 +646,8 @@ public class MapboxMap {
* If you wish to wait for the map to finish loading listen for the {@link MapView#DID_FINISH_LOADING_MAP} event.
* </p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
- * An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be sent.
+ * An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
+ * sent.
*
* @param style The bundled style. Accepts one of the values from {@link Style}.
* @see Style
@@ -661,7 +670,7 @@ public class MapboxMap {
@UiThread
@NonNull
public String getStyleUrl() {
- return mMapView.getStyleUrl();
+ return mapView.getStyleUrl();
}
//
@@ -683,7 +692,7 @@ public class MapboxMap {
@Deprecated
@UiThread
public void setAccessToken(@NonNull String accessToken) {
- mMapView.setAccessToken(accessToken);
+ mapView.setAccessToken(accessToken);
}
/**
@@ -701,7 +710,7 @@ public class MapboxMap {
@UiThread
@Nullable
public String getAccessToken() {
- return mMapView.getAccessToken();
+ return mapView.getAccessToken();
}
//
@@ -709,11 +718,10 @@ public class MapboxMap {
//
void setTilt(double tilt) {
- mMarkerViewManager.setTilt((float) tilt);
- mMapView.setTilt(tilt);
+ markerViewManager.setTilt((float) tilt);
+ mapView.setTilt(tilt);
}
-
/**
* <p>
* Adds a marker to this map.
@@ -744,10 +752,10 @@ public class MapboxMap {
@NonNull
public Marker addMarker(@NonNull BaseMarkerOptions markerOptions) {
Marker marker = prepareMarker(markerOptions);
- long id = mMapView.addMarker(marker);
+ long id = mapView.addMarker(marker);
marker.setMapboxMap(this);
marker.setId(id);
- mAnnotations.put(id, marker);
+ annotations.put(id, marker);
return marker;
}
@@ -766,10 +774,10 @@ public class MapboxMap {
public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions) {
MarkerView marker = prepareViewMarker(markerOptions);
marker.setMapboxMap(this);
- long id = mMapView.addMarker(marker);
+ long id = mapView.addMarker(marker);
marker.setId(id);
- mAnnotations.put(id, marker);
- mMarkerViewManager.invalidateViewMarkersInVisibleRegion();
+ annotations.put(id, marker);
+ markerViewManager.invalidateViewMarkersInVisibleRegion();
return marker;
}
@@ -780,12 +788,12 @@ public class MapboxMap {
for (BaseMarkerViewOptions markerViewOption : markerViewOptions) {
MarkerView marker = prepareViewMarker(markerViewOption);
marker.setMapboxMap(this);
- long id = mMapView.addMarker(marker);
+ long id = mapView.addMarker(marker);
marker.setId(id);
- mAnnotations.put(id, marker);
+ annotations.put(id, marker);
markers.add(marker);
}
- mMarkerViewManager.invalidateViewMarkersInVisibleRegion();
+ markerViewManager.invalidateViewMarkersInVisibleRegion();
return markers;
}
@@ -814,7 +822,7 @@ public class MapboxMap {
}
if (markers.size() > 0) {
- long[] ids = mMapView.addMarkers(markers);
+ long[] ids = mapView.addMarkers(markers);
// if unittests or markers are correctly added to map
if (ids == null || ids.length == markers.size()) {
@@ -830,7 +838,7 @@ public class MapboxMap {
id++;
}
m.setId(id);
- mAnnotations.put(id, m);
+ annotations.put(id, m);
}
}
}
@@ -847,11 +855,11 @@ public class MapboxMap {
*/
@UiThread
public void updateMarker(@NonNull Marker updatedMarker) {
- mMapView.updateMarker(updatedMarker);
+ mapView.updateMarker(updatedMarker);
- int index = mAnnotations.indexOfKey(updatedMarker.getId());
+ int index = annotations.indexOfKey(updatedMarker.getId());
if (index > -1) {
- mAnnotations.setValueAt(index, updatedMarker);
+ annotations.setValueAt(index, updatedMarker);
}
}
@@ -862,11 +870,11 @@ public class MapboxMap {
*/
@UiThread
public void updatePolygon(Polygon polygon) {
- mMapView.updatePolygon(polygon);
+ mapView.updatePolygon(polygon);
- int index = mAnnotations.indexOfKey(polygon.getId());
+ int index = annotations.indexOfKey(polygon.getId());
if (index > -1) {
- mAnnotations.setValueAt(index, polygon);
+ annotations.setValueAt(index, polygon);
}
}
@@ -877,11 +885,11 @@ public class MapboxMap {
*/
@UiThread
public void updatePolyline(Polyline polyline) {
- mMapView.updatePolyline(polyline);
+ mapView.updatePolyline(polyline);
- int index = mAnnotations.indexOfKey(polyline.getId());
+ int index = annotations.indexOfKey(polyline.getId());
if (index > -1) {
- mAnnotations.setValueAt(index, polyline);
+ annotations.setValueAt(index, polyline);
}
}
@@ -896,10 +904,10 @@ public class MapboxMap {
public Polyline addPolyline(@NonNull PolylineOptions polylineOptions) {
Polyline polyline = polylineOptions.getPolyline();
if (!polyline.getPoints().isEmpty()) {
- long id = mMapView.addPolyline(polyline);
+ long id = mapView.addPolyline(polyline);
polyline.setMapboxMap(this);
polyline.setId(id);
- mAnnotations.put(id, polyline);
+ annotations.put(id, polyline);
}
return polyline;
}
@@ -925,7 +933,7 @@ public class MapboxMap {
}
}
- long[] ids = mMapView.addPolylines(polylines);
+ long[] ids = mapView.addPolylines(polylines);
// if unit tests or polylines are correctly added to map
if (ids == null || ids.length == polylines.size()) {
@@ -942,7 +950,7 @@ public class MapboxMap {
id++;
}
p.setId(id);
- mAnnotations.put(id, p);
+ annotations.put(id, p);
}
}
}
@@ -960,10 +968,10 @@ public class MapboxMap {
public Polygon addPolygon(@NonNull PolygonOptions polygonOptions) {
Polygon polygon = polygonOptions.getPolygon();
if (!polygon.getPoints().isEmpty()) {
- long id = mMapView.addPolygon(polygon);
+ long id = mapView.addPolygon(polygon);
polygon.setId(id);
polygon.setMapboxMap(this);
- mAnnotations.put(id, polygon);
+ annotations.put(id, polygon);
}
return polygon;
}
@@ -989,7 +997,7 @@ public class MapboxMap {
}
}
- long[] ids = mMapView.addPolygons(polygons);
+ long[] ids = mapView.addPolygons(polygons);
// if unit tests or polygons correctly added to map
if (ids == null || ids.length == polygons.size()) {
@@ -1004,7 +1012,7 @@ public class MapboxMap {
id++;
}
polygon.setId(id);
- mAnnotations.put(id, polygon);
+ annotations.put(id, polygon);
}
}
}
@@ -1061,12 +1069,12 @@ public class MapboxMap {
Marker marker = (Marker) annotation;
marker.hideInfoWindow();
if (marker instanceof MarkerView) {
- mMarkerViewManager.removeMarkerView((MarkerView) marker);
+ markerViewManager.removeMarkerView((MarkerView) marker);
}
}
long id = annotation.getId();
- mMapView.removeAnnotation(id);
- mAnnotations.remove(id);
+ mapView.removeAnnotation(id);
+ annotations.remove(id);
}
/**
@@ -1076,8 +1084,8 @@ public class MapboxMap {
*/
@UiThread
public void removeAnnotation(long id) {
- mMapView.removeAnnotation(id);
- mAnnotations.remove(id);
+ mapView.removeAnnotation(id);
+ annotations.remove(id);
}
/**
@@ -1095,14 +1103,14 @@ public class MapboxMap {
Marker marker = (Marker) annotation;
marker.hideInfoWindow();
if (marker instanceof MarkerView) {
- mMarkerViewManager.removeMarkerView((MarkerView) marker);
+ markerViewManager.removeMarkerView((MarkerView) marker);
}
}
ids[i] = annotationList.get(i).getId();
}
- mMapView.removeAnnotations(ids);
+ mapView.removeAnnotations(ids);
for (long id : ids) {
- mAnnotations.remove(id);
+ annotations.remove(id);
}
}
@@ -1112,21 +1120,21 @@ public class MapboxMap {
@UiThread
public void removeAnnotations() {
Annotation annotation;
- int count = mAnnotations.size();
+ int count = annotations.size();
long[] ids = new long[count];
for (int i = 0; i < count; i++) {
- ids[i] = mAnnotations.keyAt(i);
- annotation = mAnnotations.get(ids[i]);
+ ids[i] = annotations.keyAt(i);
+ annotation = annotations.get(ids[i]);
if (annotation instanceof Marker) {
Marker marker = (Marker) annotation;
marker.hideInfoWindow();
if (marker instanceof MarkerView) {
- mMarkerViewManager.removeMarkerView((MarkerView) marker);
+ markerViewManager.removeMarkerView((MarkerView) marker);
}
}
}
- mMapView.removeAnnotations(ids);
- mAnnotations.clear();
+ mapView.removeAnnotations(ids);
+ annotations.clear();
}
/**
@@ -1145,7 +1153,7 @@ public class MapboxMap {
*/
@Nullable
public Annotation getAnnotation(long id) {
- return mAnnotations.get(id);
+ return annotations.get(id);
}
/**
@@ -1157,8 +1165,8 @@ public class MapboxMap {
@NonNull
public List<Annotation> getAnnotations() {
List<Annotation> annotations = new ArrayList<>();
- for (int i = 0; i < mAnnotations.size(); i++) {
- annotations.add(mAnnotations.get(mAnnotations.keyAt(i)));
+ for (int i = 0; i < this.annotations.size(); i++) {
+ annotations.add(this.annotations.get(this.annotations.keyAt(i)));
}
return annotations;
}
@@ -1173,8 +1181,8 @@ public class MapboxMap {
public List<Marker> getMarkers() {
List<Marker> markers = new ArrayList<>();
Annotation annotation;
- for (int i = 0; i < mAnnotations.size(); i++) {
- annotation = mAnnotations.get(mAnnotations.keyAt(i));
+ for (int i = 0; i < annotations.size(); i++) {
+ annotation = annotations.get(annotations.keyAt(i));
if (annotation instanceof Marker) {
markers.add((Marker) annotation);
}
@@ -1192,8 +1200,8 @@ public class MapboxMap {
public List<Polygon> getPolygons() {
List<Polygon> polygons = new ArrayList<>();
Annotation annotation;
- for (int i = 0; i < mAnnotations.size(); i++) {
- annotation = mAnnotations.get(mAnnotations.keyAt(i));
+ for (int i = 0; i < annotations.size(); i++) {
+ annotation = annotations.get(annotations.keyAt(i));
if (annotation instanceof Polygon) {
polygons.add((Polygon) annotation);
}
@@ -1211,8 +1219,8 @@ public class MapboxMap {
public List<Polyline> getPolylines() {
List<Polyline> polylines = new ArrayList<>();
Annotation annotation;
- for (int i = 0; i < mAnnotations.size(); i++) {
- annotation = mAnnotations.get(mAnnotations.keyAt(i));
+ for (int i = 0; i < annotations.size(); i++) {
+ annotation = annotations.get(annotations.keyAt(i));
if (annotation instanceof Polyline) {
polylines.add((Polyline) annotation);
}
@@ -1237,7 +1245,7 @@ public class MapboxMap {
return;
}
- if (mSelectedMarkers.contains(marker)) {
+ if (selectedMarkers.contains(marker)) {
return;
}
@@ -1247,23 +1255,23 @@ public class MapboxMap {
}
boolean handledDefaultClick = false;
- if (mOnMarkerClickListener != null) {
+ if (onMarkerClickListener != null) {
// end developer has provided a custom click listener
- handledDefaultClick = mOnMarkerClickListener.onMarkerClick(marker);
+ handledDefaultClick = onMarkerClickListener.onMarkerClick(marker);
}
if (!handledDefaultClick) {
if (marker instanceof MarkerView) {
- mMarkerViewManager.select((MarkerView) marker, false);
- mMarkerViewManager.ensureInfoWindowOffset((MarkerView) marker);
+ markerViewManager.select((MarkerView) marker, false);
+ markerViewManager.ensureInfoWindowOffset((MarkerView) marker);
}
if (isInfoWindowValidForMarker(marker) || getInfoWindowAdapter() != null) {
- mInfoWindows.add(marker.showInfoWindow(this, mMapView));
+ infoWindows.add(marker.showInfoWindow(this, mapView));
}
}
- mSelectedMarkers.add(marker);
+ selectedMarkers.add(marker);
}
/**
@@ -1271,22 +1279,22 @@ public class MapboxMap {
*/
@UiThread
public void deselectMarkers() {
- if (mSelectedMarkers.isEmpty()) {
+ if (selectedMarkers.isEmpty()) {
return;
}
- for (Marker marker : mSelectedMarkers) {
+ for (Marker marker : selectedMarkers) {
if (marker.isInfoWindowShown()) {
marker.hideInfoWindow();
}
if (marker instanceof MarkerView) {
- mMarkerViewManager.deselect((MarkerView) marker, false);
+ markerViewManager.deselect((MarkerView) marker, false);
}
}
// Removes all selected markers from the list
- mSelectedMarkers.clear();
+ selectedMarkers.clear();
}
/**
@@ -1296,7 +1304,7 @@ public class MapboxMap {
*/
@UiThread
public void deselectMarker(@NonNull Marker marker) {
- if (!mSelectedMarkers.contains(marker)) {
+ if (!selectedMarkers.contains(marker)) {
return;
}
@@ -1305,10 +1313,10 @@ public class MapboxMap {
}
if (marker instanceof MarkerView) {
- mMarkerViewManager.deselect((MarkerView) marker, false);
+ markerViewManager.deselect((MarkerView) marker, false);
}
- mSelectedMarkers.remove(marker);
+ selectedMarkers.remove(marker);
}
/**
@@ -1318,13 +1326,13 @@ public class MapboxMap {
*/
@UiThread
public List<Marker> getSelectedMarkers() {
- return mSelectedMarkers;
+ return selectedMarkers;
}
private Marker prepareMarker(BaseMarkerOptions markerOptions) {
Marker marker = markerOptions.getMarker();
- Icon icon = mMapView.loadIconForMarker(marker);
- marker.setTopOffsetPixels(mMapView.getTopOffsetPixelsForIcon(icon));
+ Icon icon = mapView.loadIconForMarker(marker);
+ marker.setTopOffsetPixels(mapView.getTopOffsetPixelsForIcon(icon));
return marker;
}
@@ -1333,7 +1341,7 @@ public class MapboxMap {
Icon icon = markerViewOptions.getIcon();
if (icon == null) {
- icon = IconFactory.getInstance(mMapView.getContext()).defaultMarkerView();
+ icon = IconFactory.getInstance(mapView.getContext()).defaultMarkerView();
}
marker.setIcon(icon);
return marker;
@@ -1345,7 +1353,7 @@ public class MapboxMap {
* @return the associated MarkerViewManager
*/
public MarkerViewManager getMarkerViewManager() {
- return mMarkerViewManager;
+ return markerViewManager;
}
//
@@ -1364,7 +1372,7 @@ public class MapboxMap {
*/
@UiThread
public void setInfoWindowAdapter(@Nullable InfoWindowAdapter infoWindowAdapter) {
- mInfoWindowAdapter = infoWindowAdapter;
+ this.infoWindowAdapter = infoWindowAdapter;
}
/**
@@ -1375,7 +1383,7 @@ public class MapboxMap {
@UiThread
@Nullable
public InfoWindowAdapter getInfoWindowAdapter() {
- return mInfoWindowAdapter;
+ return infoWindowAdapter;
}
/**
@@ -1385,7 +1393,7 @@ public class MapboxMap {
*/
@UiThread
public void setAllowConcurrentMultipleOpenInfoWindows(boolean allow) {
- mAllowConcurrentMultipleInfoWindows = allow;
+ allowConcurrentMultipleInfoWindows = allow;
}
/**
@@ -1395,12 +1403,12 @@ public class MapboxMap {
*/
@UiThread
public boolean isAllowConcurrentMultipleOpenInfoWindows() {
- return mAllowConcurrentMultipleInfoWindows;
+ return allowConcurrentMultipleInfoWindows;
}
// used by MapView
List<InfoWindow> getInfoWindows() {
- return mInfoWindows;
+ return infoWindows;
}
private boolean isInfoWindowValidForMarker(@NonNull Marker marker) {
@@ -1430,8 +1438,8 @@ public class MapboxMap {
* @param bottom The bottom margin in pixels.
*/
public void setPadding(int left, int top, int right, int bottom) {
- mMapView.setContentPadding(left, top, right, bottom);
- mUiSettings.invalidate();
+ mapView.setContentPadding(left, top, right, bottom);
+ uiSettings.invalidate();
}
/**
@@ -1440,10 +1448,10 @@ public class MapboxMap {
* @return An array with length 4 in the LTRB order.
*/
public int[] getPadding() {
- return new int[]{mMapView.getContentPaddingLeft(),
- mMapView.getContentPaddingTop(),
- mMapView.getContentPaddingRight(),
- mMapView.getContentPaddingBottom()};
+ return new int[]{mapView.getContentPaddingLeft(),
+ mapView.getContentPaddingTop(),
+ mapView.getContentPaddingRight(),
+ mapView.getContentPaddingBottom()};
}
//
@@ -1458,7 +1466,7 @@ public class MapboxMap {
*/
@UiThread
public void setOnCameraChangeListener(@Nullable OnCameraChangeListener listener) {
- mOnCameraChangeListener = listener;
+ onCameraChangeListener = listener;
}
/**
@@ -1469,12 +1477,12 @@ public class MapboxMap {
*/
@UiThread
public void setOnFpsChangedListener(@Nullable OnFpsChangedListener listener) {
- mOnFpsChangedListener = listener;
+ onFpsChangedListener = listener;
}
// used by MapView
OnFpsChangedListener getOnFpsChangedListener() {
- return mOnFpsChangedListener;
+ return onFpsChangedListener;
}
/**
@@ -1485,12 +1493,12 @@ public class MapboxMap {
*/
@UiThread
public void setOnScrollListener(@Nullable OnScrollListener listener) {
- mOnScrollListener = listener;
+ onScrollListener = listener;
}
// used by MapView
OnScrollListener getOnScrollListener() {
- return mOnScrollListener;
+ return onScrollListener;
}
/**
@@ -1501,12 +1509,12 @@ public class MapboxMap {
*/
@UiThread
public void setOnFlingListener(@Nullable OnFlingListener listener) {
- mOnFlingListener = listener;
+ onFlingListener = listener;
}
// used by MapView
OnFlingListener getOnFlingListener() {
- return mOnFlingListener;
+ return onFlingListener;
}
/**
@@ -1517,12 +1525,12 @@ public class MapboxMap {
*/
@UiThread
public void setOnMapClickListener(@Nullable OnMapClickListener listener) {
- mOnMapClickListener = listener;
+ onMapClickListener = listener;
}
// used by MapView
OnMapClickListener getOnMapClickListener() {
- return mOnMapClickListener;
+ return onMapClickListener;
}
/**
@@ -1533,12 +1541,12 @@ public class MapboxMap {
*/
@UiThread
public void setOnMapLongClickListener(@Nullable OnMapLongClickListener listener) {
- mOnMapLongClickListener = listener;
+ onMapLongClickListener = listener;
}
// used by MapView
OnMapLongClickListener getOnMapLongClickListener() {
- return mOnMapLongClickListener;
+ return onMapLongClickListener;
}
/**
@@ -1549,7 +1557,7 @@ public class MapboxMap {
*/
@UiThread
public void setOnMarkerClickListener(@Nullable OnMarkerClickListener listener) {
- mOnMarkerClickListener = listener;
+ onMarkerClickListener = listener;
}
/**
@@ -1560,7 +1568,7 @@ public class MapboxMap {
*/
@UiThread
public void setOnInfoWindowClickListener(@Nullable OnInfoWindowClickListener listener) {
- mOnInfoWindowClickListener = listener;
+ onInfoWindowClickListener = listener;
}
/**
@@ -1570,17 +1578,18 @@ public class MapboxMap {
*/
@UiThread
public OnInfoWindowClickListener getOnInfoWindowClickListener() {
- return mOnInfoWindowClickListener;
+ return onInfoWindowClickListener;
}
/**
* Sets a callback that's invoked when a marker's info window is long pressed.
*
- * @param listener The callback that's invoked when a marker's info window is long pressed. To unset the callback, use null.
+ * @param listener The callback that's invoked when a marker's info window is long pressed. To unset the callback,
+ * use null.
*/
@UiThread
public void setOnInfoWindowLongClickListener(@Nullable OnInfoWindowLongClickListener listener) {
- mOnInfoWindowLongClickListener = listener;
+ onInfoWindowLongClickListener = listener;
}
/**
@@ -1589,11 +1598,11 @@ public class MapboxMap {
* @return Current active InfoWindow long Click Listener
*/
public OnInfoWindowLongClickListener getOnInfoWindowLongClickListener() {
- return mOnInfoWindowLongClickListener;
+ return onInfoWindowLongClickListener;
}
public void setOnInfoWindowCloseListener(@Nullable OnInfoWindowCloseListener listener) {
- mOnInfoWindowCloseListener = listener;
+ onInfoWindowCloseListener = listener;
}
/**
@@ -1603,7 +1612,7 @@ public class MapboxMap {
*/
@UiThread
public OnInfoWindowCloseListener getOnInfoWindowCloseListener() {
- return mOnInfoWindowCloseListener;
+ return onInfoWindowCloseListener;
}
//
@@ -1617,7 +1626,7 @@ public class MapboxMap {
*/
@UiThread
public boolean isMyLocationEnabled() {
- return mMyLocationEnabled;
+ return myLocationEnabled;
}
/**
@@ -1634,13 +1643,13 @@ public class MapboxMap {
*/
@UiThread
public void setMyLocationEnabled(boolean enabled) {
- if (!mMapView.isPermissionsAccepted()) {
- Log.e(MapboxConstants.TAG, "Could not activate user location tracking: " +
- "user did not accept the permission or permissions were not requested.");
+ if (!mapView.isPermissionsAccepted()) {
+ Log.e(MapboxConstants.TAG, "Could not activate user location tracking: "
+ + "user did not accept the permission or permissions were not requested.");
return;
}
- mMyLocationEnabled = enabled;
- mMapView.setMyLocationEnabled(enabled);
+ myLocationEnabled = enabled;
+ mapView.setMyLocationEnabled(enabled);
}
/**
@@ -1651,7 +1660,7 @@ public class MapboxMap {
@UiThread
@Nullable
public Location getMyLocation() {
- return mMapView.getMyLocation();
+ return mapView.getMyLocation();
}
/**
@@ -1663,7 +1672,7 @@ public class MapboxMap {
*/
@UiThread
public void setOnMyLocationChangeListener(@Nullable MapboxMap.OnMyLocationChangeListener listener) {
- mMapView.setOnMyLocationChangeListener(listener);
+ mapView.setOnMyLocationChangeListener(listener);
}
/**
@@ -1674,12 +1683,12 @@ public class MapboxMap {
*/
@UiThread
public void setOnMyLocationTrackingModeChangeListener(@Nullable MapboxMap.OnMyLocationTrackingModeChangeListener listener) {
- mOnMyLocationTrackingModeChangeListener = listener;
+ onMyLocationTrackingModeChangeListener = listener;
}
// used by MapView
MapboxMap.OnMyLocationTrackingModeChangeListener getOnMyLocationTrackingModeChangeListener() {
- return mOnMyLocationTrackingModeChangeListener;
+ return onMyLocationTrackingModeChangeListener;
}
/**
@@ -1690,24 +1699,24 @@ public class MapboxMap {
*/
@UiThread
public void setOnMyBearingTrackingModeChangeListener(@Nullable OnMyBearingTrackingModeChangeListener listener) {
- mOnMyBearingTrackingModeChangeListener = listener;
+ onMyBearingTrackingModeChangeListener = listener;
}
// used by MapView
OnMyBearingTrackingModeChangeListener getOnMyBearingTrackingModeChangeListener() {
- return mOnMyBearingTrackingModeChangeListener;
+ return onMyBearingTrackingModeChangeListener;
}
MapView getMapView() {
- return mMapView;
+ return mapView;
}
void setUiSettings(UiSettings uiSettings) {
- mUiSettings = uiSettings;
+ this.uiSettings = uiSettings;
}
void setProjection(Projection projection) {
- mProjection = projection;
+ this.projection = projection;
}
//
@@ -1718,7 +1727,7 @@ public class MapboxMap {
* Triggers an invalidation of the map view.
*/
public void invalidate() {
- mMapView.invalidate();
+ mapView.invalidate();
}
/**
@@ -1729,7 +1738,7 @@ public class MapboxMap {
*/
@UiThread
public void snapshot(@NonNull SnapshotReadyCallback callback, @Nullable final Bitmap bitmap) {
- mMapView.snapshot(callback, bitmap);
+ mapView.snapshot(callback, bitmap);
}
/**
@@ -1739,7 +1748,7 @@ public class MapboxMap {
*/
@UiThread
public void snapshot(@NonNull SnapshotReadyCallback callback) {
- mMapView.snapshot(callback, null);
+ mapView.snapshot(callback, null);
}
/**
@@ -1752,7 +1761,7 @@ public class MapboxMap {
@UiThread
@NonNull
public List<Feature> queryRenderedFeatures(@NonNull PointF coordinates, @Nullable String... layerIds) {
- return mMapView.getNativeMapView().queryRenderedFeatures(coordinates, layerIds);
+ return mapView.getNativeMapView().queryRenderedFeatures(coordinates, layerIds);
}
/**
@@ -1765,7 +1774,7 @@ public class MapboxMap {
@UiThread
@NonNull
public List<Feature> queryRenderedFeatures(@NonNull RectF coordinates, @Nullable String... layerIds) {
- return mMapView.getNativeMapView().queryRenderedFeatures(coordinates, layerIds);
+ return mapView.getNativeMapView().queryRenderedFeatures(coordinates, layerIds);
}
@@ -1935,11 +1944,11 @@ public class MapboxMap {
*
* @param <U> the instance type of MarkerView
*/
- public static abstract class MarkerViewAdapter<U extends MarkerView> {
+ public abstract static class MarkerViewAdapter<U extends MarkerView> {
private Context context;
private final Class<U> persistentClass;
- private final Pools.SimplePool<View> mViewReusePool;
+ private final Pools.SimplePool<View> viewReusePool;
/**
* Create an instance of MarkerViewAdapter.
@@ -1950,7 +1959,7 @@ public class MapboxMap {
public MarkerViewAdapter(Context context) {
this.context = context;
persistentClass = (Class<U>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
- mViewReusePool = new Pools.SimplePool<>(10000);
+ viewReusePool = new Pools.SimplePool<>(10000);
}
/**
@@ -2023,7 +2032,7 @@ public class MapboxMap {
* @return the pool associated to this adapter
*/
public final Pools.SimplePool<View> getViewReusePool() {
- return mViewReusePool;
+ return viewReusePool;
}
/**
@@ -2042,7 +2051,7 @@ public class MapboxMap {
*/
public final void releaseView(View view) {
view.setVisibility(View.GONE);
- mViewReusePool.release(view);
+ viewReusePool.release(view);
}
}
@@ -2137,18 +2146,18 @@ public class MapboxMap {
private class MapChangeCameraPositionListener implements MapView.OnMapChangedListener {
private static final long UPDATE_RATE_MS = 400;
- private long mPreviousUpdateTimestamp = 0;
+ private long previousUpdateTimestamp = 0;
@Override
public void onMapChanged(@MapView.MapChange int change) {
if (change >= MapView.REGION_WILL_CHANGE && change <= MapView.REGION_DID_CHANGE_ANIMATED) {
- mInvalidCameraPosition = true;
+ invalidCameraPosition = true;
long currentTime = SystemClock.elapsedRealtime();
- if (currentTime < mPreviousUpdateTimestamp) {
+ if (currentTime < previousUpdateTimestamp) {
return;
}
invalidateCameraPosition();
- mPreviousUpdateTimestamp = currentTime + UPDATE_RATE_MS;
+ previousUpdateTimestamp = currentTime + UPDATE_RATE_MS;
}
}
}
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 6203d013ae..6bf4212857 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
@@ -45,17 +45,17 @@ public class MapboxMapOptions implements Parcelable {
private boolean compassEnabled = true;
private int compassGravity = Gravity.TOP | Gravity.END;
- private int compassMargins[];
+ private int[] compassMargins;
private boolean logoEnabled = true;
private int logoGravity = Gravity.BOTTOM | Gravity.START;
- private int logoMargins[];
+ private int[] logoMargins;
@ColorInt
private int attributionTintColor = -1;
private boolean attributionEnabled = true;
private int attributionGravity = Gravity.BOTTOM;
- private int attributionMargins[];
+ private int[] attributionMargins;
private float minZoom = MapboxConstants.MINIMUM_ZOOM;
private float maxZoom = MapboxConstants.MAXIMUM_ZOOM;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
index 1a5731b51f..0750c987ea 100755
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
@@ -37,13 +37,13 @@ final class NativeMapView {
// Instance members
//
- boolean mDestroyed = false;
+ boolean destroyed = false;
// Holds the pointer to JNI NativeMapView
- private long mNativeMapViewPtr = 0;
+ private long nativeMapViewPtr = 0;
// Used for callbacks
- private MapView mMapView;
+ private MapView mapView;
private final float pixelRatio;
@@ -87,8 +87,8 @@ final class NativeMapView {
throw new IllegalArgumentException("totalMemory cannot be negative.");
}
- mMapView = mapView;
- mNativeMapViewPtr = nativeCreate(cachePath, dataPath, apkPath, pixelRatio, availableProcessors, totalMemory);
+ this.mapView = mapView;
+ nativeMapViewPtr = nativeCreate(cachePath, dataPath, apkPath, pixelRatio, availableProcessors, totalMemory);
}
//
@@ -96,46 +96,46 @@ final class NativeMapView {
//
public void destroy() {
- nativeDestroy(mNativeMapViewPtr);
- mNativeMapViewPtr = 0;
- mMapView = null;
- mDestroyed = true;
+ nativeDestroy(nativeMapViewPtr);
+ nativeMapViewPtr = 0;
+ mapView = null;
+ destroyed = true;
}
public boolean wasDestroyed() {
- return mDestroyed;
+ return destroyed;
}
public void initializeDisplay() {
- nativeInitializeDisplay(mNativeMapViewPtr);
+ nativeInitializeDisplay(nativeMapViewPtr);
}
public void terminateDisplay() {
- nativeTerminateDisplay(mNativeMapViewPtr);
+ nativeTerminateDisplay(nativeMapViewPtr);
}
public void initializeContext() {
- nativeInitializeContext(mNativeMapViewPtr);
+ nativeInitializeContext(nativeMapViewPtr);
}
public void terminateContext() {
- nativeTerminateContext(mNativeMapViewPtr);
+ nativeTerminateContext(nativeMapViewPtr);
}
public void createSurface(Surface surface) {
- nativeCreateSurface(mNativeMapViewPtr, surface);
+ nativeCreateSurface(nativeMapViewPtr, surface);
}
public void destroySurface() {
- nativeDestroySurface(mNativeMapViewPtr);
+ nativeDestroySurface(nativeMapViewPtr);
}
public void update() {
- nativeUpdate(mNativeMapViewPtr);
+ nativeUpdate(nativeMapViewPtr);
}
public void render() {
- nativeRender(mNativeMapViewPtr);
+ nativeRender(nativeMapViewPtr);
}
public void resizeView(int width, int height) {
@@ -156,7 +156,7 @@ final class NativeMapView {
throw new IllegalArgumentException(
"height cannot be greater than 65535.");
}
- nativeViewResize(mNativeMapViewPtr, width, height);
+ nativeViewResize(nativeMapViewPtr, width, height);
}
public void resizeFramebuffer(int fbWidth, int fbHeight) {
@@ -177,55 +177,55 @@ final class NativeMapView {
throw new IllegalArgumentException(
"fbHeight cannot be greater than 65535.");
}
- nativeFramebufferResize(mNativeMapViewPtr, fbWidth, fbHeight);
+ nativeFramebufferResize(nativeMapViewPtr, fbWidth, fbHeight);
}
public void addClass(String clazz) {
- nativeAddClass(mNativeMapViewPtr, clazz);
+ nativeAddClass(nativeMapViewPtr, clazz);
}
public void removeClass(String clazz) {
- nativeRemoveClass(mNativeMapViewPtr, clazz);
+ nativeRemoveClass(nativeMapViewPtr, clazz);
}
public boolean hasClass(String clazz) {
- return nativeHasClass(mNativeMapViewPtr, clazz);
+ return nativeHasClass(nativeMapViewPtr, clazz);
}
public void setClasses(List<String> classes) {
- nativeSetClasses(mNativeMapViewPtr, classes);
+ nativeSetClasses(nativeMapViewPtr, classes);
}
public List<String> getClasses() {
- return nativeGetClasses(mNativeMapViewPtr);
+ return nativeGetClasses(nativeMapViewPtr);
}
public void setStyleUrl(String url) {
- nativeSetStyleUrl(mNativeMapViewPtr, url);
+ nativeSetStyleUrl(nativeMapViewPtr, url);
}
public void setStyleJson(String newStyleJson) {
- nativeSetStyleJson(mNativeMapViewPtr, newStyleJson);
+ nativeSetStyleJson(nativeMapViewPtr, newStyleJson);
}
public String getStyleJson() {
- return nativeGetStyleJson(mNativeMapViewPtr);
+ return nativeGetStyleJson(nativeMapViewPtr);
}
public void setAccessToken(String accessToken) {
- nativeSetAccessToken(mNativeMapViewPtr, accessToken);
+ nativeSetAccessToken(nativeMapViewPtr, accessToken);
}
public String getAccessToken() {
- return nativeGetAccessToken(mNativeMapViewPtr);
+ return nativeGetAccessToken(nativeMapViewPtr);
}
public void cancelTransitions() {
- nativeCancelTransitions(mNativeMapViewPtr);
+ nativeCancelTransitions(nativeMapViewPtr);
}
public void setGestureInProgress(boolean inProgress) {
- nativeSetGestureInProgress(mNativeMapViewPtr, inProgress);
+ nativeSetGestureInProgress(nativeMapViewPtr, inProgress);
}
public void moveBy(double dx, double dy) {
@@ -233,7 +233,7 @@ final class NativeMapView {
}
public void moveBy(double dx, double dy, long duration) {
- nativeMoveBy(mNativeMapViewPtr, dx, dy, duration);
+ nativeMoveBy(nativeMapViewPtr, dx, dy, duration);
}
public void setLatLng(LatLng latLng) {
@@ -241,23 +241,23 @@ final class NativeMapView {
}
public void setLatLng(LatLng latLng, long duration) {
- nativeSetLatLng(mNativeMapViewPtr, latLng.getLatitude(), latLng.getLongitude(), duration);
+ nativeSetLatLng(nativeMapViewPtr, latLng.getLatitude(), latLng.getLongitude(), duration);
}
public LatLng getLatLng() {
- return nativeGetLatLng(mNativeMapViewPtr);
+ return nativeGetLatLng(nativeMapViewPtr);
}
public void resetPosition() {
- nativeResetPosition(mNativeMapViewPtr);
+ nativeResetPosition(nativeMapViewPtr);
}
public double getPitch() {
- return nativeGetPitch(mNativeMapViewPtr);
+ return nativeGetPitch(nativeMapViewPtr);
}
public void setPitch(double pitch, long duration) {
- nativeSetPitch(mNativeMapViewPtr, pitch, duration);
+ nativeSetPitch(nativeMapViewPtr, pitch, duration);
}
public void scaleBy(double ds) {
@@ -269,7 +269,7 @@ final class NativeMapView {
}
public void scaleBy(double ds, double cx, double cy, long duration) {
- nativeScaleBy(mNativeMapViewPtr, ds, cx, cy, duration);
+ nativeScaleBy(nativeMapViewPtr, ds, cx, cy, duration);
}
public void setScale(double scale) {
@@ -281,11 +281,11 @@ final class NativeMapView {
}
public void setScale(double scale, double cx, double cy, long duration) {
- nativeSetScale(mNativeMapViewPtr, scale, cx, cy, duration);
+ nativeSetScale(nativeMapViewPtr, scale, cx, cy, duration);
}
public double getScale() {
- return nativeGetScale(mNativeMapViewPtr);
+ return nativeGetScale(nativeMapViewPtr);
}
public void setZoom(double zoom) {
@@ -293,31 +293,31 @@ final class NativeMapView {
}
public void setZoom(double zoom, long duration) {
- nativeSetZoom(mNativeMapViewPtr, zoom, duration);
+ nativeSetZoom(nativeMapViewPtr, zoom, duration);
}
public double getZoom() {
- return nativeGetZoom(mNativeMapViewPtr);
+ return nativeGetZoom(nativeMapViewPtr);
}
public void resetZoom() {
- nativeResetZoom(mNativeMapViewPtr);
+ nativeResetZoom(nativeMapViewPtr);
}
public void setMinZoom(double zoom) {
- nativeSetMinZoom(mNativeMapViewPtr, zoom);
+ nativeSetMinZoom(nativeMapViewPtr, zoom);
}
public double getMinZoom() {
- return nativeGetMinZoom(mNativeMapViewPtr);
+ return nativeGetMinZoom(nativeMapViewPtr);
}
public void setMaxZoom(double zoom) {
- nativeSetMaxZoom(mNativeMapViewPtr, zoom);
+ nativeSetMaxZoom(nativeMapViewPtr, zoom);
}
public double getMaxZoom() {
- return nativeGetMaxZoom(mNativeMapViewPtr);
+ return nativeGetMaxZoom(nativeMapViewPtr);
}
public void rotateBy(double sx, double sy, double ex, double ey) {
@@ -326,11 +326,11 @@ final class NativeMapView {
public void rotateBy(double sx, double sy, double ex, double ey,
long duration) {
- nativeRotateBy(mNativeMapViewPtr, sx, sy, ex, ey, duration);
+ nativeRotateBy(nativeMapViewPtr, sx, sy, ex, ey, duration);
}
public void setContentPadding(double top, double left, double bottom, double right) {
- nativeSetContentPadding(mNativeMapViewPtr, top, left, bottom, right);
+ nativeSetContentPadding(nativeMapViewPtr, top, left, bottom, right);
}
public void setBearing(double degrees) {
@@ -338,60 +338,60 @@ final class NativeMapView {
}
public void setBearing(double degrees, long duration) {
- nativeSetBearing(mNativeMapViewPtr, degrees, duration);
+ nativeSetBearing(nativeMapViewPtr, degrees, duration);
}
public void setBearing(double degrees, double cx, double cy) {
- nativeSetBearingXY(mNativeMapViewPtr, degrees, cx, cy);
+ nativeSetBearingXY(nativeMapViewPtr, degrees, cx, cy);
}
public double getBearing() {
- return nativeGetBearing(mNativeMapViewPtr);
+ return nativeGetBearing(nativeMapViewPtr);
}
public void resetNorth() {
- nativeResetNorth(mNativeMapViewPtr);
+ nativeResetNorth(nativeMapViewPtr);
}
public long addMarker(Marker marker) {
Marker[] markers = {marker};
- return nativeAddMarkers(mNativeMapViewPtr, markers)[0];
+ return nativeAddMarkers(nativeMapViewPtr, markers)[0];
}
public long[] addMarkers(List<Marker> markers) {
- return nativeAddMarkers(mNativeMapViewPtr, markers.toArray(new Marker[markers.size()]));
+ return nativeAddMarkers(nativeMapViewPtr, markers.toArray(new Marker[markers.size()]));
}
public long addPolyline(Polyline polyline) {
Polyline[] polylines = {polyline};
- return nativeAddPolylines(mNativeMapViewPtr, polylines)[0];
+ return nativeAddPolylines(nativeMapViewPtr, polylines)[0];
}
public long[] addPolylines(List<Polyline> polylines) {
- return nativeAddPolylines(mNativeMapViewPtr, polylines.toArray(new Polyline[polylines.size()]));
+ return nativeAddPolylines(nativeMapViewPtr, polylines.toArray(new Polyline[polylines.size()]));
}
public long addPolygon(Polygon polygon) {
Polygon[] polygons = {polygon};
- return nativeAddPolygons(mNativeMapViewPtr, polygons)[0];
+ return nativeAddPolygons(nativeMapViewPtr, polygons)[0];
}
public long[] addPolygons(List<Polygon> polygons) {
- return nativeAddPolygons(mNativeMapViewPtr, polygons.toArray(new Polygon[polygons.size()]));
+ return nativeAddPolygons(nativeMapViewPtr, polygons.toArray(new Polygon[polygons.size()]));
}
public void updateMarker(Marker marker) {
LatLng position = marker.getPosition();
Icon icon = marker.getIcon();
- nativeUpdateMarker(mNativeMapViewPtr, marker.getId(), position.getLatitude(), position.getLongitude(), icon.getId());
+ nativeUpdateMarker(nativeMapViewPtr, marker.getId(), position.getLatitude(), position.getLongitude(), icon.getId());
}
public void updatePolygon(Polygon polygon) {
- nativeUpdatePolygon(mNativeMapViewPtr, polygon.getId(), polygon);
+ nativeUpdatePolygon(nativeMapViewPtr, polygon.getId(), polygon);
}
public void updatePolyline(Polyline polyline) {
- nativeUpdatePolyline(mNativeMapViewPtr, polyline.getId(), polyline);
+ nativeUpdatePolyline(nativeMapViewPtr, polyline.getId(), polyline);
}
public void removeAnnotation(long id) {
@@ -400,120 +400,120 @@ final class NativeMapView {
}
public void removeAnnotations(long[] ids) {
- nativeRemoveAnnotations(mNativeMapViewPtr, ids);
+ nativeRemoveAnnotations(nativeMapViewPtr, ids);
}
public long[] queryPointAnnotations(RectF rect) {
- return nativeQueryPointAnnotations(mNativeMapViewPtr, rect);
+ return nativeQueryPointAnnotations(nativeMapViewPtr, rect);
}
public void addAnnotationIcon(String symbol, int width, int height, float scale, byte[] pixels) {
- nativeAddAnnotationIcon(mNativeMapViewPtr, symbol, width, height, scale, pixels);
+ nativeAddAnnotationIcon(nativeMapViewPtr, symbol, width, height, scale, pixels);
}
public void setVisibleCoordinateBounds(LatLng[] coordinates, RectF padding, double direction, long duration) {
- nativeSetVisibleCoordinateBounds(mNativeMapViewPtr, coordinates, padding, direction, duration);
+ nativeSetVisibleCoordinateBounds(nativeMapViewPtr, coordinates, padding, direction, duration);
}
public void onLowMemory() {
- nativeOnLowMemory(mNativeMapViewPtr);
+ nativeOnLowMemory(nativeMapViewPtr);
}
public void setDebug(boolean debug) {
- nativeSetDebug(mNativeMapViewPtr, debug);
+ nativeSetDebug(nativeMapViewPtr, debug);
}
public void cycleDebugOptions() {
- nativeToggleDebug(mNativeMapViewPtr);
+ nativeToggleDebug(nativeMapViewPtr);
}
public boolean getDebug() {
- return nativeGetDebug(mNativeMapViewPtr);
+ return nativeGetDebug(nativeMapViewPtr);
}
public boolean isFullyLoaded() {
- return nativeIsFullyLoaded(mNativeMapViewPtr);
+ return nativeIsFullyLoaded(nativeMapViewPtr);
}
public void setReachability(boolean status) {
- nativeSetReachability(mNativeMapViewPtr, status);
+ nativeSetReachability(nativeMapViewPtr, status);
}
public double getMetersPerPixelAtLatitude(double lat, double zoom) {
- return nativeGetMetersPerPixelAtLatitude(mNativeMapViewPtr, lat, zoom);
+ return nativeGetMetersPerPixelAtLatitude(nativeMapViewPtr, lat, zoom);
}
public ProjectedMeters projectedMetersForLatLng(LatLng latLng) {
- return nativeProjectedMetersForLatLng(mNativeMapViewPtr, latLng.getLatitude(), latLng.getLongitude());
+ return nativeProjectedMetersForLatLng(nativeMapViewPtr, latLng.getLatitude(), latLng.getLongitude());
}
public LatLng latLngForProjectedMeters(ProjectedMeters projectedMeters) {
- return nativeLatLngForProjectedMeters(mNativeMapViewPtr, projectedMeters.getNorthing(), projectedMeters.getEasting());
+ return nativeLatLngForProjectedMeters(nativeMapViewPtr, projectedMeters.getNorthing(), projectedMeters.getEasting());
}
public PointF pixelForLatLng(LatLng latLng) {
- return nativePixelForLatLng(mNativeMapViewPtr, latLng.getLatitude(), latLng.getLongitude());
+ return nativePixelForLatLng(nativeMapViewPtr, latLng.getLatitude(), latLng.getLongitude());
}
public LatLng latLngForPixel(PointF pixel) {
- return nativeLatLngForPixel(mNativeMapViewPtr, pixel.x, pixel.y);
+ return nativeLatLngForPixel(nativeMapViewPtr, pixel.x, pixel.y);
}
public double getTopOffsetPixelsForAnnotationSymbol(String symbolName) {
- return nativeGetTopOffsetPixelsForAnnotationSymbol(mNativeMapViewPtr, symbolName);
+ return nativeGetTopOffsetPixelsForAnnotationSymbol(nativeMapViewPtr, symbolName);
}
public void jumpTo(double angle, LatLng center, double pitch, double zoom) {
- nativeJumpTo(mNativeMapViewPtr, angle, center.getLatitude(), center.getLongitude(), pitch, zoom);
+ nativeJumpTo(nativeMapViewPtr, angle, center.getLatitude(), center.getLongitude(), pitch, zoom);
}
public void easeTo(double angle, LatLng center, long duration, double pitch, double zoom, boolean easingInterpolator) {
- nativeEaseTo(mNativeMapViewPtr, angle, center.getLatitude(), center.getLongitude(), duration, pitch, zoom, easingInterpolator);
+ nativeEaseTo(nativeMapViewPtr, angle, center.getLatitude(), center.getLongitude(), duration, pitch, zoom, easingInterpolator);
}
public void flyTo(double angle, LatLng center, long duration, double pitch, double zoom) {
- nativeFlyTo(mNativeMapViewPtr, angle, center.getLatitude(), center.getLongitude(), duration, pitch, zoom);
+ nativeFlyTo(nativeMapViewPtr, angle, center.getLatitude(), center.getLongitude(), duration, pitch, zoom);
}
public double[] getCameraValues() {
- return nativeGetCameraValues(mNativeMapViewPtr);
+ return nativeGetCameraValues(nativeMapViewPtr);
}
// Runtime style Api
public Layer getLayer(String layerId) {
- return nativeGetLayer(mNativeMapViewPtr, layerId);
+ return nativeGetLayer(nativeMapViewPtr, layerId);
}
public void addLayer(@NonNull Layer layer, @Nullable String before) {
- nativeAddLayer(mNativeMapViewPtr, layer.getNativePtr(), before);
+ nativeAddLayer(nativeMapViewPtr, layer.getNativePtr(), before);
layer.invalidate();
}
public void removeLayer(@NonNull String layerId) throws NoSuchLayerException {
- nativeRemoveLayer(mNativeMapViewPtr, layerId);
+ nativeRemoveLayer(nativeMapViewPtr, layerId);
}
public void addSource(@NonNull Source source) {
- nativeAddSource(mNativeMapViewPtr, source.getId(), source);
+ nativeAddSource(nativeMapViewPtr, source.getId(), source);
}
public void removeSource(@NonNull String sourceId) throws NoSuchSourceException {
- nativeRemoveSource(mNativeMapViewPtr, sourceId);
+ nativeRemoveSource(nativeMapViewPtr, sourceId);
}
// Feature querying
@NonNull
public List<Feature> queryRenderedFeatures(PointF coordinates, String... layerIds) {
- Feature[] features = nativeQueryRenderedFeaturesForPoint(mNativeMapViewPtr, coordinates.x / pixelRatio, coordinates.y / pixelRatio, layerIds);
+ Feature[] features = nativeQueryRenderedFeaturesForPoint(nativeMapViewPtr, coordinates.x / pixelRatio, coordinates.y / pixelRatio, layerIds);
return features != null ? Arrays.asList(features) : new ArrayList<Feature>();
}
@NonNull
public List<Feature> queryRenderedFeatures(RectF coordinates, String... layerIds) {
Feature[] features = nativeQueryRenderedFeaturesForBox(
- mNativeMapViewPtr,
+ nativeMapViewPtr,
coordinates.left / pixelRatio,
coordinates.top / pixelRatio,
coordinates.right / pixelRatio,
@@ -523,11 +523,11 @@ final class NativeMapView {
}
public void scheduleTakeSnapshot() {
- nativeScheduleTakeSnapshot(mNativeMapViewPtr);
+ nativeScheduleTakeSnapshot(nativeMapViewPtr);
}
public void setApiBaseUrl(String baseUrl) {
- nativeSetAPIBaseURL(mNativeMapViewPtr, baseUrl);
+ nativeSetAPIBaseURL(nativeMapViewPtr, baseUrl);
}
//
@@ -535,19 +535,19 @@ final class NativeMapView {
//
protected void onInvalidate() {
- mMapView.onInvalidate();
+ mapView.onInvalidate();
}
protected void onMapChanged(int rawChange) {
- mMapView.onMapChanged(rawChange);
+ mapView.onMapChanged(rawChange);
}
protected void onFpsChanged(double fps) {
- mMapView.onFpsChanged(fps);
+ mapView.onFpsChanged(fps);
}
protected void onSnapshotReady(byte[] bytes) {
- mMapView.onSnapshotReady(bytes);
+ mapView.onSnapshotReady(bytes);
}
//
@@ -660,18 +660,18 @@ final class NativeMapView {
private native long[] nativeAddMarkers(long nativeMapViewPtr, Marker[] markers);
- private native long[] nativeAddPolylines(long mNativeMapViewPtr, Polyline[] polylines);
+ private native long[] nativeAddPolylines(long nativeMapViewPtr, Polyline[] polylines);
- private native long[] nativeAddPolygons(long mNativeMapViewPtr, Polygon[] polygons);
+ private native long[] nativeAddPolygons(long nativeMapViewPtr, Polygon[] polygons);
private native void nativeRemoveAnnotations(long nativeMapViewPtr, long[] id);
- private native long[] nativeQueryPointAnnotations(long mNativeMapViewPtr, RectF rect);
+ private native long[] nativeQueryPointAnnotations(long nativeMapViewPtr, RectF rect);
private native void nativeAddAnnotationIcon(long nativeMapViewPtr, String symbol,
int width, int height, float scale, byte[] pixels);
- private native void nativeSetVisibleCoordinateBounds(long mNativeMapViewPtr, LatLng[] coordinates,
+ private native void nativeSetVisibleCoordinateBounds(long nativeMapViewPtr, LatLng[] coordinates,
RectF padding, double direction, long duration);
private native void nativeOnLowMemory(long nativeMapViewPtr);
@@ -704,7 +704,7 @@ final class NativeMapView {
private native void nativeFlyTo(long nativeMapViewPtr, double angle, double latitude, double longitude, long duration, double pitch, double zoom);
- private native double[] nativeGetCameraValues(long mNativeMapViewPtr);
+ private native double[] nativeGetCameraValues(long nativeMapViewPtr);
private native Layer nativeGetLayer(long nativeMapViewPtr, String layerId);
@@ -712,9 +712,9 @@ final class NativeMapView {
private native void nativeRemoveLayer(long nativeMapViewPtr, String layerId) throws NoSuchLayerException;
- private native void nativeAddSource(long mNativeMapViewPtr, String id, Source source);
+ private native void nativeAddSource(long nativeMapViewPtr, String id, Source source);
- private native void nativeRemoveSource(long mNativeMapViewPtr, String sourceId) throws NoSuchSourceException;
+ private native void nativeRemoveSource(long nativeMapViewPtr, String sourceId) throws NoSuchSourceException;
private native void nativeUpdatePolygon(long nativeMapViewPtr, long polygonId, Polygon polygon);
@@ -724,7 +724,7 @@ final class NativeMapView {
private native Feature[] nativeQueryRenderedFeaturesForPoint(long nativeMapViewPtr, float x, float y, String[] layerIds);
- private native Feature[] nativeQueryRenderedFeaturesForBox(long mNativeMapViewPtr, float left, float top, float right, float bottom, String[] layerIds);
+ private native Feature[] nativeQueryRenderedFeaturesForBox(long nativeMapViewPtr, float left, float top, float right, float bottom, String[] layerIds);
private native void nativeSetAPIBaseURL(long nativeMapViewPtr, String baseUrl);
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java
index a41b2606a5..17d4a7c657 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java
@@ -15,10 +15,10 @@ import com.mapbox.mapboxsdk.geometry.VisibleRegion;
*/
public class Projection {
- private MapView mMapView;
+ private MapView mapView;
Projection(@NonNull MapView mapView) {
- this.mMapView = mapView;
+ this.mapView = mapView;
}
/**
@@ -32,7 +32,7 @@ public class Projection {
* @return The distance measured in meters.
*/
public double getMetersPerPixelAtLatitude(@FloatRange(from = -90, to = 90) double latitude) {
- return mMapView.getMetersPerPixelAtLatitude(latitude);
+ return mapView.getMetersPerPixelAtLatitude(latitude);
}
/**
@@ -45,7 +45,7 @@ public class Projection {
* the given screen point does not intersect the ground plane.
*/
public LatLng fromScreenLocation(PointF point) {
- return mMapView.fromScreenLocation(point);
+ return mapView.fromScreenLocation(point);
}
/**
@@ -57,10 +57,10 @@ public class Projection {
public VisibleRegion getVisibleRegion() {
LatLngBounds.Builder builder = new LatLngBounds.Builder();
- float left = mMapView.getContentPaddingLeft();
- float right = mMapView.getWidth() - mMapView.getContentPaddingRight();
- float top = mMapView.getContentPaddingTop();
- float bottom = mMapView.getHeight() - mMapView.getContentPaddingBottom();
+ float left = mapView.getContentPaddingLeft();
+ float right = mapView.getWidth() - mapView.getContentPaddingRight();
+ float top = mapView.getContentPaddingTop();
+ float bottom = mapView.getHeight() - mapView.getContentPaddingBottom();
LatLng topLeft = fromScreenLocation(new PointF(left, top));
LatLng topRight = fromScreenLocation(new PointF(right, top));
@@ -84,7 +84,7 @@ public class Projection {
* @return A Point representing the screen location in screen pixels.
*/
public PointF toScreenLocation(LatLng location) {
- return mMapView.toScreenLocation(location);
+ return mapView.toScreenLocation(location);
}
/**
@@ -94,6 +94,6 @@ public class Projection {
* @return zoom level that fits the MapView.
*/
public double calculateZoom(float minScale) {
- return Math.log(mMapView.getScale() * minScale) / Math.log(2);
+ return Math.log(mapView.getScale() * minScale) / Math.log(2);
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java
index 9fb97cce1f..72674c3bc9 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java
@@ -35,8 +35,8 @@ import com.mapbox.mapboxsdk.exceptions.InvalidAccessTokenException;
*/
public class SupportMapFragment extends Fragment {
- private MapView mMap;
- private OnMapReadyCallback mOnMapReadyCallback;
+ private MapView map;
+ private OnMapReadyCallback onMapReadyCallback;
/**
* Creates a MapFragment instance
@@ -115,7 +115,7 @@ public class SupportMapFragment extends Fragment {
options.myLocationBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_background));
}
- return mMap = new MapView(inflater.getContext(), options);
+ return map = new MapView(inflater.getContext(), options);
}
/**
@@ -142,7 +142,7 @@ public class SupportMapFragment extends Fragment {
throw new IllegalArgumentException();
}
return token;
- } catch (Exception e) {
+ } catch (Exception exception) {
// use fallback on string resource, used for development
int tokenResId = context.getResources().getIdentifier("mapbox_access_token", "string", context.getPackageName());
return tokenResId != 0 ? context.getString(tokenResId) : null;
@@ -158,7 +158,7 @@ public class SupportMapFragment extends Fragment {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- mMap.onCreate(savedInstanceState);
+ map.onCreate(savedInstanceState);
}
/**
@@ -167,7 +167,7 @@ public class SupportMapFragment extends Fragment {
@Override
public void onStart() {
super.onStart();
- mMap.getMapAsync(mOnMapReadyCallback);
+ map.getMapAsync(onMapReadyCallback);
}
/**
@@ -176,7 +176,7 @@ public class SupportMapFragment extends Fragment {
@Override
public void onResume() {
super.onResume();
- mMap.onResume();
+ map.onResume();
}
/**
@@ -185,7 +185,7 @@ public class SupportMapFragment extends Fragment {
@Override
public void onPause() {
super.onPause();
- mMap.onPause();
+ map.onPause();
}
/**
@@ -196,7 +196,7 @@ public class SupportMapFragment extends Fragment {
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
- mMap.onSaveInstanceState(outState);
+ map.onSaveInstanceState(outState);
}
/**
@@ -213,7 +213,7 @@ public class SupportMapFragment extends Fragment {
@Override
public void onLowMemory() {
super.onLowMemory();
- mMap.onLowMemory();
+ map.onLowMemory();
}
/**
@@ -222,7 +222,7 @@ public class SupportMapFragment extends Fragment {
@Override
public void onDestroyView() {
super.onDestroyView();
- mMap.onDestroy();
+ map.onDestroy();
}
/**
@@ -231,6 +231,6 @@ public class SupportMapFragment extends Fragment {
* @param onMapReadyCallback The callback to be invoked.
*/
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
- mOnMapReadyCallback = onMapReadyCallback;
+ this.onMapReadyCallback = onMapReadyCallback;
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/ViewSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/ViewSettings.java
index f08a1bdeb4..4478978853 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/ViewSettings.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/ViewSettings.java
@@ -7,7 +7,7 @@ class ViewSettings {
private boolean enabled;
private int gravity;
- private int[]margins;
+ private int[] margins;
private int tintColor;
public ViewSettings() {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java
index 794a4f6086..e469eb14ab 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java
@@ -25,9 +25,9 @@ import java.util.TimerTask;
*/
public final class CompassView extends ImageView {
- private Timer mNorthTimer;
- private double mDirection = 0.0f;
- private ViewPropertyAnimatorCompat mFadeAnimator;
+ private Timer northTimer;
+ private double direction = 0.0f;
+ private ViewPropertyAnimatorCompat fadeAnimator;
public CompassView(Context context) {
super(context);
@@ -52,8 +52,8 @@ public final class CompassView extends ImageView {
setEnabled(false);
// Layout params
- float mScreenDensity = context.getResources().getDisplayMetrics().density;
- ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams((int) (48 * mScreenDensity), (int) (48 * mScreenDensity));
+ float screenDensity = context.getResources().getDisplayMetrics().density;
+ ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams((int) (48 * screenDensity), (int) (48 * screenDensity));
setLayoutParams(lp);
}
@@ -65,33 +65,33 @@ public final class CompassView extends ImageView {
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (enabled) {
- if (mDirection != 0.0) {
- if (mNorthTimer != null){
- mNorthTimer.cancel();
- mNorthTimer = null;
+ if (direction != 0.0) {
+ if (northTimer != null) {
+ northTimer.cancel();
+ northTimer = null;
}
- if (mFadeAnimator != null) {
- mFadeAnimator.cancel();
+ if (fadeAnimator != null) {
+ fadeAnimator.cancel();
}
- mFadeAnimator = null;
+ fadeAnimator = null;
setAlpha(1.0f);
setVisibility(View.VISIBLE);
}
} else {
- if (mNorthTimer != null){
- mNorthTimer.cancel();
- mNorthTimer = null;
+ if (northTimer != null) {
+ northTimer.cancel();
+ northTimer = null;
}
- if (mFadeAnimator != null) {
- mFadeAnimator.cancel();
+ if (fadeAnimator != null) {
+ fadeAnimator.cancel();
}
- mFadeAnimator = null;
+ fadeAnimator = null;
setVisibility(View.INVISIBLE);
}
}
public void update(double direction) {
- mDirection = direction;
+ this.direction = direction;
setRotation((float) direction);
if (!isEnabled()) {
@@ -103,26 +103,26 @@ public final class CompassView extends ImageView {
return;
}
- if (mNorthTimer == null) {
- if (mFadeAnimator != null) {
- mFadeAnimator.cancel();
+ if (northTimer == null) {
+ if (fadeAnimator != null) {
+ fadeAnimator.cancel();
}
- mFadeAnimator = null;
+ fadeAnimator = null;
- mNorthTimer = new Timer("CompassView North timer");
- mNorthTimer.schedule(new TimerTask() {
+ northTimer = new Timer("CompassView North timer");
+ northTimer.schedule(new TimerTask() {
@Override
public void run() {
post(new Runnable() {
@Override
public void run() {
setAlpha(1.0f);
- mFadeAnimator = ViewCompat.animate(CompassView.this).alpha(0.0f).setDuration(1000).withLayer();
- mFadeAnimator.setListener(new ViewPropertyAnimatorListenerAdapter() {
+ fadeAnimator = ViewCompat.animate(CompassView.this).alpha(0.0f).setDuration(1000).withLayer();
+ fadeAnimator.setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
setVisibility(View.INVISIBLE);
- mNorthTimer = null;
+ northTimer = null;
}
});
}
@@ -131,12 +131,12 @@ public final class CompassView extends ImageView {
}, 1000);
}
} else {
- if (mNorthTimer != null){
- mNorthTimer.cancel();
- mNorthTimer = null;
+ if (northTimer != null) {
+ northTimer.cancel();
+ northTimer = null;
}
- if (mFadeAnimator != null) {
- mFadeAnimator.cancel();
+ if (fadeAnimator != null) {
+ fadeAnimator.cancel();
}
setAlpha(1.0f);
setVisibility(View.VISIBLE);
@@ -145,15 +145,15 @@ public final class CompassView extends ImageView {
static class CompassClickListener implements View.OnClickListener {
- private WeakReference<MapboxMap> mMapboxMap;
+ private WeakReference<MapboxMap> mapboxMap;
public CompassClickListener(final MapboxMap mapboxMap) {
- mMapboxMap = new WeakReference<>(mapboxMap);
+ this.mapboxMap = new WeakReference<>(mapboxMap);
}
@Override
- public void onClick(View v) {
- final MapboxMap mapboxMap = mMapboxMap.get();
+ public void onClick(View view) {
+ final MapboxMap mapboxMap = this.mapboxMap.get();
if (mapboxMap != null) {
mapboxMap.resetNorth();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
index 64f21205b7..2bc03d7ebf 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
@@ -507,10 +507,10 @@ public class MyLocationView extends View {
private static class GpsLocationListener implements LocationListener {
- private WeakReference<MyLocationView> mUserLocationView;
+ private WeakReference<MyLocationView> userLocationView;
public GpsLocationListener(MyLocationView myLocationView) {
- mUserLocationView = new WeakReference<>(myLocationView);
+ userLocationView = new WeakReference<>(myLocationView);
}
/**
@@ -520,7 +520,7 @@ public class MyLocationView extends View {
*/
@Override
public void onLocationChanged(Location location) {
- MyLocationView locationView = mUserLocationView.get();
+ MyLocationView locationView = userLocationView.get();
if (locationView != null) {
locationView.setLocation(location);
}