Skip to content

Commit

Permalink
Prepare for Android 10.3.0 release (#2135)
Browse files Browse the repository at this point in the history
Co-authored-by: Dilshodbek <jumabaevdilshodbek@gmail.com>
Co-authored-by: Helium314 <helium314@mailbox.org>
Co-authored-by: Ovidiu Voda <ovi.voda@gmail.com>
Co-authored-by: Robin <boldtrn@users.noreply.github.com>
  • Loading branch information
5 people authored Mar 13, 2024
1 parent b76b9e9 commit c09fc51
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 10 deletions.
10 changes: 9 additions & 1 deletion platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ MapLibre welcomes participation and contributions from everyone. Please read [`C

### ✨ Features and improvements

### 🐞 Bug fixes

## 10.3.0

### ✨ Features and improvements

* Add support for the [`slice` expression](https://maplibre.org/maplibre-style-spec/expressions/#slice) ([#1133](https://github.com/maplibre/maplibre-native/pull/1133))
* Add support for [index-of expression](https://maplibre.org/maplibre-style-spec/expressions/#index-of) ([#1113](https://github.com/maplibre/maplibre-native/pull/1113))
* Change to a more natural fling animation and allow setting `flingThreshold` and `flingAnimationBaseTime` in `UiSettings` ([#963](https://github.com/maplibre/maplibre-native/pull/963))

### 🐞 Bug fixes

### ⛵ Dependencies
* Fix regression in CameraUpdateFactory#zoomOut ([#1035](https://github.com/maplibre/maplibre-native/pull/1035))
* `AndroidLocationEngineImpl` made public to create custom `LocationEngineProvider`([#850](https://github.com/maplibre/maplibre-native/pull/850))

## 10.2.0 - May 10, 2023

Expand Down
2 changes: 1 addition & 1 deletion platform/android/MapboxGLAndroidSDK/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=10.0.1
VERSION_NAME=10.3.0

# Only build native dependencies for the current ABI
# See https://code.google.com/p/android/issues/detail?id=221098#c20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void NativeMapView::moveBy(jni::JNIEnv&, jni::jdouble dx, jni::jdouble dy, jni::
mbgl::AnimationOptions animationOptions;
if (duration > 0) {
animationOptions.duration.emplace(mbgl::Milliseconds(duration));
animationOptions.easing.emplace(mbgl::util::UnitBezier {0.25, 0.46, 0.45, 0.94});
animationOptions.easing.emplace(mbgl::util::UnitBezier {0.1, 0.4, 0.35, 1.0});
}
map->moveBy({dx, dy}, animationOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng
import com.mapbox.mapboxsdk.geometry.LatLngBounds
import com.mapbox.mapboxsdk.maps.MapboxMap
import timber.log.Timber
import java.lang.Double.min
import java.lang.Double.max
import java.util.Arrays

/**
Expand Down Expand Up @@ -448,7 +448,7 @@ object CameraUpdateFactory {
return when (type) {
ZOOM_IN -> currentZoomArg + 1
ZOOM_OUT -> {
min(currentZoomArg - 1, 0.0)
max(currentZoomArg - 1, 0.0)
}

ZOOM_TO -> zoom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,19 +419,25 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve

// calculate velocity vector for xy dimensions, independent from screen size
double velocityXY = Math.hypot(velocityX / screenDensity, velocityY / screenDensity);
if (velocityXY < MapboxConstants.VELOCITY_THRESHOLD_IGNORE_FLING) {
if (velocityXY < uiSettings.getFlingThreshold()) {
// ignore short flings, these can occur when other gestures just have finished executing
return false;
}

// tilt results in a bigger translation, limiting input for #5281
double tilt = transform.getTilt();
double tiltFactor = 1.5 + ((tilt != 0) ? (tilt / 10) : 0);
double offsetX = velocityX / tiltFactor / screenDensity;
double offsetY = velocityY / tiltFactor / screenDensity;

// calculate animation time based on displacement
long animationTime = (long) (velocityXY / 7 / tiltFactor + MapboxConstants.ANIMATION_DURATION_FLING_BASE);
long animationTime = (long) (velocityXY / 7 / tiltFactor + uiSettings.getFlingAnimationBaseTime());

// screenDensity and influcentcetilt come in here via animationTime
// factor 1000 because speed is in pixels/s
// and the factor 0.28 was determined by testing: panning the map and releasing
// should result in fling animation starting at same speed as the move before
double offsetX = velocityX * animationTime * 0.28 / 1000;
double offsetY = velocityY * animationTime * 0.28 / 1000;

if (!uiSettings.isHorizontalScrollGesturesEnabled()) {
// determine if angle of fling is valid for performing a vertical fling
double angle = Math.abs(Math.toDegrees(Math.atan(offsetX / offsetY)));
Expand Down Expand Up @@ -1154,4 +1160,4 @@ void setGesturesManager(@NonNull Context context, @NonNull AndroidGesturesManage
initializeGesturesManager(gesturesManager, setDefaultMutuallyExclusives);
initializeGestureListeners(context, attachDefaultListeners);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public final class UiSettings {

private boolean deselectMarkersOnTap = true;

private long flingAnimationBaseTime = MapboxConstants.ANIMATION_DURATION_FLING_BASE;
private long flingThreshold = MapboxConstants.VELOCITY_THRESHOLD_IGNORE_FLING;

@Nullable
private PointF userProvidedFocalPoint;

Expand Down Expand Up @@ -316,6 +319,22 @@ private void restoreAttribution(Bundle savedInstanceState) {
savedInstanceState.getInt(MapboxConstants.STATE_ATTRIBUTION_MARGIN_BOTTOM));
}

public long getFlingAnimationBaseTime() {
return flingAnimationBaseTime;
}

public long getFlingThreshold() {
return flingThreshold;
}

public void setFlingAnimationBaseTime(long t) {
flingAnimationBaseTime = t;
}

public void setFlingThreshold(long t) {
flingThreshold = t;
}

/**
* <p>
* Enables or disables the compass. The compass is an icon on the map that indicates the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ class OfflineManager private constructor(context: Context) {
* @return the single instance of offline manager
*/
@Synchronized
@JvmStatic
fun getInstance(context: Context): OfflineManager {
if (instance == null) {
instance = OfflineManager(context)
Expand Down

0 comments on commit c09fc51

Please sign in to comment.