Search in sources :

Example 1 with UiSettings

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));
}
Also used : UiSettings(com.google.android.gms.maps.UiSettings) LatLngBounds(com.google.android.gms.maps.model.LatLngBounds)

Example 2 with UiSettings

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();
                    }
                });
            }
        }
    });
}
Also used : GoogleMap(com.google.android.gms.maps.GoogleMap) UiSettings(com.google.android.gms.maps.UiSettings) OnMapReadyCallback(com.google.android.gms.maps.OnMapReadyCallback) FusedLocationProviderClient(com.google.android.gms.location.FusedLocationProviderClient) LatLng(com.google.android.gms.maps.model.LatLng) OnSuccessListener(com.google.android.gms.tasks.OnSuccessListener) OnFailureListener(com.google.android.gms.tasks.OnFailureListener) ApiException(com.google.android.gms.common.api.ApiException) ResolvableApiException(com.google.android.gms.common.api.ResolvableApiException) Location(android.location.Location)

Example 3 with UiSettings

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);
}
Also used : UiSettings(com.google.android.gms.maps.UiSettings)

Example 4 with UiSettings

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.");
}
Also used : UiSettings(com.google.android.gms.maps.UiSettings)

Example 5 with UiSettings

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);
}
Also used : UiSettings(com.google.android.gms.maps.UiSettings)

Aggregations

UiSettings (com.google.android.gms.maps.UiSettings)5 Location (android.location.Location)1 ApiException (com.google.android.gms.common.api.ApiException)1 ResolvableApiException (com.google.android.gms.common.api.ResolvableApiException)1 FusedLocationProviderClient (com.google.android.gms.location.FusedLocationProviderClient)1 GoogleMap (com.google.android.gms.maps.GoogleMap)1 OnMapReadyCallback (com.google.android.gms.maps.OnMapReadyCallback)1 LatLng (com.google.android.gms.maps.model.LatLng)1 LatLngBounds (com.google.android.gms.maps.model.LatLngBounds)1 OnFailureListener (com.google.android.gms.tasks.OnFailureListener)1 OnSuccessListener (com.google.android.gms.tasks.OnSuccessListener)1