Search in sources :

Example 11 with MarkerOptions

use of com.google.android.gms.maps.model.MarkerOptions in project HumaneApp by Ganesh1010.

the class MapActivity method onMapReady.

@Override
public void onMapReady(GoogleMap googleMap) {
    mGoogleMap = googleMap;
    mGoogleMap.setOnMyLocationButtonClickListener(this);
    mGoogleMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {

        @Override
        public void onMapLongClick(LatLng latLng) {
            if (mCurrLocationMarker != null) {
                mCurrLocationMarker.remove();
            }
            latitude = latLng.latitude;
            longitude = latLng.longitude;
            location = new LatLng(latitude, longitude);
            mCurrLocationMarker = mGoogleMap.addMarker(new MarkerOptions().position(new LatLng(latitude, latLng.longitude)).draggable(true).visible(true).title(getAaddress(latitude, longitude)));
            mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 17));
        }
    });
    mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    //Initialize Google Play Services
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
            //Location Permission already granted
            buildGoogleApiClient();
            mGoogleMap.setMyLocationEnabled(true);
        } else {
            //Request Location Permission
            checkLocationPermission();
        }
    } else {
        buildGoogleApiClient();
        mGoogleMap.setMyLocationEnabled(true);
    }
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) GoogleMap(com.google.android.gms.maps.GoogleMap) LatLng(com.google.android.gms.maps.model.LatLng)

Example 12 with MarkerOptions

use of com.google.android.gms.maps.model.MarkerOptions in project HumaneApp by Ganesh1010.

the class MapActivity method onMyLocationButtonClick.

@Override
public boolean onMyLocationButtonClick() {
    System.out.println("current location");
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }
    location = new LatLng(cur_latitude, cur_longitude);
    location = new LatLng(cur_latitude, cur_longitude);
    latitude = cur_latitude;
    longitude = cur_longitude;
    mCurrLocationMarker = mGoogleMap.addMarker(new MarkerOptions().position(location).title(getAaddress(cur_latitude, cur_longitude)));
    mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 17));
    return true;
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) LatLng(com.google.android.gms.maps.model.LatLng)

Example 13 with MarkerOptions

use of com.google.android.gms.maps.model.MarkerOptions in project Remindy by abicelis.

the class EditLocationBasedReminderFragment method updateMapView.

private void updateMapView() {
    if (mMap != null && mReminder != null) {
        mMap.clear();
        // Add a marker for this item and set the camera
        BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.icon_marker);
        LatLng loc = new LatLng(mReminder.getPlace().getLatitude(), mReminder.getPlace().getLongitude());
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 13f));
        mMap.addMarker(new MarkerOptions().position(loc).icon(icon));
    }
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) LatLng(com.google.android.gms.maps.model.LatLng)

Example 14 with MarkerOptions

use of com.google.android.gms.maps.model.MarkerOptions in project Remindy by abicelis.

the class PlaceActivity method drawMarkerWithCircle.

/* Map Camera, Marker and Circle helper methods */
private void drawMarkerWithCircle(LatLng position, double circleRadiusInMeters) {
    //red outline
    int strokeColor = 0xffff0000;
    //opaque red fill
    int shadeColor = 0x44ff0000;
    CircleOptions circleOptions = new CircleOptions().center(position).radius(circleRadiusInMeters).fillColor(shadeColor).strokeColor(strokeColor).strokeWidth(2);
    if (mPlaceCircle != null)
        mPlaceCircle.remove();
    mPlaceCircle = mMap.addCircle(circleOptions);
    MarkerOptions markerOptions = new MarkerOptions().position(position);
    if (mPlaceMarker != null)
        mPlaceMarker.remove();
    mPlaceMarker = mMap.addMarker(markerOptions);
    mPlaceCircle.setZIndex(100);
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) CircleOptions(com.google.android.gms.maps.model.CircleOptions)

Example 15 with MarkerOptions

use of com.google.android.gms.maps.model.MarkerOptions in project google-io-2014 by romainguy.

the class DetailActivity method setupMap.

private void setupMap() {
    GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    double lat = getIntent().getDoubleExtra("lat", 37.6329946);
    double lng = getIntent().getDoubleExtra("lng", -122.4938344);
    float zoom = getIntent().getFloatExtra("zoom", 15.0f);
    LatLng position = new LatLng(lat, lng);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(position, zoom));
    map.addMarker(new MarkerOptions().position(position));
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) GoogleMap(com.google.android.gms.maps.GoogleMap) MapFragment(com.google.android.gms.maps.MapFragment) LatLng(com.google.android.gms.maps.model.LatLng)

Aggregations

MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)39 LatLng (com.google.android.gms.maps.model.LatLng)24 BitmapDescriptor (com.google.android.gms.maps.model.BitmapDescriptor)7 Marker (com.google.android.gms.maps.model.Marker)6 GoogleMap (com.google.android.gms.maps.GoogleMap)5 Bitmap (android.graphics.Bitmap)4 View (android.view.View)4 Document (org.w3c.dom.Document)4 OnClickListener (android.view.View.OnClickListener)3 GoogleDirection (app.akexorcist.gdaplibrary.GoogleDirection)3 OnDirectionResponseListener (app.akexorcist.gdaplibrary.GoogleDirection.OnDirectionResponseListener)3 OnMapReadyCallback (com.google.android.gms.maps.OnMapReadyCallback)3 PolylineOptions (com.google.android.gms.maps.model.PolylineOptions)3 RemoteImageLoader (com.omkarmoghe.pokemap.helpers.RemoteImageLoader)3 TextView (android.widget.TextView)2 OnAnimateListener (app.akexorcist.gdaplibrary.GoogleDirection.OnAnimateListener)2 CameraPosition (com.google.android.gms.maps.model.CameraPosition)2 CircleOptions (com.google.android.gms.maps.model.CircleOptions)2 PokemonIdOuterClass (POGOProtos.Enums.PokemonIdOuterClass)1 FortDataOuterClass (POGOProtos.Map.Fort.FortDataOuterClass)1