Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Merge release branch to master #9233

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
08916f2
[android] Update release script to support CircleCI builds (#8950)
zugaldia May 11, 2017
db370a0
[core] When a layer is added, reload its source's tiles
jfirebaugh May 11, 2017
ad46d67
[android] - keep observer when timeout occurs, make observer param nu…
tobrun May 11, 2017
850b008
[android] - avoid crashing when deleting already deleted region (#8920)
tobrun May 11, 2017
e681f69
[android] - update LOST to 2.3.0 (#8872)
tobrun May 12, 2017
cb73736
[android] - update proguard config, allow debug mimification, update …
tobrun May 12, 2017
0ef1293
[core, android, ios, macos, qt] v10 default styles
1ec5 Sep 9, 2016
d85471b
[ios, macos] Updated documented default style version
1ec5 Sep 9, 2016
c5ee41a
[ios, macos] Undeprecated unversioned style URL factory methods
1ec5 Apr 26, 2017
886bf25
[core, android, ios, macos] Added Traffic Day/Night to default styles
1ec5 May 9, 2017
a68788a
[android] Release android-v5.1.0-beta.2 (#8976)
tobrun May 12, 2017
5944216
[android] - MarkerView deselect events with OnMarkerViewClickListener…
tobrun May 15, 2017
627455c
[android] - publish SNAPSHOT from release 5.1.0 branch (#8995)
tobrun May 15, 2017
c7acb55
[ios, macos] edited identity interpolation mode documentation (#8657)
jmkiley May 15, 2017
30b9191
[ios, macos] Factored out tile URL template guide
1ec5 May 10, 2017
4f90d7a
[ios] Telemetry button in modal view controllers (#9027)
jmkiley May 17, 2017
eb83c72
[android] - bump tools and support lib version due to SNAPSHOT depend…
tobrun May 19, 2017
f0b0167
[core] Make destructor virtual to avoid object splicing during destru…
kkaefer May 18, 2017
b52e171
[core] add error for non-virtual destructor deletes + add virtual dtors
kkaefer May 18, 2017
f4f587f
[android] - remove marker from selected markers when removing marker…
tobrun May 19, 2017
3b109c8
Observe layout guides (#7716)
frederoni May 19, 2017
7612e23
[ios, macos] Change == to = in style function initializers
boundsj May 17, 2017
554b1cf
[ios] Add annotation view initializer with annotation and reuse id (#…
boundsj May 19, 2017
b9d3ccc
[ios] Remove annotation view from container view when annotation remo…
boundsj May 19, 2017
4d8625b
[android] - correct bearing conversion when animating the map with ju…
tobrun May 19, 2017
13dee80
[ios, macos] Updated `maximumZoomLevel` description, cherry-picked #8…
jmkiley May 1, 2017
ade7b0e
[ios] Updated podspecs and changelog for v3.5.3 (#8870)
jmkiley May 2, 2017
9ae7371
[ios] Update podspecs and changelog for iOS v3.5.4
boundsj May 9, 2017
e630e8c
[ios, macos] Updated changelogs
1ec5 May 19, 2017
a19fd81
[ios, macos] changed TRUE -> 'true' (#9059) fixes #9056
jmkiley May 19, 2017
e52249c
[ios, macos] Light property implementation in MGLStyle (#9043)
fabian-guerra May 23, 2017
71b6865
[android] - horizontally rotated in snapshot (#9083)
tobrun May 23, 2017
fe17f7e
Cherry-pick arabic text to release branch v3.6.0 (#9071)
fabian-guerra May 23, 2017
a57e9bc
[ios,macos] multipolygon coordinate (#8713)
fabian-guerra May 23, 2017
c9de6cd
[ios, macos] More robust Streets localization
1ec5 May 21, 2017
9b11bb9
[ios] Fallback to Mapbox.bundle as the framework bundle (#9074)
friedbunny May 23, 2017
d90c172
[ios] Move image resources to an asset catalog & switch to PDFs
friedbunny May 19, 2017
bf000c7
[ios, macos] Updated changelogs
1ec5 May 23, 2017
091d3d1
[ios] Update pods spec for iOS v3.6.0-beta.1
fabian-guerra May 23, 2017
8c73cb1
[macos] Enable View ‣ Traffic Night
1ec5 May 23, 2017
3c35bf1
[android] - stop location updates when toggle MyLocationView state (#…
tobrun May 24, 2017
8199315
[android] - LatLngBounds bearing default value (#9102)
tobrun May 24, 2017
e1431f9
[ios, macos] Fix MGLLight.achor to accept style functions
fabian-guerra May 24, 2017
fce7747
[ios] Fix annotation initializers for subclasses of MGLAnnotationView…
boundsj May 25, 2017
35f548a
[ios] Moved `MGLLight` in jazzy table of contents (#9111)
jmkiley May 26, 2017
c392c67
[android] - logo placement for creating a Mapview programatically (#9…
tobrun May 26, 2017
5716bd3
[android] - add binding support for Light (#9013)
tobrun May 26, 2017
82a3a7e
[android] Update Lost to final version 3.0.0 (#9112)
Guardiola31337 May 26, 2017
bc5b147
[android] - convert dp to pixels when getting meters per pixel at. (#…
tobrun May 26, 2017
40a73b3
Release Android v5.1.0-beta.3 (#9115)
tobrun May 26, 2017
fc495de
[android] - harden orientation changes (#9128)
tobrun May 30, 2017
7b85bcc
[ios] Remove filter of single metric event
boundsj May 30, 2017
608fd66
[ios] remove layout guide observers
frederoni May 25, 2017
a39116a
Migrate to GL JS–powered feedback form (#9078)
1ec5 May 30, 2017
83df8a8
[android] - javadoc update for 5.1.0 release (#9138)
tobrun May 31, 2017
b6a4f12
[android] fix missing access token variable issue (#9151)
Guardiola31337 May 31, 2017
af25477
[ios] Update pods spec for iOS v3.6.0-beta.2
fabian-guerra May 31, 2017
52eba42
[android] Cherry picking 9133 (#9145)
Guardiola31337 Jun 1, 2017
b2f277a
add null check in custom location engine activity to prevent null poi…
Guardiola31337 Jun 1, 2017
0d171db
[core] Make TransformState LatLngBounds optional
brunoabinader May 31, 2017
012e88c
[ios] Make annotation view rotation alignment configurable (#9147)
boundsj Jun 1, 2017
3b837d9
Merge branch 'release-ios-v3.6.0-android-v5.1.0' of github.com:mapbox…
fabian-guerra Jun 1, 2017
da53200
[android] - validate if gestures should execute (#9173)
tobrun Jun 2, 2017
ef7b355
[android] - only invoke callback if fling scrolling animation isn't g…
tobrun Jun 6, 2017
a1f8de6
[android] - dealing with infinite camera move callbacks (#9177) (#9194)
LukasPaczos Jun 6, 2017
45327b6
[android] - keep location tracking mode after screen rotation (#9187)
LukasPaczos Jun 6, 2017
facc3d5
fix #8300 flyTo for close points
ansis Jun 6, 2017
ae837f4
[android] - remove conversion from pixels to dp (#9205)
tobrun Jun 7, 2017
78eca86
[android] - option to disable camera animation while following positi…
LukasPaczos Jun 7, 2017
233117f
[android] - invalidating MyLocationView bearing when not following po…
tobrun Jun 8, 2017
9f88e37
Custom location source fix (#9142)
tobrun Jun 9, 2017
fa972fa
[android] - update components with camera values when animating (#9174)
tobrun Jun 9, 2017
6ec5e4f
Cherry picks to release branch (#9230)
tobrun Jun 9, 2017
294f4f8
[android] - update changelog for v5.1.0-beta.4 (#9232)
tobrun Jun 9, 2017
e59766f
[android] - run MapboxMap invocations to ui thread for instrumentatio…
tobrun Jun 12, 2017
f69de7c
Merge branch 'release-ios-v3.6.0-android-v5.1.0' into tvn-merge-after…
tobrun Jun 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
Mapbox welcomes participation and contributions from everyone. If you'd like to do so please see the [`Contributing Guide`](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started.

## 5.1.0 - TBA

## 5.1.0-beta.4 - June 9, 2017

* Option to disable location change animation [#9210](https://github.com/mapbox/mapbox-gl-native/pull/9210)
* Invalidating MyLocationView bearing when not following [#9212](https://github.com/mapbox/mapbox-gl-native/pull/9212)
* Remove upgrade runtime exceptions [#9191](https://github.com/mapbox/mapbox-gl-native/pull/9191)
* Check source usage before removal [#9129](https://github.com/mapbox/mapbox-gl-native/pull/9129)
* Fix tracking mode + camera race condition [#9133](https://github.com/mapbox/mapbox-gl-native/pull/9133)
* Harden orientation changes [#9128](https://github.com/mapbox/mapbox-gl-native/pull/9128)
* Infinite location animation updates [#9194](https://github.com/mapbox/mapbox-gl-native/pull/9194)
* Invoke callback with valid fling gestures [#9192](https://github.com/mapbox/mapbox-gl-native/pull/9192)
* Keep location tracking after screen rotation [#9187](https://github.com/mapbox/mapbox-gl-native/pull/9187)
* Update components with camera values when animating [#9174](https://github.com/mapbox/mapbox-gl-native/pull/9174)
* Validate if gestures should execute [#9173](https://github.com/mapbox/mapbox-gl-native/pull/9173)
* Custom location source and LOST integration [#9142](https://github.com/mapbox/mapbox-gl-native/pull/9142)

## 5.1.0-beta.3 - May 26, 2017

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public final class Mapbox {
private Context context;
private String accessToken;
private Boolean connected;
private LocationSource locationSource;

/**
* Get an instance of Mapbox.
Expand All @@ -45,8 +46,8 @@ public final class Mapbox {
public static synchronized Mapbox getInstance(@NonNull Context context, @NonNull String accessToken) {
if (INSTANCE == null) {
Context appContext = context.getApplicationContext();
INSTANCE = new Mapbox(appContext, accessToken);
LocationEngine locationEngine = LocationSource.getLocationEngine(appContext);
INSTANCE = new Mapbox(appContext, accessToken, new LocationSource(appContext));
LocationEngine locationEngine = new LocationSource(appContext);
locationEngine.setPriority(LocationEnginePriority.NO_POWER);
MapboxTelemetry.getInstance().initialize(
appContext, accessToken, BuildConfig.MAPBOX_EVENTS_USER_AGENT, locationEngine);
Expand All @@ -55,9 +56,10 @@ public static synchronized Mapbox getInstance(@NonNull Context context, @NonNull
return INSTANCE;
}

Mapbox(@NonNull Context context, @NonNull String accessToken) {
Mapbox(@NonNull Context context, @NonNull String accessToken, LocationSource locationSource) {
this.context = context;
this.accessToken = accessToken;
this.locationSource = locationSource;
}

/**
Expand Down Expand Up @@ -128,4 +130,9 @@ public static synchronized Boolean isConnected() {
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return (activeNetwork != null && activeNetwork.isConnected());
}
}

public static LocationSource getLocationSource() {
return INSTANCE.locationSource;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,6 @@ public class MapboxConstants {
public static final String STATE_ATTRIBUTION_MARGIN_RIGHT = "mapbox_attrMarginRight";
public static final String STATE_ATTRIBUTION_MARGIN_BOTTOM = "mapbox_atrrMarginBottom";
public static final String STATE_ATTRIBUTION_ENABLED = "mapbox_atrrEnabled";

public static final String STATE_LOCATION_CHANGE_ANIMATION_ENABLED = "mapbox_locationChangeAnimationEnabled";
public static final String STATE_USING_CUSTOM_LOCATION_SOURCE = "mapbox_usingCustomLocationSource";
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;
import android.location.Location;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.mapbox.services.android.telemetry.location.LocationEngine;
import com.mapbox.services.android.telemetry.location.LocationEngineListener;
Expand All @@ -13,8 +13,6 @@
import com.mapzen.android.lost.api.LocationServices;
import com.mapzen.android.lost.api.LostApiClient;

import java.lang.ref.WeakReference;

import timber.log.Timber;

/**
Expand All @@ -35,40 +33,24 @@
public class LocationSource extends LocationEngine implements
LostApiClient.ConnectionCallbacks, LocationListener {

private static LocationEngine instance;

private WeakReference<Context> context;
private Context context;
private LostApiClient lostApiClient;

private LocationSource(Context context) {
public LocationSource(Context context) {
super();
this.context = new WeakReference<>(context);
lostApiClient = new LostApiClient.Builder(this.context.get())
this.context = context.getApplicationContext();
lostApiClient = new LostApiClient.Builder(this.context)
.addConnectionCallbacks(this)
.build();
}

/**
* Get the LocationEngine instance.
*
* @param context a Context from which the application context is derived
* @return the LocationEngine instance
*/
public static synchronized LocationEngine getLocationEngine(@NonNull Context context) {
if (instance == null) {
instance = new LocationSource(context.getApplicationContext());
}

return instance;
}

/**
* Activate the location engine which will connect whichever location provider you are using. You'll need to call
* this before requesting user location updates using {@link LocationEngine#requestLocationUpdates()}.
*/
@Override
public void activate() {
if (lostApiClient != null && !lostApiClient.isConnected()) {
if (!lostApiClient.isConnected()) {
lostApiClient.connect();
}
}
Expand All @@ -80,7 +62,7 @@ public void activate() {
*/
@Override
public void deactivate() {
if (lostApiClient != null && lostApiClient.isConnected()) {
if (lostApiClient.isConnected()) {
lostApiClient.disconnect();
}
}
Expand Down Expand Up @@ -120,8 +102,9 @@ public void onConnectionSuspended() {
* @return the last known location
*/
@Override
@Nullable
public Location getLastLocation() {
if (lostApiClient.isConnected() && PermissionsManager.areLocationPermissionsGranted(context.get())) {
if (lostApiClient.isConnected() && PermissionsManager.areLocationPermissionsGranted(context)) {
//noinspection MissingPermission
return LocationServices.FusedLocationApi.getLastLocation(lostApiClient);
}
Expand Down Expand Up @@ -151,7 +134,7 @@ public void requestLocationUpdates() {
request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}

if (lostApiClient.isConnected() && PermissionsManager.areLocationPermissionsGranted(context.get())) {
if (lostApiClient.isConnected() && PermissionsManager.areLocationPermissionsGranted(context)) {
//noinspection MissingPermission
LocationServices.FusedLocationApi.requestLocationUpdates(lostApiClient, request, this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
// cancel any animation
transform.cancelTransitions();

cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

// tilt results in a bigger translation, limiting input for #5281
double tilt = transform.getTilt();
double tiltFactor = 1 + ((tilt != 0) ? (tilt / 10) : 0); /* 1 -> 7 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.location.LocationSource;
import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings;
import com.mapbox.mapboxsdk.style.layers.Filter;
import com.mapbox.mapboxsdk.style.layers.Layer;
Expand Down Expand Up @@ -141,12 +140,20 @@ void onSaveInstanceState(Bundle outState) {
*/
void onRestoreInstanceState(Bundle savedInstanceState) {
final CameraPosition cameraPosition = savedInstanceState.getParcelable(MapboxConstants.STATE_CAMERA_POSITION);
if (cameraPosition != null) {
moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder(cameraPosition).build()));
}

uiSettings.onRestoreInstanceState(savedInstanceState);
trackingSettings.onRestoreInstanceState(savedInstanceState);

if (cameraPosition != null) {
easeCamera(CameraUpdateFactory.newCameraPosition(
new CameraPosition.Builder(cameraPosition).build()),
0,
false,
null,
!trackingSettings.isLocationTrackingDisabled()
);
}

nativeMapView.setDebug(savedInstanceState.getBoolean(MapboxConstants.STATE_DEBUG_ACTIVE));

final String styleUrl = savedInstanceState.getString(MapboxConstants.STATE_STYLE_URL);
Expand Down Expand Up @@ -1864,8 +1871,6 @@ public void setOnMyLocationChangeListener(@Nullable MapboxMap.OnMyLocationChange
* Replaces the location source of the my-location layer.
*
* @param locationSource A {@link LocationEngine} location source to use in the my-location layer.
* Set to null to use the default {@link LocationSource}
* location source.
*/
@UiThread
public void setLocationSource(@Nullable LocationEngine locationSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;

import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.constants.MyBearingTracking;
import com.mapbox.mapboxsdk.constants.MyLocationTracking;
import com.mapbox.mapboxsdk.location.LocationSource;
import com.mapbox.mapboxsdk.maps.widgets.MyLocationView;
import com.mapbox.services.android.telemetry.location.LocationEngine;
import com.mapbox.services.android.telemetry.location.LocationEngineListener;
Expand All @@ -29,6 +29,8 @@ public final class TrackingSettings {
private final CameraZoomInvalidator zoomInvalidator;
private LocationEngine locationSource;
private LocationEngineListener myLocationListener;
private boolean locationChangeAnimationEnabled = true;
private boolean isCustomLocationSource;

private boolean myLocationEnabled;
private boolean dismissLocationTrackingOnGesture = true;
Expand All @@ -46,7 +48,7 @@ public final class TrackingSettings {
}

void initialise(MapboxMapOptions options) {
locationSource = LocationSource.getLocationEngine(myLocationView.getContext());
locationSource = Mapbox.getLocationSource();
setMyLocationEnabled(options.getLocationEnabled());
}

Expand All @@ -56,11 +58,16 @@ void onSaveInstanceState(Bundle outState) {
outState.putBoolean(MapboxConstants.STATE_MY_LOCATION_TRACKING_DISMISS, isDismissLocationTrackingOnGesture());
outState.putBoolean(MapboxConstants.STATE_MY_BEARING_TRACKING_DISMISS, isDismissBearingTrackingOnGesture());
outState.putBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED, isMyLocationEnabled());
outState.putBoolean(MapboxConstants.STATE_LOCATION_CHANGE_ANIMATION_ENABLED, isLocationChangeAnimationEnabled());
outState.putBoolean(MapboxConstants.STATE_USING_CUSTOM_LOCATION_SOURCE, isCustomLocationSource());
}

void onRestoreInstanceState(Bundle savedInstanceState) {
try {
setMyLocationEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED));
setMyLocationEnabled(
savedInstanceState.getBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED),
savedInstanceState.getBoolean(MapboxConstants.STATE_USING_CUSTOM_LOCATION_SOURCE)
);
} catch (SecurityException ignore) {
// User did not accept location permissions
}
Expand All @@ -74,6 +81,8 @@ void onRestoreInstanceState(Bundle savedInstanceState) {
MapboxConstants.STATE_MY_LOCATION_TRACKING_DISMISS, true));
setDismissBearingTrackingOnGesture(savedInstanceState.getBoolean(
MapboxConstants.STATE_MY_BEARING_TRACKING_DISMISS, true));
setLocationChangeAnimationEnabled(savedInstanceState.getBoolean(
MapboxConstants.STATE_LOCATION_CHANGE_ANIMATION_ENABLED, true));
}

/**
Expand All @@ -91,6 +100,7 @@ void onRestoreInstanceState(Bundle savedInstanceState) {
*/
@UiThread
public void setMyLocationTrackingMode(@MyLocationTracking.Mode int myLocationTrackingMode) {
myLocationView.setLocationChangeAnimationEnabled(isLocationChangeAnimationEnabled());
myLocationView.setMyLocationTrackingMode(myLocationTrackingMode);

if (myLocationTrackingMode == MyLocationTracking.TRACKING_FOLLOW) {
Expand Down Expand Up @@ -253,6 +263,26 @@ public boolean isScrollGestureCurrentlyEnabled() {
|| myLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE);
}

/**
* Returns whether location change animation is applied for {@link MyLocationTracking#TRACKING_FOLLOW}.
*
* @return True if animation is applied, false otherwise.
*/
public boolean isLocationChangeAnimationEnabled() {
return locationChangeAnimationEnabled;
}

/**
* Set whether location change animation should be applied for {@link MyLocationTracking#TRACKING_FOLLOW}.
*
* @param locationChangeAnimationEnabled True if animation should be applied, false otherwise.
*/
public void setLocationChangeAnimationEnabled(boolean locationChangeAnimationEnabled) {
this.locationChangeAnimationEnabled = locationChangeAnimationEnabled;

myLocationView.setLocationChangeAnimationEnabled(locationChangeAnimationEnabled);
}

/**
* Reset the tracking modes as necessary. Location tracking is reset if the map center is changed and not from
* location, bearing tracking if there is a rotation.
Expand Down Expand Up @@ -314,6 +344,10 @@ public void onLocationChanged(Location location) {
}
}

public boolean isCustomLocationSource() {
return isCustomLocationSource;
}

void setOnMyLocationTrackingModeChangeListener(MapboxMap.OnMyLocationTrackingModeChangeListener listener) {
this.onMyLocationTrackingModeChangeListener = listener;
}
Expand All @@ -332,16 +366,30 @@ boolean isMyLocationEnabled() {
}

void setMyLocationEnabled(boolean locationEnabled) {
setMyLocationEnabled(locationEnabled, isCustomLocationSource());
}

private void setMyLocationEnabled(boolean locationEnabled, boolean isCustomLocationSource) {
if (!PermissionsManager.areLocationPermissionsGranted(myLocationView.getContext())) {
Timber.e("Could not activate user location tracking: "
+ "user did not accept the permission or permissions were not requested.");
return;
}
myLocationEnabled = locationEnabled;
myLocationView.setEnabled(locationEnabled);
this.isCustomLocationSource = isCustomLocationSource;
myLocationView.setEnabled(locationEnabled, isCustomLocationSource);
}

void setLocationSource(LocationEngine locationSource) {
if (this.locationSource != null && this.locationSource.equals(locationSource)) {
// this source is already active
return;
}

this.isCustomLocationSource = locationSource != null;
if (locationSource == null) {
locationSource = Mapbox.getLocationSource();
}
this.locationSource = locationSource;
myLocationView.setLocationSource(locationSource);
}
Expand Down
Loading