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;
}
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));
}
}
}
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());
}
}
}
Aggregations