Search in sources :

Example 6 with ThemePage

use of forpdateam.ru.forpda.api.theme.models.ThemePage in project ForPDA by RadiationX.

the class EditPostFragment method sendMessage.

private void sendMessage() {
    messagePanel.setProgressState(true);
    postForm.setMessage(messagePanel.getMessage());
    List<AttachmentItem> attachments = messagePanel.getAttachments();
    postForm.getAttachments().clear();
    for (AttachmentItem item : attachments) {
        postForm.addAttachment(item);
    }
    subscribe(RxApi.EditPost().sendPost(postForm), s -> {
        messagePanel.setProgressState(false);
        if (s.getId() != 0) {
            TabFragment fragment = TabManager.get().get(getParentTag());
            if (fragment != null) {
                if (fragment instanceof ThemeFragment) {
                    ThemeFragment themeFragment = (ThemeFragment) fragment;
                    if (postForm.getType() == TYPE_EDIT_POST) {
                        themeFragment.onEditPostCompleted(s);
                    } else {
                        themeFragment.onSendPostCompleted(s);
                    }
                }
            }
            TabManager.get().remove(EditPostFragment.this);
        }
    }, new ThemePage(), v -> loadData());
}
Also used : ThemePage(forpdateam.ru.forpda.api.theme.models.ThemePage) TabFragment(forpdateam.ru.forpda.ui.fragments.TabFragment) AttachmentItem(forpdateam.ru.forpda.api.theme.editpost.models.AttachmentItem) ThemeFragment(forpdateam.ru.forpda.ui.fragments.theme.ThemeFragment)

Aggregations

ThemePage (forpdateam.ru.forpda.api.theme.models.ThemePage)6 JavascriptInterface (android.webkit.JavascriptInterface)1 AttachmentItem (forpdateam.ru.forpda.api.theme.editpost.models.AttachmentItem)1 Poll (forpdateam.ru.forpda.api.theme.models.Poll)1 PollQuestion (forpdateam.ru.forpda.api.theme.models.PollQuestion)1 PollQuestionItem (forpdateam.ru.forpda.api.theme.models.PollQuestionItem)1 ThemePost (forpdateam.ru.forpda.api.theme.models.ThemePost)1 TabFragment (forpdateam.ru.forpda.ui.fragments.TabFragment)1 ThemeFragment (forpdateam.ru.forpda.ui.fragments.theme.ThemeFragment)1 Matcher (java.util.regex.Matcher)1