@Override public void setMapToolbarEnabled(boolean enabled) { googleMap.getUiSettings().setMapToolbarEnabled(enabled); }
@Override public void setMyLocationButtonEnabled(boolean enabled) { googleMap.getUiSettings().setMyLocationButtonEnabled(enabled); }
@SuppressLint("MissingPermission") private void follow() { if (map!=null && locMgr!=null) { if (autoFollow) { locMgr.requestLocationUpdates(0L, 0.0f, crit, this, null); map.setLocationSource(this); map.getUiSettings().setMyLocationButtonEnabled(false); } else { map.getUiSettings().setMyLocationButtonEnabled(true); map.setLocationSource(null); locMgr.removeUpdates(this); } } } }
@Override @SuppressWarnings("MissingPermission") public void onMapReady(GoogleMap googleMap) { map = googleMap; map.getUiSettings().setMapToolbarEnabled(false); if (listener.hasLocationPermission()) { map.setMyLocationEnabled(true); map.getUiSettings().setMyLocationButtonEnabled(false); } map.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() { @Override public void onInfoWindowClick(Marker marker) { if (marker.getTag() instanceof Place) { Place place = (Place) marker.getTag(); listener.onPlaceSelected(place); } } }); if (state == State.MAP) { displayPlaces(placesToDisplay); } }
@Override public void onMapReady(GoogleMap googleMap) { if (googleMap != null && getActivity() != null) { NativeGoogleMapFragment.this.googleMap = googleMap; UiSettings settings = NativeGoogleMapFragment.this.googleMap.getUiSettings(); settings.setZoomControlsEnabled(false); settings.setMyLocationButtonEnabled(false); setMyLocationEnabled(myLocationEnabled); if (onMapLoadedListener != null) { onMapLoadedListener.onMapLoaded(); } } } });
/** * Called when the toggle level picker button is clicked. */ public void onToggleLevelPicker(View view) { showLevelPicker = !showLevelPicker; mMap.getUiSettings().setIndoorLevelPickerEnabled(showLevelPicker); }
/** * Updates the map's UI settings based on whether the user has granted location permission. */ private void updateLocationUI() { if (mMap == null) { return; } try { if (mLocationPermissionGranted) { mMap.setMyLocationEnabled(true); mMap.getUiSettings().setMyLocationButtonEnabled(true); } else { mMap.setMyLocationEnabled(false); mMap.getUiSettings().setMyLocationButtonEnabled(false); mLastKnownLocation = null; getLocationPermission(); } } catch (SecurityException e) { Log.e("Exception: %s", e.getMessage()); } } }
@Override public void onComplete(@NonNull Task<Location> task) { if (task.isSuccessful()) { // Set the map's camera position to the current location of the device. mLastKnownLocation = task.getResult(); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(mLastKnownLocation.getLatitude(), mLastKnownLocation.getLongitude()), DEFAULT_ZOOM)); } else { Log.d(TAG, "Current location is null. Using defaults."); Log.e(TAG, "Exception: %s", task.getException()); mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM)); mMap.getUiSettings().setMyLocationButtonEnabled(false); } } });
@Override public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStartedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // We will provide our own zoom controls. mMap.getUiSettings().setZoomControlsEnabled(false); mMap.getUiSettings().setMyLocationButtonEnabled(true); // Show Sydney mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); }
@RequiresPermission(Manifest.permission.ACCESS_FINE_LOCATION) private void onLocationPermissionGranted() { if (!checkPermission()) return; mMap.getUiSettings().setMyLocationButtonEnabled(false); mMap.setMyLocationEnabled(true); mFusedLocationClient.getLastLocation() .addOnSuccessListener(this, new OnSuccessListener<Location>() { @Override public void onSuccess(Location location) { if (location != null) { userLocation = location; CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(userLocation.getLatitude(), userLocation.getLongitude())) .zoom(17) .build(); addOverlay(new LatLng(userLocation.getLatitude(), userLocation.getLongitude())); mMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } else { userLocation = null; } } }); }
@Override public final UiSettings getUiSettings() { return map.getUiSettings(); }
@Override public void onMapReady(GoogleMap map) { mMap = map; mUiSettings = mMap.getUiSettings(); // Keep the UI Settings state in sync with the checkboxes. mUiSettings.setZoomControlsEnabled(isChecked(R.id.zoom_buttons_toggle)); mUiSettings.setCompassEnabled(isChecked(R.id.compass_toggle)); mUiSettings.setMyLocationButtonEnabled(isChecked(R.id.mylocationbutton_toggle)); mMap.setMyLocationEnabled(isChecked(R.id.mylocationlayer_toggle)); mUiSettings.setScrollGesturesEnabled(isChecked(R.id.scroll_toggle)); mUiSettings.setZoomGesturesEnabled(isChecked(R.id.zoom_gestures_toggle)); mUiSettings.setTiltGesturesEnabled(isChecked(R.id.tilt_toggle)); mUiSettings.setRotateGesturesEnabled(isChecked(R.id.rotate_toggle)); }
@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)); }
@Override public void onMapReady(GoogleMap map) { mMap = map; // Hide the zoom controls as the button panel will cover it. mMap.getUiSettings().setZoomControlsEnabled(false); // Add lots of markers to the map. addMarkersToMap(); // Setting an info window adapter allows us to change the both the contents and look of the // info window. mMap.setInfoWindowAdapter(new CustomInfoWindowAdapter()); // Set listeners for marker events. See the bottom of this class for their behavior. mMap.setOnMarkerClickListener(this); mMap.setOnInfoWindowClickListener(this); mMap.setOnMarkerDragListener(this); mMap.setOnInfoWindowCloseListener(this); mMap.setOnInfoWindowLongClickListener(this); // Override the default content description on the view, for accessibility mode. // Ideally this string would be localised. mMap.setContentDescription("Map with lots of markers."); LatLngBounds bounds = new LatLngBounds.Builder() .include(PERTH) .include(SYDNEY) .include(ADELAIDE) .include(BRISBANE) .include(MELBOURNE) .include(DARWIN) .build(); mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 50)); }
@Override public void onTutorialFinished() { map.getUiSettings().setAllGesturesEnabled(true); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.remove(tutorialFragment).commit(); }
@Override public void onRatingFinished() { map.getUiSettings().setAllGesturesEnabled(true); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.remove(ratingFragment).commit(); }
mMap = map; UiSettings mUiSettings = mMap.getUiSettings();
@Override public void onMapReady(GoogleMap googleMap) { mGoogleMap = googleMap; MapsInitializer.initialize(getRootView().getContext()); mGoogleMap.setMyLocationEnabled(false); // Don't show my location mGoogleMap.setBuildingsEnabled(false); // Don't show 3D buildings mGoogleMap.getUiSettings().setMapToolbarEnabled(false); // No toolbar needed in a lite preview if (mLocation != null) { // location has already been bound - bind it to the map setLocation(mLocation); } }
@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.getUiSettings().setMyLocationButtonEnabled(false); mMap.setMaxZoomPreference(20); if (getMapStyle() != null) { googleMap.setMapStyle(getMapStyle()); } }
private void initializeMapInterface(GoogleMap mMap) { UiSettings uiSettings = mMap.getUiSettings(); mMap.setMyLocationEnabled(true); mMap.setOnCameraChangeListener(this); uiSettings.setMyLocationButtonEnabled(false); uiSettings.setCompassEnabled(true); uiSettings.setAllGesturesEnabled(true); uiSettings.setZoomControlsEnabled(false); updateOverlay(ConversionUtils.getOverlayString(mApplicationContext)); addInterfaceListeners(); }