use of com.google.android.gms.maps.UiSettings in project android-samples by googlemaps.
the class TagsDemoActivity method onMapReady.
@Override
public void onMapReady(GoogleMap map) {
mMap = map;
UiSettings mUiSettings = mMap.getUiSettings();
// Turn off the map toolbar.
mUiSettings.setMapToolbarEnabled(false);
// Disable interaction with the map - other than clicking.
mUiSettings.setZoomControlsEnabled(false);
mUiSettings.setScrollGesturesEnabled(false);
mUiSettings.setZoomGesturesEnabled(false);
mUiSettings.setTiltGesturesEnabled(false);
mUiSettings.setRotateGesturesEnabled(false);
// Add a circle, a ground overlay, a marker, a polygon and a polyline to the map.
addObjectsToMap();
// Set listeners for click events. See the bottom of this class for their behavior.
mMap.setOnCircleClickListener(this);
mMap.setOnGroundOverlayClickListener(this);
mMap.setOnMarkerClickListener(this);
mMap.setOnPolygonClickListener(this);
mMap.setOnPolylineClickListener(this);
// Override the default content description on the view, for accessibility mode.
// Ideally this string would be localised.
map.setContentDescription(getString(R.string.tags_demo_map_description));
// Create bounds that include all locations of the map.
LatLngBounds bounds = new LatLngBounds.Builder().include(ADELAIDE).include(BRISBANE).include(DARWIN).include(HOBART).include(PERTH).include(SYDNEY).build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
}
use of com.google.android.gms.maps.UiSettings in project IITB-App by wncc.
the class FileComplaintFragment method getMapReady.
public void getMapReady() {
mMapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap map) {
googleMap = map;
UiSettings uiSettings = googleMap.getUiSettings();
uiSettings.setAllGesturesEnabled(true);
uiSettings.setZoomControlsEnabled(true);
uiSettings.setMyLocationButtonEnabled(true);
uiSettings.setIndoorLevelPickerEnabled(true);
uiSettings.setScrollGesturesEnabled(true);
if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, MY_PERMISSIONS_REQUEST_LOCATION);
} else {
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
googleMap.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {
@Override
public boolean onMyLocationButtonClick() {
locate();
return false;
}
});
FusedLocationProviderClient mFusedLocationClient = LocationServices.getFusedLocationProviderClient(getActivity());
mFusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
// Got last known location. In some rare situations this can be null.
if (location != null) {
// Logic to handle location object
Location = new LatLng(location.getLatitude(), location.getLongitude());
updateMap(Location, "Current Location", location.getLatitude() + ", " + location.getLongitude(), cursor);
} else {
Toast.makeText(getContext(), getString(R.string.getting_current_location), Toast.LENGTH_SHORT).show();
}
}
});
mFusedLocationClient.getLastLocation().addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
e.printStackTrace();
}
});
}
}
});
}
use of com.google.android.gms.maps.UiSettings in project Pokemap by omkarmoghe.
the class MapWrapperFragment method onMapReady.
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
UiSettings settings = mGoogleMap.getUiSettings();
settings.setCompassEnabled(true);
settings.setTiltGesturesEnabled(true);
settings.setMyLocationButtonEnabled(false);
//Handle long click
mGoogleMap.setOnMapLongClickListener(this);
mGoogleMap.setOnMapClickListener(this);
mGoogleMap.setOnMarkerClickListener(this);
//Disable for now coz is under FAB
settings.setMapToolbarEnabled(false);
initMap(false, false);
}
use of com.google.android.gms.maps.UiSettings in project iosched by google.
the class MapFragment method onMapReady.
@Override
public void onMapReady(GoogleMap googleMap) {
// Initialise marker icons.
ICON_ACTIVE = BitmapDescriptorFactory.fromBitmap(UIUtils.drawableToBitmap(getContext(), R.drawable.map_marker_selected));
ICON_NORMAL = BitmapDescriptorFactory.fromBitmap(UIUtils.drawableToBitmap(getContext(), R.drawable.map_marker_unselected));
mMap = googleMap;
mMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.maps_style));
mMap.setIndoorEnabled(false);
mMap.setOnMarkerClickListener(this);
mMap.setOnMapClickListener(this);
mMap.setLatLngBoundsForCameraTarget(VIEWPORT);
mMap.setMinZoomPreference(BuildConfig.MAP_VIEWPORT_MINZOOM);
UiSettings mapUiSettings = mMap.getUiSettings();
mapUiSettings.setZoomControlsEnabled(false);
mapUiSettings.setMapToolbarEnabled(false);
// This state is set via 'setMyLocationLayerEnabled.
// noinspection MissingPermission
mMap.setMyLocationEnabled(mMyLocationEnabled);
// Move camera directly to the venue
centerOnVenue(false);
loadMapData();
LOGD(TAG, "Map setup complete.");
}
use of com.google.android.gms.maps.UiSettings in project Pokemap by omkarmoghe.
the class MapWrapperFragment method onMapReady.
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
UiSettings settings = mGoogleMap.getUiSettings();
settings.setCompassEnabled(true);
settings.setTiltGesturesEnabled(true);
settings.setMyLocationButtonEnabled(false);
}
Aggregations