protected void onCameraChange(CameraPosition cameraPosition, ViewPortChangeListener listener) { // If custom tile overlay is enabled, use rounded zoom to avoid // tiles blurring if (customTileOverlay != null) { int roundZoom = Math.round(cameraPosition.zoom); if (Math.abs(cameraPosition.zoom - roundZoom) > 0.01) { CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(roundZoom); googleMap.animateCamera(cameraUpdate); return; } } GeoRect viewPort = getViewPortGeoRect(); listener.onViewPortChanged(viewPort); }
@Override public void restoreMapState(MapInfo lastMapInfo) { LatLng center = new LatLng(lastMapInfo.getCenterX(), lastMapInfo.getCenterY()); CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(center, lastMapInfo.getZoom()); googleMap.moveCamera(cameraUpdate); }
@Override public void animateToGeoPoint(LatLng geoPoint) { LatLng center = new LatLng(geoPoint.latitude, geoPoint.longitude); googleMap.animateCamera(CameraUpdateFactory.newLatLng(center)); }
@Override public void animateToLocation(Location location) { LatLng center = new LatLng(location.getLongitude(), location.getLongitude()); googleMap.animateCamera(CameraUpdateFactory.newLatLng(center)); }