private void setUpMap() { verifyLocationPermission(); mMap.setOnMapClickListener(this); mMap.setOnInfoWindowClickListener(this); UiSettings settings = mMap.getUiSettings(); settings.setAllGesturesEnabled(true); settings.setMapToolbarEnabled(false); // Use stops location if present, otherwise set a geo point in // central Stockholm. LatLng latLng; int zoom; if (mStop.getLocation() != null) { latLng = new LatLng(mStop.getLocation().getLatitude(), mStop.getLocation().getLongitude()); zoom = 16; } else { latLng = new LatLng(59.325309, 18.069763); zoom = 12; } mMarker = mMap.addMarker( new MarkerOptions() .position(latLng) .title(getString(R.string.tap_to_select_this_point)) .visible(true) .draggable(true) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))); mMarker.showInfoWindow(); mMap.moveCamera( CameraUpdateFactory.newCameraPosition(CameraPosition.fromLatLngZoom(latLng, zoom))); }
public GoogleCameraPositionDelegate(@NonNull final OPFLatLng target, final float zoom) { this.cameraPosition = CameraPosition.fromLatLngZoom(new LatLng(target.getLat(), target.getLng()), zoom); }