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

The following examples show how to use com.google.android.gms.maps.GoogleMap#setOnCameraChangeListener() . 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: Clusterkraf.java    From clusterkraf with Apache License 2.0 6 votes vote down vote up
/**
 * Construct a Clusterkraf instance to manage your map with customized
 * options and a list of points
 * 
 * @param map
 *            The GoogleMap to be managed by Clusterkraf
 * @param options
 *            Customized options
 */
public Clusterkraf(GoogleMap map, Options options, ArrayList<InputPoint> points) {
	this.mapRef = new WeakReference<GoogleMap>(map);
	this.options = options;
	this.innerCallbackListener = new InnerCallbackListener(this);
	this.transitionsAnimation = new ClusterTransitionsAnimation(map, options, innerCallbackListener);

	if (points != null) {
		this.points.addAll(points);
	}

	if (map != null) {
		map.setOnCameraChangeListener(innerCallbackListener.clusteringOnCameraChangeListener);
		map.setOnMarkerClickListener(innerCallbackListener);
		map.setOnInfoWindowClickListener(innerCallbackListener);
           map.setInfoWindowAdapter(innerCallbackListener);
	}

	showAllClusters();
}
 
Example 2
Source File: MapUiHandler.java    From overpasser with Apache License 2.0 5 votes vote down vote up
void setMapParams() {
    GoogleMap googleMap = fragment.getGoogleMap();
    googleMap.setMapType(MAP_TYPE_NORMAL);
    googleMap.setMyLocationEnabled(true);
    googleMap.setInfoWindowAdapter(poiInfoWindowAdapter);
    googleMap.getUiSettings().setMapToolbarEnabled(false);
    googleMap.setOnCameraChangeListener(getOnCameraChangeListener());
    resetMap();
}
 
Example 3
Source File: MainActivity.java    From xposed-gps with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	settings = new Settings(getApplicationContext());
	FragmentManager fm = getFragmentManager();
	Fragment frag = fm.findFragmentById(R.id.map);
	if (frag instanceof MapFragment) {
		MapFragment mapf = (MapFragment) frag;
		mMap = (GoogleMap) mapf.getMap();
		mMap.setOnCameraChangeListener(this);
		mMarker = new MarkerOptions();
		mInit = new LatLng(settings.getLat(), settings.getLng());
		mMarker.position(mInit);
		mMarker.draggable(true);

		CameraUpdate cam = CameraUpdateFactory.newLatLng(mInit);
		mMap.moveCamera(cam);
		mMap.addMarker(mMarker);
	}

	Button set   = (Button) findViewById(R.id.set_location);
	set.setOnClickListener(this);
	Button start = (Button) findViewById(R.id.start);
	start.setOnClickListener(this);
	Button sel   = (Button) findViewById(R.id.select_apps);
	sel.setOnClickListener(this);

	start.setText(settings.isStarted() ? getString(R.string.stop) : getString(R.string.start));
}
 
Example 4
Source File: DetailFragment.java    From animation-samples with Apache License 2.0 4 votes vote down vote up
private void setMarkers(GoogleMap googleMap) {
    final List<Detail> locations = mGallery.getDetails();
    ClusterManager<Detail> clusterManager = getClusterManager(googleMap);
    clusterManager.addItems(locations);
    googleMap.setOnCameraChangeListener(clusterManager);
}
 
Example 5
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 4 votes vote down vote up
/**
 * Event handler for when map is ready to receive update parameters.
 *
 * @param googleMap
 */
@Override
public void onMapReady(GoogleMap googleMap) {

    // Clear previous map if already there
    googleMap.clear();

    UiSettings settings = googleMap.getUiSettings();

    // Set location based flags
    if (locationManager != null) {
        settings.setMyLocationButtonEnabled(this.myLocationButton);
        googleMap.setMyLocationEnabled(this.showsUserLocation);
    }

    // Set all other flags
    settings.setScrollGesturesEnabled(this.scrollGestures);
    settings.setZoomGesturesEnabled(this.zoomGestures);
    settings.setTiltGesturesEnabled(this.tiltGestures);
    settings.setRotateGesturesEnabled(this.rotateGestures);
    settings.setCompassEnabled(this.compassButton);

    // Update the camera position
    if (cameraUpdate != null) {
        googleMap.moveCamera(cameraUpdate);
    }

    // Add the markers
    addMapMarkers(googleMap);
    googleMap.setOnMarkerClickListener(this);

    // Attach the event handlers
    if (firstMapReady) {
        googleMap.setOnCameraChangeListener(this);
        googleMap.setOnMapClickListener(this);
        googleMap.setOnMapLongClickListener(this);
        googleMap.setOnMarkerDragListener(this);
        googleMap.setOnMyLocationButtonClickListener(this);

        firstMapReady = false;
    }
}