Search in sources :

Example 1 with RemoteCreateCommentPayload

use of org.wordpress.android.fluxc.store.CommentStore.RemoteCreateCommentPayload in project WordPress-Android by wordpress-mobile.

the class CommentDetailFragment method submitReply.

/*
     * post comment box text as a reply to the current comment
     */
private void submitReply() {
    if (mComment == null || !isAdded() || mIsSubmittingReply)
        return;
    if (!NetworkUtils.checkConnection(getActivity()))
        return;
    final String replyText = EditTextUtils.getText(mEditReply);
    if (TextUtils.isEmpty(replyText))
        return;
    // disable editor, hide soft keyboard, hide submit icon, and show progress spinner while submitting
    mEditReply.setEnabled(false);
    EditTextUtils.hideSoftInput(mEditReply);
    mSubmitReplyBtn.setVisibility(View.GONE);
    final ProgressBar progress = (ProgressBar) getView().findViewById(R.id.progress_submit_comment);
    progress.setVisibility(View.VISIBLE);
    mIsSubmittingReply = true;
    AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_REPLIED_TO);
    // Pseudo comment reply
    CommentModel reply = new CommentModel();
    reply.setContent(replyText);
    mDispatcher.dispatch(CommentActionBuilder.newCreateNewCommentAction(new RemoteCreateCommentPayload(mSite, mComment, reply)));
}
Also used : RemoteCreateCommentPayload(org.wordpress.android.fluxc.store.CommentStore.RemoteCreateCommentPayload) ProgressBar(android.widget.ProgressBar) CommentModel(org.wordpress.android.fluxc.model.CommentModel)

Aggregations

ProgressBar (android.widget.ProgressBar)1 CommentModel (org.wordpress.android.fluxc.model.CommentModel)1 RemoteCreateCommentPayload (org.wordpress.android.fluxc.store.CommentStore.RemoteCreateCommentPayload)1