Java Code Examples for com.google.android.gms.maps.GoogleMap#setOnCameraIdleListener()

The following examples show how to use com.google.android.gms.maps.GoogleMap#setOnCameraIdleListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GoogleMapsMapAdapter.java    From ground-android with Apache License 2.0 6 votes vote down vote up
public GoogleMapsMapAdapter(GoogleMap map, Context context, MarkerIconFactory markerIconFactory) {
  this.map = map;
  this.context = context;
  this.markerIconFactory = markerIconFactory;
  map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
  UiSettings uiSettings = map.getUiSettings();
  uiSettings.setRotateGesturesEnabled(false);
  uiSettings.setTiltGesturesEnabled(false);
  uiSettings.setMyLocationButtonEnabled(false);
  uiSettings.setMapToolbarEnabled(false);
  uiSettings.setCompassEnabled(false);
  uiSettings.setIndoorLevelPickerEnabled(false);
  map.setOnMarkerClickListener(this::onMarkerClick);
  map.setOnCameraIdleListener(this::onCameraIdle);
  map.setOnCameraMoveStartedListener(this::onCameraMoveStarted);
  map.setOnCameraMoveListener(this::onCameraMove);
  onCameraMove();
}
 
Example 2
Source File: MapsActivity.java    From google-maps-clustering with Apache License 2.0 5 votes vote down vote up
@Override
public void onMapReady(final GoogleMap googleMap) {
    googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {
            googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(NETHERLANDS, 0));
        }
    });

    ClusterManager<SampleClusterItem> clusterManager = new ClusterManager<>(this, googleMap);
    clusterManager.setCallbacks(new ClusterManager.Callbacks<SampleClusterItem>() {
        @Override
        public boolean onClusterClick(@NonNull Cluster<SampleClusterItem> cluster) {
            Log.d(TAG, "onClusterClick");
            return false;
        }

        @Override
        public boolean onClusterItemClick(@NonNull SampleClusterItem clusterItem) {
            Log.d(TAG, "onClusterItemClick");
            return false;
        }
    });
    googleMap.setOnCameraIdleListener(clusterManager);

    List<SampleClusterItem> clusterItems = new ArrayList<>();
    for (int i = 0; i < 20000; i++) {
        clusterItems.add(new SampleClusterItem(
                RandomLocationGenerator.generate(NETHERLANDS)));
    }
    clusterManager.setItems(clusterItems);
}
 
Example 3
Source File: ObservationEditActivity.java    From mage-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onMapReady(GoogleMap map) {
	this.map = map;
	map.getUiSettings().setZoomControlsEnabled(false);

	mapObservationManager = new MapObservationManager(this, map);
	map.setOnCameraIdleListener(this);
}
 
Example 4
Source File: ObservationViewActivity.java    From mage-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onMapReady(GoogleMap map) {
	this.map = map;
	mapObservationManager = new MapObservationManager(this, map);
	map.setOnCameraIdleListener(this);
}
 
Example 5
Source File: CameraClampingDemoActivity.java    From android-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onMapReady(GoogleMap map) {
    mMap = map;
    map.setOnCameraIdleListener(this);
}