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

[android] - consitent use of milliseconds unit in java code #8578

Merged
merged 1 commit into from
Mar 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.widgets.MyLocationView;

import java.util.concurrent.TimeUnit;

import timber.log.Timber;

import static com.mapbox.mapboxsdk.maps.MapView.REGION_DID_CHANGE_ANIMATED;
Expand Down Expand Up @@ -108,7 +106,7 @@ final void easeCamera(MapboxMap mapboxMap, CameraUpdate update, int durationMs,
mapView.addOnMapChangedListener(this);
}

mapView.easeTo(cameraPosition.bearing, cameraPosition.target, getDurationNano(durationMs), cameraPosition.tilt,
mapView.easeTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt,
cameraPosition.zoom, easingInterpolator);
}
}
Expand All @@ -126,7 +124,7 @@ final void animateCamera(MapboxMap mapboxMap, CameraUpdate update, int durationM
mapView.addOnMapChangedListener(this);
}

mapView.flyTo(cameraPosition.bearing, cameraPosition.target, getDurationNano(durationMs), cameraPosition.tilt,
mapView.flyTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt,
cameraPosition.zoom);
}
}
Expand Down Expand Up @@ -161,10 +159,6 @@ void setOnCameraChangeListener(@Nullable MapboxMap.OnCameraChangeListener listen
this.onCameraChangeListener = listener;
}

private long getDurationNano(long durationMs) {
return durationMs > 0 ? TimeUnit.NANOSECONDS.convert(durationMs, TimeUnit.MILLISECONDS) : 0;
}

//
// non Camera API
//
Expand Down
4 changes: 2 additions & 2 deletions platform/android/src/native_map_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ void NativeMapView::easeTo(jni::JNIEnv&, jni::jdouble angle, jni::jdouble latitu
}

mbgl::AnimationOptions animationOptions;
animationOptions.duration.emplace(mbgl::Duration(duration));
animationOptions.duration.emplace(mbgl::Milliseconds(duration));
if (!easing) {
// add a linear interpolator instead of easing
animationOptions.easing.emplace(mbgl::util::UnitBezier { 0, 0, 1, 1 });
Expand All @@ -421,7 +421,7 @@ void NativeMapView::flyTo(jni::JNIEnv&, jni::jdouble angle, jni::jdouble latitud
}

mbgl::AnimationOptions animationOptions;
animationOptions.duration.emplace(mbgl::Duration(duration));
animationOptions.duration.emplace(mbgl::Milliseconds(duration));
map->flyTo(cameraOptions, animationOptions);
}

Expand Down