@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setIndoorEnabled(true); mMap.setMyLocationEnabled(false); mMap.setOnMarkerClickListener(this); mMap.setOnIndoorStateChangeListener(this); mMap.setOnMapClickListener(this); UiSettings mapUiSettings = mMap.getUiSettings(); mapUiSettings.setZoomControlsEnabled(false); mapUiSettings.setMapToolbarEnabled(false); // load all markers LoaderManager lm = getLoaderManager(); lm.initLoader(TOKEN_LOADER_MARKERS, null, mMarkerLoader).forceLoad(); // load the tile overlays lm.initLoader(TOKEN_LOADER_TILES, null, mTileLoader).forceLoad(); setupMap(true); }
/** * Setup UI elements and gesture of the given GoogleMap. Used for recaps. * * @param googleMap map to setup */ public static void recapDisplayTrackSetupUI(GoogleMap googleMap) { if (googleMap == null) { throw new IllegalArgumentException(); } googleMap.setBuildingsEnabled(false); googleMap.setIndoorEnabled(false); googleMap.setTrafficEnabled(false); UiSettings uiSettings = googleMap.getUiSettings(); uiSettings.setCompassEnabled(false); uiSettings.setIndoorLevelPickerEnabled(false); uiSettings.setMapToolbarEnabled(false); uiSettings.setZoomControlsEnabled(false); uiSettings.setMyLocationButtonEnabled(false); }
@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; int marca = 0; for (Punto incidencia :incidencias) { mMap.addMarker(new MarkerOptions().position(new LatLng(incidencia.getX(), incidencia.getY())).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET))); } for (Punto punto : puntos) { mMap.addMarker(new MarkerOptions().position(new LatLng(punto.getX(), punto.getY())).title("Step " + (++marca))); } mMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(puntos.get(0).getX(), puntos.get(0).getY()))); UiSettings ui = mMap.getUiSettings(); ui.setZoomControlsEnabled(true); for (int i = 0; i < puntos.size() - 1; i++) { PolylineOptions linea = new PolylineOptions().add(new LatLng(puntos.get(i).getX(), puntos.get(i).getY())).add(new LatLng(puntos.get(i + 1).getX(), puntos.get(i + 1).getY())); linea.color(Color.BLUE); linea.width(3f); mMap.addPolyline(linea); } }
@Override public void onMapReady(GoogleMap googleMap) { mGoogleMap = googleMap; mGoogleMap.setMyLocationEnabled(true); mGoogleMap.setOnMyLocationButtonClickListener(this); mGoogleMap.setOnMarkerClickListener(this); mGoogleMap.setOnInfoWindowClickListener(this); UiSettings settings = mGoogleMap.getUiSettings(); settings.setTiltGesturesEnabled(false); settings.setCompassEnabled(true); settings.setTiltGesturesEnabled(true); settings.setMyLocationButtonEnabled(true); settings.setMapToolbarEnabled(false); }
@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); }
@NeedsPermission(Manifest.permission.ACCESS_FINE_LOCATION) void initGoogleMap() { SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(googleMap -> { //noinspection MissingPermission googleMap.setMyLocationEnabled(true); binding.mapSearchView.bindData(placeMapList, placeMap -> { LatLng latLng = new LatLng(placeMap.latitude, placeMap.longitude); int duration = getResources().getInteger(R.integer.map_camera_move_mills); googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng), duration, null); Marker marker = markers.get(placeMap.nameRes); if (marker != null) marker.showInfoWindow(); }); binding.loadingView.setVisibility(View.GONE); googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); googleMap.setIndoorEnabled(true); googleMap.setBuildingsEnabled(true); googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LAT_LNG_CENTER, DEFAULT_ZOOM)); UiSettings mapUiSettings = googleMap.getUiSettings(); mapUiSettings.setCompassEnabled(true); renderMarkers(placeMapList, googleMap); }); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mMap = getMap(); if(mMap != null) { UiSettings settings = mMap.getUiSettings(); settings.setCompassEnabled(true); settings.setMyLocationButtonEnabled(true); mMap.setMyLocationEnabled(true); mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); mMap.setTrafficEnabled(true); mMap.setOnMarkerClickListener(this); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(sNCLatLng, 6), 1, null); } else { Toast.makeText(getActivity(), "Error accessig Maps API", Toast.LENGTH_SHORT).show(); } mActionBar = ((ActionBarActivity) getActivity()).getSupportActionBar(); }
public void init() { getMapAsync(new OnMapReadyCallback() { @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(); } } } }); }
@Override public void onResume() { super.onResume(); // Set up map if we haven't done so yet if (map == null) { // Remove the toolbar map = mapFragment.getMap(); UiSettings settings = map.getUiSettings(); settings.setMapToolbarEnabled(false); if (editable) { map.setOnMapClickListener(new OnMapClickListener() { @Override public void onMapClick(LatLng arg0) { launchSelectLocationActivity(); } }); } } updateMap(); }
@Override public void onMapReady() { if (mGoogleMap == null) { mGoogleMap = mMapFragment.getMap(); if (mGoogleMap != null) { // You are good to use the map =) final UiSettings uiSettings = mGoogleMap.getUiSettings(); uiSettings.setCompassEnabled(false); uiSettings.setZoomControlsEnabled(false); // Draw the paths if (!mDrawing.getEncodedPolylines().isEmpty()) { final LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder(); for (String encodedPath : mDrawing.getEncodedPolylines()) { final List<LatLng> pathPoints = PolyUtil.decode(encodedPath); mGoogleMap.addPolyline(mPathOptions).setPoints(pathPoints); for (LatLng point : pathPoints) { boundsBuilder.include(point); } } animateCameraToBounds(boundsBuilder.build()); mDrawingLength.setText(getString(R.string.activity_drawing_viewer_drawing_length, mDrawing.getLength())); } } } }
@Override public void onResume() { super.onResume(); if (map == null) { map = mapFragment.getMap(); map.setMyLocationEnabled(true); UiSettings uiSettings = map.getUiSettings(); uiSettings.setMyLocationButtonEnabled(true); uiSettings.setCompassEnabled(true); uiSettings.setZoomControlsEnabled(false); map.setOnMapClickListener(clickListener); } }
private void initMap() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); if (mapFragment != null) { map = mapFragment.getMap(); if (map != null) { UiSettings uiSettings = map.getUiSettings(); uiSettings.setAllGesturesEnabled(false); uiSettings.setScrollGesturesEnabled(true); uiSettings.setZoomGesturesEnabled(true); map.setOnCameraChangeListener(new OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition arg0) { moveMapCameraToBoundsAndInitClusterkraf(); } }); } } } else { moveMapCameraToBoundsAndInitClusterkraf(); } }
private void setMapSettings() { UiSettings settings = getUiSettings(); settings.setScrollGesturesEnabled(true); settings.setRotateGesturesEnabled(true); settings.setCompassEnabled(true); settings.setZoomControlsEnabled(false); settings.setTiltGesturesEnabled(false); settings.setMapToolbarEnabled(false); settings.setMyLocationButtonEnabled(false); setMarkers(); }
@Override public void onMapReady(GoogleMap map) { googleMap = map; googleMap.setMyLocationEnabled(locationEnabled); googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); UiSettings uiSettings = googleMap.getUiSettings(); uiSettings.setZoomControlsEnabled(true); uiSettings.setCompassEnabled(true); uiSettings.setMyLocationButtonEnabled(true); uiSettings.setMapToolbarEnabled(true); googleMap.setMinZoomPreference(15); googleMap.setMaxZoomPreference(20); googleMap.setLatLngBoundsForCameraTarget(SSN_COLLEGE); Set<Map.Entry<String, LatLng>> entries = stringToLatLngMap.entrySet(); Iterator iterator = entries.iterator(); while (iterator.hasNext()) { Map.Entry<String, LatLng> entry = (Map.Entry) iterator.next(); googleMap.addMarker(new MarkerOptions() .position(entry.getValue()).title(entry.getKey())); } centerOnLocation(); }
public void onMapReady(GoogleMap googleMap) { if (m_gMap == null) { m_gMap = googleMap; GoogleMap map = getMap(); if (map == null) { MFBUtil.Alert(this, getString(R.string.txtError), getString(R.string.errNoGoogleMaps)); finish(); return; } map.setMapType(GoogleMap.MAP_TYPE_HYBRID); UiSettings settings = map.getUiSettings(); settings.setCompassEnabled(false); settings.setRotateGesturesEnabled(false); settings.setScrollGesturesEnabled(true); settings.setZoomControlsEnabled(false); settings.setZoomGesturesEnabled(true); View mapView = getFragmentManager().findFragmentById(R.id.mfbMap).getView(); if (mapView != null && mapView.getViewTreeObserver() != null && mapView.getViewTreeObserver().isAlive()) { mapView.getViewTreeObserver().addOnGlobalLayoutListener(this); } map.setOnMarkerClickListener(this); if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { map.setMyLocationEnabled(true); } map.setOnMapLongClickListener(this); updateMapElements(); } }
@Override public void onMapReady(GoogleMap googleMap) { SummaryActivity.this.googleMap = googleMap; googleMap.setTrafficEnabled(false); googleMap.setBuildingsEnabled(false); googleMap.setOnMyLocationButtonClickListener(this); UiSettings mapUi = googleMap.getUiSettings(); mapUi.setMapToolbarEnabled(false); mapUi.setAllGesturesEnabled(true); mapUi.setTiltGesturesEnabled(false); mapUi.setMyLocationButtonEnabled(true); for (MarkerOptions markerOptions : pendingMarkersList) addMarker(markerOptions); pendingMarkersList.clear(); followUser = true; if (ActivityCompat.checkSelfPermission(SummaryActivity.this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) googleMap.setMyLocationEnabled(true); Location location = LocationService.getBestLastKnownLocation(SummaryActivity.this); if (location != null) { LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); googleMap.moveCamera(CameraUpdateFactory.zoomTo(18)); } }
@Override public void onMapReady(GoogleMap googleMap) { mGoogleMap = googleMap; UiSettings uiSettings = mGoogleMap.getUiSettings(); uiSettings.setZoomControlsEnabled(true); addMyLocation(); uiSettings.setMyLocationButtonEnabled(true); if (mCameraPosition != null) { mGoogleMap.moveCamera(CameraUpdateFactory.newCameraPosition(mCameraPosition)); } addMarkersObservable(); showFaultlines(); }
public static SubjectFactory<UiSettingsSubject, UiSettings> type() { return new SubjectFactory<UiSettingsSubject, UiSettings>() { @Override public UiSettingsSubject getSubject(FailureStrategy fs, UiSettings that) { return new UiSettingsSubject(fs, that); } }; }
/** * Enable the compass if set true * @param args * @param callbackContext * @throws JSONException */ @SuppressWarnings("unused") private void setCompassEnabled(final JSONArray args, final CallbackContext callbackContext) throws JSONException { Boolean isEnabled = args.getBoolean(1); UiSettings uiSettings = map.getUiSettings(); uiSettings.setCompassEnabled(isEnabled); this.sendNoResult(callbackContext); }
/** * Sets the preference for whether all gestures should be enabled or disabled. * @param args * @param callbackContext * @throws JSONException */ @SuppressWarnings("unused") private void setAllGesturesEnabled(final JSONArray args, final CallbackContext callbackContext) throws JSONException { Boolean isEnabled = args.getBoolean(1); UiSettings uiSettings = map.getUiSettings(); uiSettings.setAllGesturesEnabled(isEnabled); this.sendNoResult(callbackContext); }
private void setupMapUI(GoogleMap map) { map.setMyLocationEnabled(false); UiSettings mUiSettings = map.getUiSettings(); mUiSettings.setMyLocationButtonEnabled(false); mUiSettings.setMapToolbarEnabled(false); mUiSettings.setCompassEnabled(false); mUiSettings.setTiltGesturesEnabled(false); mUiSettings.setZoomControlsEnabled(false); mUiSettings.setRotateGesturesEnabled(mAppPrefs.isMapRotationEnabled()); }
@Override public void onMapReady(GoogleMap googleMap) { Log.d(TAG, "onMapReady() Called"); mMap = googleMap; mMapPolylineOptions = new PolylineOptions(); mMapReady = true; // Set Maps Settings UiSettings mapSettings = mMap.getUiSettings(); mapSettings.setTiltGesturesEnabled(false); mapSettings.setMyLocationButtonEnabled(true); mapSettings.setCompassEnabled(true); // Enable MyLocation mMap.setMyLocationEnabled(true); // Set Map Type to Terrain SharedPreferences prefMan=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if(prefMan.contains("display_maptype")){ mMap.setMapType( Integer.parseInt(prefMan.getString( "display_maptype", Integer.toString(GoogleMap.MAP_TYPE_TERRAIN)))); } else { mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); } }
/** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); UiSettings uiSettings = mMap.getUiSettings(); uiSettings.setMapToolbarEnabled(true); uiSettings.setZoomControlsEnabled(true); if (mLocationsList != null) { updateMap(mLocationsList); } }
@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."); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); kittyMarkers = new ArrayList<Marker>(); mapDirection = new GMapV2Direction(); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); map.addMarker(new MarkerOptions().position(HIOF).title("�stfold University College")); map.addMarker(new MarkerOptions().position(FREDRIKSTAD).title("Fredrikstad Kino")); if (savedInstanceState == null) { map.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(HIOF, 13, 0, 0))); map.animateCamera(CameraUpdateFactory.newLatLng(FREDRIKSTAD), 2000, null); } else { Bundle bundle = savedInstanceState.getBundle("lost_kittens"); KittenLocation kittenLocation = bundle.getParcelable("found_kitten"); map.addMarker(new MarkerOptions().position(kittenLocation.getLatLng()).title(kittenLocation.getName()).snippet("Found Kitten") .icon(BitmapDescriptorFactory.fromResource(getResources().getIdentifier("kitten_0" + (kittyCounter % 3 + 1), "drawable", "com.capgemini.playingwithgooglemaps")))); } map.setOnMapLongClickListener(this); map.setMyLocationEnabled(true); UiSettings uiSettings = map.getUiSettings(); uiSettings.setCompassEnabled(false); uiSettings.setTiltGesturesEnabled(false); uiSettings.setZoomControlsEnabled(false); Spinner spinner = (Spinner) findViewById(R.id.layers_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.layers_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); }
private void initMap() { getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap map) { UiSettings settings = map.getUiSettings(); settings.setAllGesturesEnabled(false); settings.setZoomControlsEnabled(false); settings.setCompassEnabled(false); settings.setMapToolbarEnabled(false); settings.setIndoorLevelPickerEnabled(false); settings.setMyLocationButtonEnabled(false); } }); }
/** * Called asynchronously. Initiates the map setup, and initial marker placement */ public void postSyncMapSetup() { if (mMap != null) { mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); //check location permission PackageManager pm = getActivity().getPackageManager(); int result = pm.checkPermission(android.Manifest.permission.ACCESS_FINE_LOCATION, getActivity().getPackageName()); if (PackageManager.PERMISSION_GRANTED == result) { mMap.setMyLocationEnabled(true); } UiSettings settings = mMap.getUiSettings(); settings.setCompassEnabled(true); settings.setMyLocationButtonEnabled(false); if (((MainActivity) getActivity()).getEarthquakes() != null && ((MainActivity) getActivity()).getEarthquakes().size() > 0) { mEarthquakes = ((MainActivity) getActivity()).getEarthquakes(); placeMarkers(); } else { ((MainActivity) getActivity()).checkNetworkFetchData(); } } }
public void setMapControlsEnabled(boolean enabled) { UiSettings settings = mapView.getMap().getUiSettings(); settings.setScrollGesturesEnabled(enabled); settings.setRotateGesturesEnabled(enabled); settings.setZoomControlsEnabled(enabled); settings.setZoomGesturesEnabled(enabled); settings.setMyLocationButtonEnabled(enabled); if (enabled) { LocationServices.FusedLocationApi.requestLocationUpdates(apiClient, request, this); } else { LocationServices.FusedLocationApi.removeLocationUpdates(apiClient, this); } }
private LatLng adjustMap(Location lastKnownLocation) { UiSettings ui = myMap.getUiSettings(); // ui.setAllGesturesEnabled(false); // ui.setMyLocationButtonEnabled(false); // ui.setZoomControlsEnabled(false); myMap.setMyLocationEnabled(true); double lat = lastKnownLocation.getLatitude(); double lng = lastKnownLocation.getLongitude(); LatLng ll = new LatLng(lat, lng); myMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 16)); return ll; }