Search in sources :

Example 1 with NewPostImage

use of io.swagger.client.model.NewPostImage in project android-client by GenesisVision.

the class PostDetailsPresenter method handleGetOriginalCommentSuccess.

private void handleGetOriginalCommentSuccess(EditablePost comment) {
    getOriginalCommentSubscription.unsubscribe();
    editComment = new EditPost();
    editComment.setId(comment.getId());
    newComment = new NewPost();
    newComment.setImages(new ArrayList<>());
    newComment.setText(comment.getTextOriginal());
    int i = 0;
    for (PostImage image : comment.getImages()) {
        NewPostImage newPostImage = new NewPostImage();
        newPostImage.setImage(image.getId());
        newPostImage.setPosition(i);
        newComment.getImages().add(newPostImage);
        getViewState().createNewImageView();
        getViewState().updateNewImageView(image.getId());
        i++;
    }
    updateImageCommentButtonEnabled();
    updateSendCommentButtonEnabled();
    getViewState().showEditComment(comment);
}
Also used : PostImage(io.swagger.client.model.PostImage) NewPostImage(io.swagger.client.model.NewPostImage) NewPostImage(io.swagger.client.model.NewPostImage) NewPost(io.swagger.client.model.NewPost) EditPost(io.swagger.client.model.EditPost)

Example 2 with NewPostImage

use of io.swagger.client.model.NewPostImage in project android-client by GenesisVision.

the class PostDetailsPresenter method onPostImageClicked.

@Override
public void onPostImageClicked(ImageView image, String imageId) {
    int position = 0;
    for (NewPostImage postImage : newComment.getImages()) {
        if (postImage.getImage().equals(imageId)) {
            break;
        }
        position++;
    }
    getViewState().showImageViewer(image, position, newComment.getImages());
}
Also used : NewPostImage(io.swagger.client.model.NewPostImage)

Example 3 with NewPostImage

use of io.swagger.client.model.NewPostImage in project android-client by GenesisVision.

the class CreatePostPresenter method handleGetOriginalPostSuccess.

private void handleGetOriginalPostSuccess(EditablePost post) {
    getOriginalPostSubscription.unsubscribe();
    editPost = new EditPost();
    editPost.setId(post.getId());
    this.post.setImages(new ArrayList<>());
    this.post.setText(post.getTextOriginal());
    int i = 0;
    for (PostImage image : post.getImages()) {
        NewPostImage newPostImage = new NewPostImage();
        newPostImage.setImage(image.getId());
        newPostImage.setPosition(i);
        this.post.getImages().add(newPostImage);
        getViewState().createNewImageView();
        getViewState().updateNewImageView(image.getId());
        i++;
    }
    updatePublishButtonEnabled();
    getViewState().setText(this.post.getText(), this.post.getText().length());
    getViewState().showProgressBar(false);
}
Also used : PostImage(io.swagger.client.model.PostImage) NewPostImage(io.swagger.client.model.NewPostImage) NewPostImage(io.swagger.client.model.NewPostImage) EditPost(io.swagger.client.model.EditPost)

Example 4 with NewPostImage

use of io.swagger.client.model.NewPostImage in project android-client by GenesisVision.

the class CreatePostPresenter method handleUploadImageResponse.

private void handleUploadImageResponse(UploadResult response) {
    uploadImageSubscription.unsubscribe();
    getViewState().updateNewImageView(response.getId().toString());
    NewPostImage newPostImage = new NewPostImage();
    newPostImage.setImage(response.getId().toString());
    newPostImage.setPosition(post.getImages().size());
    post.getImages().add(newPostImage);
    ImageUtils.deleteTempFile(newImageFile);
    updatePublishButtonEnabled();
}
Also used : NewPostImage(io.swagger.client.model.NewPostImage)

Example 5 with NewPostImage

use of io.swagger.client.model.NewPostImage in project android-client by GenesisVision.

the class CreatePostPresenter method onDeleteImageClicked.

@Override
public void onDeleteImageClicked(NewPostImageView imageView, String imageId) {
    for (NewPostImage postImage : post.getImages()) {
        if (postImage.getImage().equals(imageId)) {
            post.getImages().remove(postImage);
            break;
        }
    }
    getViewState().deleteImageView(imageView);
    updatePublishButtonEnabled();
}
Also used : NewPostImage(io.swagger.client.model.NewPostImage)

Aggregations

NewPostImage (io.swagger.client.model.NewPostImage)8 EditPost (io.swagger.client.model.EditPost)2 PostImage (io.swagger.client.model.PostImage)2 NewPost (io.swagger.client.model.NewPost)1