/** * Called when the Animate To "Go To Analog Stick" button is clicked. */ public void onGoToVrController(View view) { if (!checkReady()) { return; } changeCamera(CameraUpdateFactory.newCameraPosition(vrControllerCameraPos), new CancelableCallback() { @Override public void onFinish() { Toast.makeText(getBaseContext(), "Animation to Analog Stick complete", Toast.LENGTH_SHORT) .show(); } @Override public void onCancel() { Toast.makeText(getBaseContext(), "Animation to Analog Stick canceled", Toast.LENGTH_SHORT) .show(); } }); }
@Override public boolean onMyLocationButtonClick() { if (location != null) { LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); float zoom = map.getCameraPosition().zoom < 15 ? 15 : map.getCameraPosition().zoom; map.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom), new CancelableCallback() { @Override public void onCancel() { mapWrapper.setOnMapPanListener(MapFragment.this); followMe = true; } @Override public void onFinish() { mapWrapper.setOnMapPanListener(MapFragment.this); followMe = true; } }); } return true; }
public void setLocation(final double latitude, final double longitude, final int zoom) { CameraUpdate update; if (-1 == zoom) { update = CameraUpdateFactory.newLatLng(new LatLng(latitude, longitude)); } else { update = CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), zoom); } mMap.animateCamera(update, 1000, new CancelableCallback() { @Override public void onFinish() { completeSetLocation(latitude, longitude, zoom); } @Override public void onCancel() { } }); }
/** * Called when the Animate To Sydney button is clicked. */ public void onGoToSydney(View view) { if (!checkReady()) { return; } changeCamera(CameraUpdateFactory.newCameraPosition(SYDNEY), new CancelableCallback() { @Override public void onFinish() { Toast.makeText(getBaseContext(), "Animation to Sydney complete", Toast.LENGTH_SHORT) .show(); } @Override public void onCancel() { Toast.makeText(getBaseContext(), "Animation to Sydney canceled", Toast.LENGTH_SHORT) .show(); } }); }
/** * Change the camera position by moving or animating the camera depending on the state of the * animate toggle button. */ private void changeCamera(CameraUpdate update, CancelableCallback callback) { boolean animated = ((CompoundButton) findViewById(R.id.animate)).isChecked(); if (animated) { mMap.animateCamera(update, callback); } else { mMap.moveCamera(update); } }
@Override public void onMapReady(GoogleMap googleMap) { map = googleMap; map.setMapType(GoogleMap.MAP_TYPE_NONE); map.setOnInfoWindowClickListener(this); map.setOnMapClickListener(this); map.setOnMarkerClickListener(this); map.setOnMapLongClickListener(this); LatLng latLng = new LatLng(0.0, 0.0); float zoom = map.getCameraPosition().zoom < 1 ? 1 : map.getCameraPosition().zoom; map.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom), new CancelableCallback() { @Override public void onCancel() { // TODO } @Override public void onFinish() { // TODO } }); offlineMap = new OfflineMap(map); offlineMap.setVisible(true); geoPackageMapOverlays = new GeoPackageMapOverlays(getActivity(), mapView, map); refreshMapMarkers(); }
/** * Change the camera position by moving or animating the camera depending on the state of the * animate toggle button. */ private void changeCamera(CameraUpdate update, CancelableCallback callback) { if (mAnimateToggle.isChecked()) { if (mCustomDurationToggle.isChecked()) { int duration = mCustomDurationBar.getProgress(); // The duration must be strictly positive so we make it at least 1. mMap.animateCamera(update, Math.max(duration, 1), callback); } else { mMap.animateCamera(update, callback); } } else { mMap.moveCamera(update); } }
/** * Change the camera position by moving or animating the camera depending on * input parameter. */ private void changeCamera(CameraUpdate update, CancelableCallback callback, boolean instant) { if (instant) { mMap.animateCamera(update, 1, callback); } else { mMap.animateCamera(update, 4000, callback); } }
public boolean showMarkerInfoWindow(ContactsItem contact, boolean animate) { if (mMap == null || contact == null) { return false; } final Marker marker = mContactMarkerHashMap.get(contact.hashCode()); if (marker == null) { return false; } if (animate) { mMap.animateCamera( CameraUpdateFactory.newCameraPosition( new CameraPosition.Builder() .target(marker.getPosition()) .zoom(15.5f) .build() ), new CancelableCallback() { @Override public void onCancel() { } @Override public void onFinish() { marker.showInfoWindow(); } } ); } else { marker.showInfoWindow(); } return true; }
/** * Show the InfoWindow for the passed Marker and ClusterPoint * * @param marker * @param clusterPoint */ public void showInfoWindow(Marker marker, ClusterPoint clusterPoint) { GoogleMap map = mapRef.get(); if (map != null && marker != null && clusterPoint != null) { long dirtyUntil = System.currentTimeMillis() + options.getShowInfoWindowAnimationDuration(); innerCallbackListener.clusteringOnCameraChangeListener.setDirty(dirtyUntil); CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLng(marker.getPosition()); map.animateCamera(cameraUpdate, options.getShowInfoWindowAnimationDuration(), new CancelableCallback() { @Override public void onFinish() { innerCallbackListener.handler.post(new Runnable() { @Override public void run() { innerCallbackListener.clusteringOnCameraChangeListener.setDirty(0); } }); } @Override public void onCancel() { innerCallbackListener.clusteringOnCameraChangeListener.setDirty(0); } }); marker.showInfoWindow(); } }
@Override public final void animateCamera(CameraUpdate update, CancelableCallback callback) { map.animateCamera(update, callback); }
@Override public final void animateCamera(CameraUpdate update, int durationMs, CancelableCallback callback) { map.animateCamera(update, durationMs, callback); }
public void animateCamera(CameraUpdate update, CancelableCallback callback){ this.map.animateCamera(update, callback); }
public void animateCamera(CameraUpdate update, int durationMs, CancelableCallback callback){ this.map.animateCamera(update, durationMs, callback); }
@Override public void OnDirectionListReceived(List<LatLng> mPointList) { if (mPointList != null) { PolylineOptions rectLine = new PolylineOptions().width(10).color( Color.RED); for (int i = 0; i < mPointList.size(); i++) { rectLine.add(mPointList.get(i)); } mMap.addPolyline(rectLine); CameraPosition mCPFrom = new CameraPosition.Builder() .target(startPosition).zoom(15.5f).bearing(0).tilt(25) .build(); final CameraPosition mCPTo = new CameraPosition.Builder() .target(destinationPosition).zoom(15.5f).bearing(0) .tilt(50).build(); changeCamera(CameraUpdateFactory.newCameraPosition(mCPFrom), new CancelableCallback() { @Override public void onFinish() { changeCamera(CameraUpdateFactory .newCameraPosition(mCPTo), new CancelableCallback() { @Override public void onFinish() { LatLngBounds bounds = new LatLngBounds.Builder() .include(startPosition) .include( destinationPosition) .build(); changeCamera( CameraUpdateFactory .newLatLngBounds( bounds, 50), null, false); } @Override public void onCancel() { } }, false); } @Override public void onCancel() { } }, true); } }
/** * Change the camera position by moving or animating the camera depending on the state of the * animate toggle button. */ private void changeCamera(CameraUpdate update, CancelableCallback callback) { mMap.moveCamera(update); }
void animateCamera(CameraUpdate update, CancelableCallback callback);
void animateCamera(CameraUpdate update, int durationMs, CancelableCallback callback);