use of com.google.android.gms.maps.CameraUpdate in project Ushahidi_Android by ushahidi.
the class ViewReportFragment method initReport.
private void initReport(int position) {
mReport = mReports.getReports();
if (mReport != null) {
// Configure map
CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(mReport.get(position).getIncident().getLatitude(), mReport.get(position).getIncident().getLongitude()));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(15);
mMap.getUiSettings().setMyLocationButtonEnabled(false);
mMap.moveCamera(center);
mMap.moveCamera(zoom);
// Add a marker to this location
addMarker(mMap, mReport.get(position).getIncident().getLatitude(), mReport.get(position).getIncident().getLongitude());
mReportId = (int) mReport.get(position).getIncident().getId();
mReportTitle = mReport.get(position).getIncident().getTitle();
mView.setBody(mReport.get(position).getIncident().getDescription());
mView.setCategory(fetchCategories(mReportId));
mView.setLocation(mReport.get(position).getIncident().getLocationName());
String date = Util.datePattern("MMMM dd, yyyy 'at' hh:mm:ss aaa", mReport.get(position).getIncident().getDate());
mView.setDate(date);
mView.setTitle(mReportTitle);
mView.setStatus(mReport.get(position).getIncident().getVerified());
mView.setListNews((int) mReportId);
mView.setListPhotos((int) mReportId);
mView.setListVideos((int) mReportId);
mView.setListComments(mReportId);
mView.getListPhotos().setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(getActivity(), ViewReportPhotoActivity.class);
i.putExtra("reportid", mReportId);
i.putExtra("position", 0);
startActivityForResult(i, 0);
getActivity().overridePendingTransition(R.anim.home_enter, R.anim.home_exit);
}
});
mView.getListNews().setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(getActivity(), ViewReportNewsActivity.class);
i.putExtra("reportid", mReportId);
i.putExtra("position", position);
startActivityForResult(i, 0);
getActivity().overridePendingTransition(R.anim.home_enter, R.anim.home_exit);
}
});
mView.getListVideos().setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(getActivity(), ViewReportVideoActivity.class);
i.putExtra("reportid", mReportId);
i.putExtra("position", position);
startActivityForResult(i, 0);
getActivity().overridePendingTransition(R.anim.home_enter, R.anim.home_exit);
}
});
mView.getListComments().setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(getActivity(), ListReportCommentActivity.class);
i.putExtra("reportid", mReportId);
i.putExtra("position", position);
startActivityForResult(i, 0);
getActivity().overridePendingTransition(R.anim.home_enter, R.anim.home_exit);
}
});
}
}
use of com.google.android.gms.maps.CameraUpdate in project cw-omnibus by commonsguy.
the class PageMapFragment method onMapReady.
@Override
public void onMapReady(final GoogleMap map) {
if (needsInit) {
CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044, -73.98180484771729));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(15);
map.moveCamera(center);
map.animateCamera(zoom);
}
addMarker(map, 40.748963847316034, -73.96807193756104, R.string.un, R.string.united_nations);
addMarker(map, 40.76866299974387, -73.98268461227417, R.string.lincoln_center, R.string.lincoln_center_snippet);
addMarker(map, 40.765136435316755, -73.97989511489868, R.string.carnegie_hall, R.string.practice_x3);
addMarker(map, 40.70686417491799, -74.01572942733765, R.string.downtown_club, R.string.heisman_trophy);
}
use of com.google.android.gms.maps.CameraUpdate in project cw-omnibus by commonsguy.
the class MainActivity method onMapReady.
@Override
public void onMapReady(final GoogleMap map) {
if (needsInit) {
CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044, -73.98180484771729));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(15);
map.moveCamera(center);
map.animateCamera(zoom);
}
addMarker(map, 40.748963847316034, -73.96807193756104, R.string.un, R.string.united_nations);
addMarker(map, 40.76866299974387, -73.98268461227417, R.string.lincoln_center, R.string.lincoln_center_snippet);
addMarker(map, 40.765136435316755, -73.97989511489868, R.string.carnegie_hall, R.string.practice_x3);
addMarker(map, 40.70686417491799, -74.01572942733765, R.string.downtown_club, R.string.heisman_trophy);
PolylineOptions line = new PolylineOptions().add(new LatLng(40.70686417491799, -74.01572942733765), new LatLng(40.76866299974387, -73.98268461227417), new LatLng(40.765136435316755, -73.97989511489868), new LatLng(40.748963847316034, -73.96807193756104)).width(5).color(Color.RED);
map.addPolyline(line);
PolygonOptions area = new PolygonOptions().add(new LatLng(40.748429, -73.984573), new LatLng(40.753393, -73.996311), new LatLng(40.758393, -73.992705), new LatLng(40.753484, -73.980882)).strokeColor(Color.BLUE);
map.addPolygon(area);
map.setInfoWindowAdapter(new PopupAdapter(getLayoutInflater()));
map.setOnInfoWindowClickListener(this);
}
use of com.google.android.gms.maps.CameraUpdate in project cw-omnibus by commonsguy.
the class MainActivity method onLocationChanged.
@Override
public void onLocationChanged(Location location) {
if (mapLocationListener != null) {
mapLocationListener.onLocationChanged(location);
LatLng latlng = new LatLng(location.getLatitude(), location.getLongitude());
CameraUpdate cu = CameraUpdateFactory.newLatLng(latlng);
map.animateCamera(cu);
}
}
use of com.google.android.gms.maps.CameraUpdate in project cw-omnibus by commonsguy.
the class MainActivity method onMapReady.
@Override
public void onMapReady(final GoogleMap map) {
this.map = map;
if (needsInit) {
CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044, -73.98180484771729));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(15);
map.moveCamera(center);
map.animateCamera(zoom);
}
addMarker(map, 40.748963847316034, -73.96807193756104, R.string.un, R.string.united_nations);
addMarker(map, 40.76866299974387, -73.98268461227417, R.string.lincoln_center, R.string.lincoln_center_snippet);
addMarker(map, 40.765136435316755, -73.97989511489868, R.string.carnegie_hall, R.string.practice_x3);
addMarker(map, 40.70686417491799, -74.01572942733765, R.string.downtown_club, R.string.heisman_trophy);
map.setInfoWindowAdapter(new PopupAdapter(getLayoutInflater()));
map.setOnInfoWindowClickListener(this);
locMgr = (LocationManager) getSystemService(LOCATION_SERVICE);
crit.setAccuracy(Criteria.ACCURACY_FINE);
locMgr.requestLocationUpdates(0L, 0.0f, crit, this, null);
map.setLocationSource(this);
map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);
}
Aggregations