use of com.google.android.gms.maps.GoogleMap in project actor-platform by actorapp.
the class MapFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
longitude = getArguments().getDouble("longitude");
latitude = getArguments().getDouble("latitude");
final MapView map = new MapView(getActivity());
map.onCreate(null);
map.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
mapController = googleMap;
googleMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title(""));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), 16));
map.onResume();
}
});
return map;
}
use of com.google.android.gms.maps.GoogleMap in project Signal-Android by WhisperSystems.
the class SignalMapView method display.
public ListenableFuture<Bitmap> display(final SignalPlace place) {
final SettableFuture<Bitmap> future = new SettableFuture<>();
this.mapView.onCreate(null);
this.mapView.onResume();
this.mapView.setVisibility(View.VISIBLE);
this.imageView.setVisibility(View.GONE);
this.mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final GoogleMap googleMap) {
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(place.getLatLong(), 13));
googleMap.addMarker(new MarkerOptions().position(place.getLatLong()));
googleMap.setBuildingsEnabled(true);
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.getUiSettings().setAllGesturesEnabled(false);
googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
googleMap.snapshot(new GoogleMap.SnapshotReadyCallback() {
@Override
public void onSnapshotReady(Bitmap bitmap) {
future.set(bitmap);
imageView.setImageBitmap(bitmap);
imageView.setVisibility(View.VISIBLE);
mapView.setVisibility(View.GONE);
mapView.onPause();
mapView.onDestroy();
}
});
}
});
}
});
this.textView.setText(place.getDescription());
return future;
}
use of com.google.android.gms.maps.GoogleMap in project Remindy by abicelis.
the class PlaceActivity method onMapReady.
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
@Override
public void onMapLongClick(LatLng latLng) {
//Save lat and long
mPlace.setLatitude(latLng.latitude);
mPlace.setLongitude(latLng.longitude);
//Add/Update marker and circle
if (mPlaceMarker == null)
drawMarkerWithCircle(latLng, mPlace.getRadius());
else
updateMarkerWithCircle(latLng);
//Request its location
Location loc = new Location(LocationManager.GPS_PROVIDER);
loc.setLatitude(mPlaceMarker.getPosition().latitude);
loc.setLongitude(mPlaceMarker.getPosition().longitude);
SnackbarUtil.showSnackbar(mMapContainer, SnackbarUtil.SnackbarType.NOTICE, R.string.activity_place_snackbar_fetching_address, SnackbarUtil.SnackbarDuration.LONG, null);
fetchAddressFromLocation(loc);
}
});
/*
* Request location permission, so that we can get the location of the
* device. The result of the permission request is handled by a callback,
* onRequestPermissionsResult.
*/
if (ContextCompat.checkSelfPermission(this.getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
setUpMap();
} else
ActivityCompat.requestPermissions(this, new String[] { android.Manifest.permission.ACCESS_FINE_LOCATION }, PERMISSION_REQUEST_ACCESS_FINE_LOCATION_SHOW_ICON_IN_MAP);
}
Aggregations