Search in sources :

Example 1 with CommentList

use of org.wordpress.android.models.CommentList in project WordPress-Android by wordpress-mobile.

the class CommentsListFragment method moderateSelectedComments.

private void moderateSelectedComments(final CommentStatus newStatus) {
    final CommentList selectedComments = getAdapter().getSelectedComments();
    final CommentList updateComments = new CommentList();
    // build list of comments whose status is different than passed
    for (CommentModel comment : selectedComments) {
        if (CommentStatus.fromString(comment.getStatus()) != newStatus) {
            updateComments.add(comment);
        }
    }
    if (updateComments.size() == 0)
        return;
    if (!NetworkUtils.checkConnection(getActivity()))
        return;
    getAdapter().clearSelectedComments();
    finishActionMode();
    moderateComments(updateComments, newStatus);
}
Also used : CommentList(org.wordpress.android.models.CommentList) CommentModel(org.wordpress.android.fluxc.model.CommentModel)

Example 2 with CommentList

use of org.wordpress.android.models.CommentList in project WordPress-Android by wordpress-mobile.

the class CommentsListFragment method deleteSelectedComments.

private void deleteSelectedComments(boolean deletePermanently) {
    if (!NetworkUtils.checkConnection(getActivity())) {
        return;
    }
    final int dlgId = deletePermanently ? CommentDialogs.ID_COMMENT_DLG_DELETING : CommentDialogs.ID_COMMENT_DLG_TRASHING;
    final CommentList selectedComments = getAdapter().getSelectedComments();
    CommentStatus newStatus = CommentStatus.TRASH;
    if (deletePermanently) {
        newStatus = CommentStatus.DELETED;
    }
    dismissDialog(dlgId);
    finishActionMode();
    moderateComments(selectedComments, newStatus);
}
Also used : CommentList(org.wordpress.android.models.CommentList) CommentStatus(org.wordpress.android.fluxc.model.CommentStatus)

Aggregations

CommentList (org.wordpress.android.models.CommentList)2 CommentModel (org.wordpress.android.fluxc.model.CommentModel)1 CommentStatus (org.wordpress.android.fluxc.model.CommentStatus)1