Java Code Examples for com.google.android.gms.maps.UiSettings

The following are top voted examples for showing how to use com.google.android.gms.maps.UiSettings. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: iosched-reader   File: MapFragment.java   View source code 7 votes vote down vote up
@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);
}
 
Example 2
Project: AirMapView   File: NativeGoogleMapFragment.java   View source code 7 votes vote down vote up
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();
        }
      }
    }
  });
}
 
Example 3
Project: MyFlightbookAndroid   File: ActFlightMap.java   View source code 6 votes vote down vote up
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();
    }
}
 
Example 4
Project: Runnest   File: UtilsUI.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 5
Project: LazarilloApp   File: MapsActivity.java   View source code 6 votes vote down vote up
@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);
    }
}
 
Example 6
Project: pokiimap-human   File: MapWrapperFragment.java   View source code 6 votes vote down vote up
@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);



}
 
Example 7
Project: smconf-android   File: MapFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 8
Project: LivePokemonFinder   File: MapWrapperFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 9
Project: 2015-Google-I-O-app   File: MapFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 10
Project: droidkaigi2016   File: MapFragment.java   View source code 6 votes vote down vote up
@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);
    });
}
 
Example 11
Project: FMTech   File: MapFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 12
Project: nc-traffic-cams-open   File: MapFragment.java   View source code 6 votes vote down vote up
@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();
}
 
Example 13
Project: droidkaigi2016   File: MapFragment.java   View source code 6 votes vote down vote up
@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);
    });
}
 
Example 14
Project: TravelTracker   File: SelectLocationFragment.java   View source code 6 votes vote down vote up
@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();
}
 
Example 15
Project: SayItFromTheSky   File: DrawingViewerActivity.java   View source code 6 votes vote down vote up
@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()));
            }
        }
    }
}
 
Example 16
Project: TravelReminder   File: ReminderEditLocationInfo.java   View source code 6 votes vote down vote up
@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);
    }
}
 
Example 17
Project: clusterkraf   File: SampleActivity.java   View source code 6 votes vote down vote up
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();
	}
}
 
Example 18
Project: civify-app   File: CivifyMap.java   View source code 5 votes vote down vote up
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();
}
 
Example 19
Project: Instincts-2k17   File: MapsActivity.java   View source code 5 votes vote down vote up
@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();
}
 
Example 20
Project: custode   File: SummaryActivity.java   View source code 5 votes vote down vote up
@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));
    }
}
 
Example 21
Project: EarthquakeSurvival   File: MapviewFragment.java   View source code 5 votes vote down vote up
@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();
}
 
Example 22
Project: truth-android   File: UiSettingsSubject.java   View source code 5 votes vote down vote up
public static SubjectFactory<UiSettingsSubject, UiSettings> type() {
  return new SubjectFactory<UiSettingsSubject, UiSettings>() {
    @Override
    public UiSettingsSubject getSubject(FailureStrategy fs, UiSettings that) {
      return new UiSettingsSubject(fs, that);
    }
  };
}
 
Example 23
Project: PhoneChat   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 24
Project: PhoneChat   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 25
Project: Tower-develop   File: GoogleMapFragment.java   View source code 5 votes vote down vote up
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());
}
 
Example 26
Project: DotHike   File: HikeViewPagerActivity.java   View source code 5 votes vote down vote up
@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);
    }
}
 
Example 27
Project: grado_informatica_npi   File: MapsActivity.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 28
Project: DroidPlanner-Tower   File: GoogleMapFragment.java   View source code 5 votes vote down vote up
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());
}
 
Example 29
Project: neo4art   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 30
Project: neo4art   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 31
Project: neo4art   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 32
Project: neo4art   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 33
Project: neo4art   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 34
Project: neo4art   File: PluginMap.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 35
Project: iosched   File: MapFragment.java   View source code 5 votes vote down vote up
@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.");
}
 
Example 36
Project: android_programmering_2014   File: MainActivity.java   View source code 5 votes vote down vote up
@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);
}
 
Example 37
Project: mapquiz   File: QuestionMapFragment.java   View source code 5 votes vote down vote up
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);
        }
    });
}
 
Example 38
Project: GeoQuake   File: QuakeMapFragment.java   View source code 5 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example 39
Project: TruckMuncher-Android   File: VendorMapFragment.java   View source code 5 votes vote down vote up
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);
    }

}
 
Example 40
Project: Fake-Checkin   File: CheckIn.java   View source code 5 votes vote down vote up
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;
	}