Search in sources :

Example 16 with ReportEntity

use of com.ushahidi.android.app.entities.ReportEntity in project Ushahidi_Android by ushahidi.

the class ReportDao method fetchAllReports.

@Override
public List<ReportEntity> fetchAllReports() {
    final String sortOrder = INCIDENT_DATE + " DESC";
    final String selection = INCIDENT_PENDING + " = ?";
    final String[] selectionArgs = { String.valueOf(0) };
    listReport = new ArrayList<ReportEntity>();
    cursor = super.query(INCIDENTS_TABLE, null, selection, selectionArgs, sortOrder);
    if (cursor != null) {
        cursor.moveToFirst();
        while (!cursor.isAfterLast()) {
            ReportEntity report = cursorToEntity(cursor);
            listReport.add(report);
            cursor.moveToNext();
        }
        cursor.close();
    }
    return listReport;
}
Also used : ReportEntity(com.ushahidi.android.app.entities.ReportEntity)

Example 17 with ReportEntity

use of com.ushahidi.android.app.entities.ReportEntity in project Ushahidi_Android by ushahidi.

the class ListReportFragment method preparePendingReports.

private void preparePendingReports() {
    mPendingReports = pendingReportAdapter.pendingReports();
    if (mPendingReports != null) {
        for (ReportEntity report : mPendingReports) {
            long rid = report.getDbId();
            report.setCategories(pendingReportAdapter.fetchCategoriesId((int) rid));
        }
    }
}
Also used : ReportEntity(com.ushahidi.android.app.entities.ReportEntity)

Example 18 with ReportEntity

use of com.ushahidi.android.app.entities.ReportEntity in project Ushahidi_Android by ushahidi.

the class MapFragment method populateMap.

/**
	 * add marker to the map
	 */
public void populateMap() {
    if (mReportModel != null) {
        mMarker.clearMapMarkers();
        for (ReportEntity reportEntity : mReportModel) {
            double latitude = 0.0;
            double longitude = 0.0;
            try {
                latitude = Double.valueOf(reportEntity.getIncident().getLatitude());
            } catch (NumberFormatException e) {
                latitude = 0.0;
            }
            try {
                longitude = Double.valueOf(reportEntity.getIncident().getLongitude());
            } catch (NumberFormatException e) {
                longitude = 0.0;
            }
            final String description = Util.limitString(reportEntity.getIncident().getDescription(), 30);
            mMarker.addMarkerWithIcon(map, latitude, longitude, reportEntity.getIncident().getTitle(), description, reportEntity.getThumbnail());
        }
    }
}
Also used : ReportEntity(com.ushahidi.android.app.entities.ReportEntity)

Aggregations

ReportEntity (com.ushahidi.android.app.entities.ReportEntity)18 Incident (com.ushahidi.java.sdk.api.Incident)3 ReportCategory (com.ushahidi.android.app.entities.ReportCategory)2 File (java.io.File)2 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 LatLng (com.google.android.gms.maps.model.LatLng)1 LatLngBounds (com.google.android.gms.maps.model.LatLngBounds)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 UploadPhotoAdapter (com.ushahidi.android.app.adapters.UploadPhotoAdapter)1 ReportsApi (com.ushahidi.android.app.api.ReportsApi)1 MediaEntity (com.ushahidi.android.app.entities.MediaEntity)1 PhotoEntity (com.ushahidi.android.app.entities.PhotoEntity)1 AddReportView (com.ushahidi.android.app.views.AddReportView)1 UshahidiException (com.ushahidi.java.sdk.UshahidiException)1 Category (com.ushahidi.java.sdk.api.Category)1 Incidents (com.ushahidi.java.sdk.api.Incidents)1 Person (com.ushahidi.java.sdk.api.Person)1