Search in sources :

Example 11 with CameraPosition

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();
        }
    }
}
Also used : CameraPosition(com.mapbox.mapboxsdk.camera.CameraPosition) LatLng(com.mapbox.mapboxsdk.geometry.LatLng)

Example 12 with CameraPosition

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);
}
Also used : CameraPosition(com.mapbox.mapboxsdk.camera.CameraPosition) Handler(android.os.Handler) BitmapHandler(io.jawg.osmcontributor.ui.utils.BitmapHandler) CameraUpdate(com.mapbox.mapboxsdk.camera.CameraUpdate) MapboxMap(com.mapbox.mapboxsdk.maps.MapboxMap)

Example 13 with CameraPosition

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();
}
Also used : CameraPosition(com.mapbox.mapboxsdk.camera.CameraPosition) AnimatorSet(android.animation.AnimatorSet)

Example 14 with CameraPosition

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();
}
Also used : CameraPosition(com.mapbox.mapboxsdk.camera.CameraPosition) AnimatorSet(android.animation.AnimatorSet)

Example 15 with CameraPosition

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);
}
Also used : CameraPosition(com.mapbox.mapboxsdk.camera.CameraPosition) LatLngBounds(com.mapbox.mapboxsdk.geometry.LatLngBounds) CameraUpdate(com.mapbox.mapboxsdk.camera.CameraUpdate)

Aggregations

CameraPosition (com.mapbox.mapboxsdk.camera.CameraPosition)19 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)8 MapboxMap (com.mapbox.mapboxsdk.maps.MapboxMap)4 AnimatorSet (android.animation.AnimatorSet)3 Point (com.mapbox.geojson.Point)3 CameraUpdate (com.mapbox.mapboxsdk.camera.CameraUpdate)3 LatLngBounds (com.mapbox.mapboxsdk.geometry.LatLngBounds)3 Camera (com.mapbox.services.android.navigation.v5.navigation.camera.Camera)2 ValueAnimator (android.animation.ValueAnimator)1 Intent (android.content.Intent)1 Handler (android.os.Handler)1 Parcel (android.os.Parcel)1 MotionEvent (android.view.MotionEvent)1 ScaleGestureDetector (android.view.ScaleGestureDetector)1 View (android.view.View)1 LocationEngine (com.mapbox.android.core.location.LocationEngine)1 LocationEngineProvider (com.mapbox.android.core.location.LocationEngineProvider)1 LegStep (com.mapbox.api.directions.v5.models.LegStep)1 Marker (com.mapbox.mapboxsdk.annotations.Marker)1 MapView (com.mapbox.mapboxsdk.maps.MapView)1