Search in sources :

Example 11 with CameraUpdate

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);
            }
        });
    }
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Intent(android.content.Intent) ViewReportView(com.ushahidi.android.app.views.ViewReportView) View(android.view.View) AdapterView(android.widget.AdapterView) ListReportCommentActivity(com.ushahidi.android.app.ui.phone.ListReportCommentActivity) ViewReportVideoActivity(com.ushahidi.android.app.ui.phone.ViewReportVideoActivity) ViewReportPhotoActivity(com.ushahidi.android.app.ui.phone.ViewReportPhotoActivity) ViewReportNewsActivity(com.ushahidi.android.app.ui.phone.ViewReportNewsActivity) OnClickListener(android.view.View.OnClickListener) LatLng(com.google.android.gms.maps.model.LatLng) CameraUpdate(com.google.android.gms.maps.CameraUpdate)

Example 12 with CameraUpdate

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

Example 13 with CameraUpdate

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);
}
Also used : PolygonOptions(com.google.android.gms.maps.model.PolygonOptions) LatLng(com.google.android.gms.maps.model.LatLng) CameraUpdate(com.google.android.gms.maps.CameraUpdate) PolylineOptions(com.google.android.gms.maps.model.PolylineOptions)

Example 14 with CameraUpdate

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

Example 15 with CameraUpdate

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

Aggregations

CameraUpdate (com.google.android.gms.maps.CameraUpdate)20 LatLng (com.google.android.gms.maps.model.LatLng)18 View (android.view.View)2 Intent (android.content.Intent)1 IntentSender (android.content.IntentSender)1 LocationManager (android.location.LocationManager)1 OnClickListener (android.view.View.OnClickListener)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 PendingResult (com.google.android.gms.common.api.PendingResult)1 ResultCallback (com.google.android.gms.common.api.ResultCallback)1 Status (com.google.android.gms.common.api.Status)1 LocationRequest (com.google.android.gms.location.LocationRequest)1 LocationSettingsResult (com.google.android.gms.location.LocationSettingsResult)1 LocationSettingsStates (com.google.android.gms.location.LocationSettingsStates)1 PolygonOptions (com.google.android.gms.maps.model.PolygonOptions)1 PolylineOptions (com.google.android.gms.maps.model.PolylineOptions)1 ListReportCommentActivity (com.ushahidi.android.app.ui.phone.ListReportCommentActivity)1 ViewReportNewsActivity (com.ushahidi.android.app.ui.phone.ViewReportNewsActivity)1 ViewReportPhotoActivity (com.ushahidi.android.app.ui.phone.ViewReportPhotoActivity)1