Search in sources :

Example 6 with MediaEntity

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;
}
Also used : MediaEntity(com.ushahidi.android.app.entities.MediaEntity)

Example 7 with MediaEntity

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;
}
Also used : MediaEntity(com.ushahidi.android.app.entities.MediaEntity)

Example 8 with MediaEntity

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;
}
Also used : MediaEntity(com.ushahidi.android.app.entities.MediaEntity)

Example 9 with MediaEntity

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);
    }
}
Also used : ReportCategory(com.ushahidi.android.app.entities.ReportCategory) ReportEntity(com.ushahidi.android.app.entities.ReportEntity) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) AddReportView(com.ushahidi.android.app.views.AddReportView) MediaEntity(com.ushahidi.android.app.entities.MediaEntity)

Example 10 with MediaEntity

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;
}
Also used : MediaEntity(com.ushahidi.android.app.entities.MediaEntity)

Aggregations

MediaEntity (com.ushahidi.android.app.entities.MediaEntity)22 PhotoEntity (com.ushahidi.android.app.entities.PhotoEntity)6 ReportCategory (com.ushahidi.android.app.entities.ReportCategory)3 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 ReportEntity (com.ushahidi.android.app.entities.ReportEntity)1 AddReportView (com.ushahidi.android.app.views.AddReportView)1 ArrayList (java.util.ArrayList)1