Search in sources :

Example 1 with CommentsApi

use of com.ushahidi.android.app.api.CommentsApi in project Ushahidi_Android by ushahidi.

the class FetchReportsComments method fetchReportComments.

private void fetchReportComments(Bundle bundle) {
    if (bundle != null) {
        int reportid = bundle.getInt("reportid");
        status = new CommentsApi().saveComments(reportid) ? 0 : 99;
    }
}
Also used : CommentsApi(com.ushahidi.android.app.api.CommentsApi)

Example 2 with CommentsApi

use of com.ushahidi.android.app.api.CommentsApi in project Ushahidi_Android by ushahidi.

the class UploadComments method addComments.

private int addComments(Bundle bundle) {
    CommentFields comment = new CommentFields();
    CommentsApi commentApi = new CommentsApi();
    if (bundle != null) {
        Comment c = new Comment();
        c.setAuthor(bundle.getString("comment_author"));
        c.setDescription(bundle.getString("comment_description"));
        c.setReportId(bundle.getInt("report_id"));
        comment.fill(c);
        comment.setEmail(bundle.getString("comment_email"));
        Response response = commentApi.submit(comment);
        if (response != null) {
            if (response.getErrorCode() == 0) {
                commentApi.saveComments(bundle.getInt("report_id"));
            }
        }
    }
    return 1;
}
Also used : Response(com.ushahidi.java.sdk.api.json.Response) Comment(com.ushahidi.java.sdk.api.Comment) CommentFields(com.ushahidi.java.sdk.api.CommentFields) CommentsApi(com.ushahidi.android.app.api.CommentsApi)

Aggregations

CommentsApi (com.ushahidi.android.app.api.CommentsApi)2 Comment (com.ushahidi.java.sdk.api.Comment)1 CommentFields (com.ushahidi.java.sdk.api.CommentFields)1 Response (com.ushahidi.java.sdk.api.json.Response)1