use of com.ushahidi.android.app.entities.MediaEntity in project Ushahidi_Android by ushahidi.
the class MediaDao method fetchPendingReportPhoto.
@Override
public List<MediaEntity> fetchPendingReportPhoto(int reportId) {
listMedia = new ArrayList<MediaEntity>();
final String selection = REPORT_ID + " = " + reportId + " AND " + TYPE + " =" + IMAGE;
cursor = super.query(TABLE, MEDIA_COLUMNS, selection, null, null);
if (cursor != null) {
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
MediaEntity media = cursorToEntity(cursor);
listMedia.add(media);
cursor.moveToNext();
}
cursor.close();
}
return listMedia;
}
use of com.ushahidi.android.app.entities.MediaEntity in project Ushahidi_Android by ushahidi.
the class MediaDao method fetchReportAudio.
@Override
public List<MediaEntity> fetchReportAudio(int reportId) {
listMedia = new ArrayList<MediaEntity>();
final String selection = REPORT_ID + " = " + reportId + " AND " + TYPE + " =" + AUDIO;
cursor = super.query(TABLE, MEDIA_COLUMNS, selection, null, null);
if (cursor != null) {
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
MediaEntity media = cursorToEntity(cursor);
listMedia.add(media);
cursor.moveToNext();
}
cursor.close();
}
return listMedia;
}
use of com.ushahidi.android.app.entities.MediaEntity in project Ushahidi_Android by ushahidi.
the class MediaDao method fetchReportVideo.
@Override
public List<MediaEntity> fetchReportVideo(int reportId) {
listMedia = new ArrayList<MediaEntity>();
final String selection = REPORT_ID + " = " + reportId + " AND " + TYPE + " =" + VIDEO;
cursor = super.query(TABLE, MEDIA_COLUMNS, selection, null, null);
if (cursor != null) {
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
MediaEntity media = cursorToEntity(cursor);
listMedia.add(media);
cursor.moveToNext();
}
cursor.close();
}
return listMedia;
}
use of com.ushahidi.android.app.entities.MediaEntity in project Ushahidi_Android by ushahidi.
the class AddReportActivity method setSavedReport.
/**
* Edit existing report
*
* @author henryaddo
*/
private void setSavedReport(int reportId) {
// set text part of reports
ReportEntity report = model.fetchPendingReportById(reportId);
if (report != null) {
view.mIncidentTitle.setText(report.getIncident().getTitle());
view.mIncidentDesc.setText(report.getIncident().getDescription());
view.mLongitude.setText(String.valueOf(report.getIncident().getLongitude()));
view.mLatitude.setText(String.valueOf(report.getIncident().getLatitude()));
view.mIncidentLocation.setText(report.getIncident().getLocationName());
// set date and time
setDateAndTime(report.getIncident().getDate());
}
// set Categories.
mVectorCategories.clear();
for (ReportCategory reportCategory : model.fetchReportCategories(reportId, IReportSchema.PENDING)) {
mVectorCategories.add(reportCategory.getCategoryId());
}
setSelectedCategories(mVectorCategories);
// set the photos
pendingPhoto.refresh(id);
// set news
List<MediaEntity> newsMedia = model.fetchReportNews(reportId);
if (newsMedia != null && newsMedia.size() > 0) {
view.mNews.setText(newsMedia.get(0).getLink());
}
mIsReportEditable = mOgsDao.getReportState(id) != IOpenGeoSmsSchema.STATE_SENT;
if (!mIsReportEditable) {
View[] views = new View[] { view.mBtnAddCategory, view.mIncidentDesc, view.mIncidentLocation, view.mIncidentTitle, view.mLatitude, view.mLongitude, view.mPickDate, view.mPickTime };
for (View v : views) {
v.setEnabled(false);
}
updateMarker(report.getIncident().getLatitude(), report.getIncident().getLongitude(), true);
}
}
use of com.ushahidi.android.app.entities.MediaEntity in project Ushahidi_Android by ushahidi.
the class ListReportVideoModel method getVideosByReportId.
public List<ListReportVideoModel> getVideosByReportId(int reportId) {
mVideoModel = new ArrayList<ListReportVideoModel>();
mMedia = Database.mMediaDao.fetchReportVideo(reportId);
if (mMedia != null && mMedia.size() > 0) {
for (MediaEntity item : mMedia) {
ListReportVideoModel videoModel = new ListReportVideoModel();
videoModel.setId(item.getDbId());
videoModel.setVideo(item.getLink());
mVideoModel.add(videoModel);
}
}
return mVideoModel;
}
Aggregations