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

Commit

Permalink
[android] Release android-v5.1.0-beta.2 (#8976)
Browse files Browse the repository at this point in the history
* [android] url getter on sources

* [android] fix ui test filter in makefile

* [android] - build SNAPSHOT from release branch (#8958)

* [android] - update changelog for 5.1.0-beta.2

* [android] - bump version number

* [android] - Camera change listener v2.0

* [core] allow filesource url transform reset

* [android] Update attribution wordmark (#8774)

* Update wordmark on android

* Moved attribution i icon to the right of mapbox word (in mapview preview image)

* update padding and margin

* [android] update hardcoded branch name

* revert version to 5.1.0-SNAPSHOT
  • Loading branch information
tobrun authored and zugaldia committed May 12, 2017
1 parent 886bf25 commit a68788a
Show file tree
Hide file tree
Showing 33 changed files with 468 additions and 99 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ run-android-ui-test-$1: platform/android/configuration.gradle

run-android-ui-test-$1-%: platform/android/configuration.gradle
adb uninstall com.mapbox.mapboxsdk.testapp > /dev/null
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=$2 :MapboxGLAndroidSDKTestApp:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class="$*"
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=$2 :MapboxGLAndroidSDKTestApp:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class="$$*"

endef

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ jobs:
- deploy:
name: Publish to Maven
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then make run-android-upload-archives ; fi
if [ "${CIRCLE_BRANCH}" == "release-android-v5.1.0-beta.2" ]; then make run-android-upload-archives ; fi
28 changes: 26 additions & 2 deletions platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,35 @@
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

* Update attribution with new Mapbox wordmark [#8774](https://github.com/mapbox/mapbox-gl-native/pull/8774)

## 5.1.0-beta.2 - May 12, 2017

5.1.0-beta.2 builds further on 5.1.0-beta.1 and adds:

* When a layer is added, reload its source's tiles [#8963](https://github.com/mapbox/mapbox-gl-native/pull/8963)
* Update release script to support CircleCI builds [#8950](https://github.com/mapbox/mapbox-gl-native/pull/8950)
* URL getter on Sources [#8959](https://github.com/mapbox/mapbox-gl-native/pull/8959)
* Build SNAPSHOT from release branch CI configuration [#8958](https://github.com/mapbox/mapbox-gl-native/pull/8958)
* Fix UI test filter in Makefile [#8960](https://github.com/mapbox/mapbox-gl-native/pull/8960)
* Bump & fixup dependencies [#8921](https://github.com/mapbox/mapbox-gl-native/pull/8921)
* Ignore already deleted region [#8920](https://github.com/mapbox/mapbox-gl-native/pull/8920)
* Keep offline observer when timeout occurs [#8919](https://github.com/mapbox/mapbox-gl-native/pull/8919)
* Show error message when no browser installed [#8920](https://github.com/mapbox/mapbox-gl-native/pull/8920)
* Reset observers of removed Sources and Layers [#8900](https://github.com/mapbox/mapbox-gl-native/pull/8900)
* Only build custom layer .so for debug builds [#8885](https://github.com/mapbox/mapbox-gl-native/pull/8885)
* Update localizations [#8883](https://github.com/mapbox/mapbox-gl-native/pull/8883)
* Reset observers of removed Sources and Layers [#8862](https://github.com/mapbox/mapbox-gl-native/pull/8862)
* Remove force style cascade [#8866](https://github.com/mapbox/mapbox-gl-native/pull/8866)
* Update proguard config [#8944](https://github.com/mapbox/mapbox-gl-native/pull/8944)
* Update LOST to 2.3.0-SNAPSHOT [#8872](https://github.com/mapbox/mapbox-gl-native/pull/8872)
* Update logo [#8774](https://github.com/mapbox/mapbox-gl-native/pull/8774)
* Camera change listener v2.0 [#8644](https://github.com/mapbox/mapbox-gl-native/pull/8644)
* Allow filesource url transform reset [#8957](https://github.com/mapbox/mapbox-gl-native/pull/8957)

## 5.1.0-beta.1 - May 2, 2017

5.1.0 builds further on 5.0.2 and adds:
5.1.0-beta.1 builds further on 5.0.2 and adds:

* Support for FillExtrusionLayer [#8431](https://github.com/mapbox/mapbox-gl-native/pull/8431)
* Limit Viewport [#8622](https://github.com/mapbox/mapbox-gl-native/pull/8622)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.mapbox.mapboxsdk.maps;

import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraIdleListener;
import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveCanceledListener;
import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener;
import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveListener;

class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, MapboxMap.OnCameraMoveListener,
MapboxMap.OnCameraMoveCanceledListener, OnCameraIdleListener {

private boolean idle = true;

private OnCameraMoveStartedListener onCameraMoveStartedListener;
private OnCameraMoveCanceledListener onCameraMoveCanceledListener;
private OnCameraMoveListener onCameraMoveListener;
private OnCameraIdleListener onCameraIdleListener;

void setOnCameraMoveStartedListener(OnCameraMoveStartedListener onCameraMoveStartedListener) {
this.onCameraMoveStartedListener = onCameraMoveStartedListener;
}

void setOnCameraMoveCanceledListener(OnCameraMoveCanceledListener onCameraMoveCanceledListener) {
this.onCameraMoveCanceledListener = onCameraMoveCanceledListener;
}

void setOnCameraMoveListener(OnCameraMoveListener onCameraMoveListener) {
this.onCameraMoveListener = onCameraMoveListener;
}

void setOnCameraIdleListener(OnCameraIdleListener onCameraIdleListener) {
this.onCameraIdleListener = onCameraIdleListener;
}

@Override
public void onCameraMoveStarted(int reason) {
if (!idle) {
return;
}

idle = false;
if (onCameraMoveStartedListener != null) {
onCameraMoveStartedListener.onCameraMoveStarted(reason);
}
}

@Override
public void onCameraMove() {
if (onCameraMoveListener != null && !idle) {
onCameraMoveListener.onCameraMove();
}
}

@Override
public void onCameraMoveCanceled() {
if (onCameraMoveCanceledListener != null && !idle) {
onCameraMoveCanceledListener.onCameraMoveCanceled();
}
}

@Override
public void onCameraIdle() {
if (onCameraIdleListener != null && !idle) {
idle = true;
onCameraIdleListener.onCameraIdle();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.mapbox.services.android.telemetry.utils.MathUtils;
import com.mapbox.services.android.telemetry.utils.TelemetryUtils;

import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_API_GESTURE;

/**
* Manages gestures events on a MapView.
* <p>
Expand All @@ -35,6 +37,7 @@ final class MapGestureDetector {
private final UiSettings uiSettings;
private final TrackingSettings trackingSettings;
private final AnnotationManager annotationManager;
private final CameraChangeDispatcher cameraChangeDispatcher;

private final GestureDetectorCompat gestureDetector;
private final ScaleGestureDetector scaleGestureDetector;
Expand All @@ -56,12 +59,14 @@ final class MapGestureDetector {
private boolean scaleGestureOccurred = false;

MapGestureDetector(Context context, Transform transform, Projection projection, UiSettings uiSettings,
TrackingSettings trackingSettings, AnnotationManager annotationManager) {
TrackingSettings trackingSettings, AnnotationManager annotationManager,
CameraChangeDispatcher cameraChangeDispatcher) {
this.annotationManager = annotationManager;
this.transform = transform;
this.projection = projection;
this.uiSettings = uiSettings;
this.trackingSettings = trackingSettings;
this.cameraChangeDispatcher = cameraChangeDispatcher;

// Touch gesture detectors
gestureDetector = new GestureDetectorCompat(context, new GestureListener());
Expand Down Expand Up @@ -187,6 +192,7 @@ boolean onTouchEvent(@NonNull MotionEvent event) {
MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapDragEndEvent(
getLocationFromGesture(event.getX(), event.getY()), transform));
scrollInProgress = false;
cameraChangeDispatcher.onCameraIdle();
}

twoTap = false;
Expand Down Expand Up @@ -273,6 +279,9 @@ public boolean onDoubleTapEvent(MotionEvent e) {
break;
}

// notify camera change listener
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

// Single finger double tap
if (focalPoint != null) {
// User provided focal point
Expand Down Expand Up @@ -337,6 +346,7 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
// and ignore when a scale gesture has occurred
return false;
}
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

float screenDensity = uiSettings.getPixelRatio();

Expand All @@ -362,9 +372,7 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
long animationTime = (long) (velocityXY / 7 / tiltFactor + MapboxConstants.ANIMATION_DURATION_FLING_BASE);

// update transformation
transform.setGestureInProgress(true);
transform.moveBy(offsetX, offsetY, animationTime);
transform.setGestureInProgress(false);

if (onFlingListener != null) {
onFlingListener.onFling();
Expand All @@ -377,6 +385,10 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (!scrollInProgress) {
scrollInProgress = true;

// Cancel any animation
transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);
MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent(
getLocationFromGesture(e1.getX(), e1.getY()),
MapboxEvent.GESTURE_PAN_START, transform));
Expand All @@ -391,8 +403,6 @@ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float d

// reset tracking if needed
trackingSettings.resetTrackingModesIfRequired(true, false);
// Cancel any animation
transform.cancelTransitions();

// Scroll the map
transform.moveBy(-distanceX, -distanceY, 0 /*no duration*/);
Expand Down Expand Up @@ -446,6 +456,8 @@ public boolean onScale(ScaleGestureDetector detector) {
// If scale is large enough ignore a tap
scaleFactor *= detector.getScaleFactor();
if ((scaleFactor > 1.05f) || (scaleFactor < 0.95f)) {
// notify camera change listener
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);
zoomStarted = true;
}

Expand All @@ -465,9 +477,6 @@ public boolean onScale(ScaleGestureDetector detector) {
return false;
}

// Cancel any animation
transform.cancelTransitions();

// Gesture is a quickzoom if there aren't two fingers
quickZoom = !twoTap;

Expand Down Expand Up @@ -512,6 +521,9 @@ public boolean onRotateBegin(RotateGestureDetector detector) {
return false;
}

// notify camera change listener
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

beginTime = detector.getEventTime();
MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent(
getLocationFromGesture(detector.getFocusX(), detector.getFocusY()),
Expand All @@ -522,6 +534,7 @@ public boolean onRotateBegin(RotateGestureDetector detector) {
// Called when the fingers leave the screen
@Override
public void onRotateEnd(RotateGestureDetector detector) {
// notify camera change listener
beginTime = 0;
totalAngle = 0.0f;
started = false;
Expand Down Expand Up @@ -553,13 +566,8 @@ public boolean onRotate(RotateGestureDetector detector) {
if (!started) {
return false;
}

// Cancel any animation
transform.cancelTransitions();

// rotation constitutes translation of anything except the center of
// rotation, so cancel both location and bearing tracking if required

trackingSettings.resetTrackingModesIfRequired(true, true);

// Get rotate value
Expand Down Expand Up @@ -593,6 +601,8 @@ public boolean onShoveBegin(ShoveGestureDetector detector) {
return false;
}

// notify camera change listener
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);
beginTime = detector.getEventTime();
MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent(
getLocationFromGesture(detector.getFocusX(), detector.getFocusY()),
Expand Down Expand Up @@ -633,9 +643,6 @@ public boolean onShove(ShoveGestureDetector detector) {
return false;
}

// Cancel any animation
transform.cancelTransitions();

// Get tilt value (scale and clamp)
double pitch = transform.getTilt();
pitch -= 0.1 * detector.getShovePixelsDelta();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,24 @@ private void initialise(@NonNull final Context context, @NonNull final MapboxMap
// callback for zooming in the camera
CameraZoomInvalidator zoomInvalidator = new CameraZoomInvalidator();

// callback for camera change events
CameraChangeDispatcher cameraChangeDispatcher = new CameraChangeDispatcher();

// setup components for MapboxMap creation
Projection proj = new Projection(nativeMapView);
UiSettings uiSettings = new UiSettings(proj, focalPoint, compassView, attrView, view.findViewById(R.id.logoView));
TrackingSettings trackingSettings = new TrackingSettings(myLocationView, uiSettings, focalPoint, zoomInvalidator);
MyLocationViewSettings myLocationViewSettings = new MyLocationViewSettings(myLocationView, proj, focalPoint);
MarkerViewManager markerViewManager = new MarkerViewManager((ViewGroup) findViewById(R.id.markerViewContainer));
AnnotationManager annotations = new AnnotationManager(nativeMapView, this, markerViewManager);
Transform transform = new Transform(nativeMapView, annotations.getMarkerViewManager(), trackingSettings);
Transform transform = new Transform(nativeMapView, annotations.getMarkerViewManager(), trackingSettings,
cameraChangeDispatcher);
mapboxMap = new MapboxMap(nativeMapView, transform, uiSettings, trackingSettings, myLocationViewSettings, proj,
registerTouchListener, annotations);
registerTouchListener, annotations, cameraChangeDispatcher);

// user input
mapGestureDetector = new MapGestureDetector(context, transform, proj, uiSettings, trackingSettings, annotations);
mapGestureDetector = new MapGestureDetector(context, transform, proj, uiSettings, trackingSettings, annotations,
cameraChangeDispatcher);
mapKeyListener = new MapKeyListener(transform, trackingSettings, uiSettings);

MapZoomControllerListener zoomListener = new MapZoomControllerListener(mapGestureDetector, uiSettings, transform);
Expand Down
Loading

0 comments on commit a68788a

Please sign in to comment.