use of com.google.android.gms.maps.model.LatLngBounds in project collect by opendatakit.
the class GeoShapeGoogleMapActivity method zoomToBounds.
private void zoomToBounds() {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (Marker marker : markerArray) {
builder.include(marker.getPosition());
}
LatLngBounds bounds = builder.build();
// offset from edges of the map in pixels
int padding = 200;
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
map.animateCamera(cu);
}
}, 100);
}
use of com.google.android.gms.maps.model.LatLngBounds in project collect by opendatakit.
the class GeoTraceGoogleMapActivity method zoomToBounds.
private void zoomToBounds() {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (Marker marker : markerArray) {
builder.include(marker.getPosition());
}
LatLngBounds bounds = builder.build();
// offset from edges of the map in pixels
int padding = 200;
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
map.animateCamera(cu);
}
}, 100);
}
use of com.google.android.gms.maps.model.LatLngBounds in project IITB-App by wncc.
the class MapFragment method onMapReady.
@Override
public void onMapReady(GoogleMap gMap) {
googleMap = gMap;
if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
checkLocationPermission();
} else {
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(false);
}
locationButton.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#FFFFFF")));
// Initialize Google Play Services
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
// Location Permission already granted
buildGoogleApiClient();
googleMap.setMyLocationEnabled(true);
} else {
// Request Location Permission
checkLocationPermission();
}
} else {
buildGoogleApiClient();
googleMap.setMyLocationEnabled(true);
}
googleMap.getUiSettings().setZoomGesturesEnabled(true);
LatLngBounds iitbBounds = new LatLngBounds(new LatLng(19.1249000, 72.9046000), new LatLng(19.143522, 72.920000));
googleMap.setLatLngBoundsForCameraTarget(iitbBounds);
googleMap.setMaxZoomPreference(30);
googleMap.setMinZoomPreference(14.5f);
// Position the map's camera near Mumbai
LatLng iitb = new LatLng(19.1334, 72.9133);
googleMap.addMarker(new MarkerOptions().position(iitb).title("Marker in IITB"));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(iitb));
}
use of com.google.android.gms.maps.model.LatLngBounds in project HikingApp by wickhama.
the class CustomMapFragment method moveCameraToTrail.
public void moveCameraToTrail() {
if (mBuilder != null) {
LatLngBounds bounds = mBuilder.build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 200));
}
}
use of com.google.android.gms.maps.model.LatLngBounds in project android-samples by googlemaps.
the class MarkerCloseInfoWindowOnRetapDemoActivity method onMapReady.
@Override
public void onMapReady(GoogleMap map) {
mMap = map;
// Hide the zoom controls.
mMap.getUiSettings().setZoomControlsEnabled(false);
// Add lots of markers to the map.
addMarkersToMap();
// Set listener for marker click event. See the bottom of this class for its behavior.
mMap.setOnMarkerClickListener(this);
// Set listener for map click event. See the bottom of this class for its behavior.
mMap.setOnMapClickListener(this);
// Override the default content description on the view, for accessibility mode.
// Ideally this string would be localized.
map.setContentDescription("Demo showing how to close the info window when the currently" + " selected marker is re-tapped.");
LatLngBounds bounds = new LatLngBounds.Builder().include(PERTH).include(SYDNEY).include(ADELAIDE).include(BRISBANE).include(MELBOURNE).build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 50));
}
Aggregations