use of com.mapbox.mapboxsdk.camera.CameraPosition in project osm-contributor by jawg.
the class MapFragment method onResume.
@Override
public void onResume() {
super.onResume();
mapView.onResume();
if (mapboxMap != null) {
switchMode(MapMode.DEFAULT);
presenter.setForceRefreshPoi();
presenter.setForceRefreshNotes();
presenter.loadPoisIfNeeded();
nextTuto(2);
double lat = sharedPreferences.getFloat("latitude", 0);
double lon = sharedPreferences.getFloat("longitude", 0);
if (lat != 0 && lon != 0) {
CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(lat, lon)).zoom(mapboxMap.getCameraPosition().zoom).build();
mapboxMap.setCameraPosition(cameraPosition);
} else {
getUserLocation();
}
}
}
use of com.mapbox.mapboxsdk.camera.CameraPosition in project osm-contributor by jawg.
the class MapFragment method changeMapZoomSmooth.
public void changeMapZoomSmooth(final double zoom, final OnZoomAnimationFinishedListener onZoomAnimationFinishedListener) {
mapboxMap.easeCamera(new CameraUpdate() {
@Override
public CameraPosition getCameraPosition(@NonNull MapboxMap mapboxMap) {
return new CameraPosition.Builder().target(mapboxMap.getCameraPosition().target).zoom(zoom).build();
}
}, 700);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
onZoomAnimationFinishedListener.onZoomAnimationFinished();
}
}, 750);
}
use of com.mapbox.mapboxsdk.camera.CameraPosition in project androidApp by InspectorIncognito.
the class MapboxUtil method animateCameraToSelection.
public static void animateCameraToSelection(Feature feature, double newZoom, AnimatorSet animatorSet, MapboxMap mapboxMap) {
CameraPosition cameraPosition = mapboxMap.getCameraPosition();
if (animatorSet != null) {
animatorSet.cancel();
}
animatorSet = new AnimatorSet();
animatorSet.playTogether(createLatLngAnimator(cameraPosition.target, convertToLatLng(feature), mapboxMap), createZoomAnimator(cameraPosition.zoom, newZoom, mapboxMap));
animatorSet.start();
}
use of com.mapbox.mapboxsdk.camera.CameraPosition in project androidApp by InspectorIncognito.
the class MapboxUtil method animateCameraToSelection.
public static void animateCameraToSelection(Feature feature, AnimatorSet animatorSet, MapboxMap mapboxMap) {
CameraPosition cameraPosition = mapboxMap.getCameraPosition();
if (animatorSet != null) {
animatorSet.cancel();
}
animatorSet = new AnimatorSet();
animatorSet.play(createLatLngAnimator(cameraPosition.target, convertToLatLng(feature), mapboxMap));
animatorSet.start();
}
use of com.mapbox.mapboxsdk.camera.CameraPosition in project androidApp by InspectorIncognito.
the class VectorSearchMapFragment method zoomBound.
private void zoomBound(LatLng currentLocation) {
LatLngBounds.Builder latLngBoundsBuilder = new LatLngBounds.Builder();
latLngBoundsBuilder.includes(routeHelper.getRouteI());
latLngBoundsBuilder.include(currentLocation);
CameraUpdate update = CameraUpdateFactory.newLatLngBounds(latLngBoundsBuilder.build(), 100, 100, 100, 100);
CameraPosition cameraPosition = update.getCameraPosition(mapboxMap);
if (cameraPosition == null) {
return;
}
mapboxMap.setCameraPosition(cameraPosition);
}
Aggregations