Search in sources :

Example 6 with PostImage

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

the class SocialCommentView method onPostImageClicked.

@Override
public void onPostImageClicked(ImageView imageView, String imageUrl, int position, UUID postId) {
    if (comment != null && comment.getId().equals(postId)) {
        ArrayList<String> images = new ArrayList<>();
        for (PostImage image : comment.getImages()) {
            for (PostImageResize resize : image.getResizes()) {
                if (resize.getQuality().equals(ImageQuality.ORIGINAL)) {
                    images.add(resize.getLogoUrl());
                    break;
                }
            }
        }
        ImageViewerOverlayView overlayView = new ImageViewerOverlayView(getContext());
        overlayView.setImagesCount(images.size());
        StfalconImageViewer imageViewer = new StfalconImageViewer.Builder<>(getContext(), images, (loadingImageView, image) -> Glide.with(getContext()).load(image).into(loadingImageView)).withStartPosition(position).withHiddenStatusBar(false).withTransitionFrom(imageView).withOverlayView(overlayView).withImageChangeListener(overlayView).show();
        overlayView.setImageViewer(imageViewer);
    }
}
Also used : PostImage(io.swagger.client.model.PostImage) ArrayList(java.util.ArrayList) SpannableString(android.text.SpannableString) StfalconImageViewer(com.stfalcon.imageviewer.StfalconImageViewer) PostImageResize(io.swagger.client.model.PostImageResize)

Aggregations

PostImage (io.swagger.client.model.PostImage)6 SpannableString (android.text.SpannableString)4 PostImageResize (io.swagger.client.model.PostImageResize)4 Point (android.graphics.Point)2 TextPaint (android.text.TextPaint)2 Display (android.view.Display)2 WindowManager (android.view.WindowManager)2 StfalconImageViewer (com.stfalcon.imageviewer.StfalconImageViewer)2 EditPost (io.swagger.client.model.EditPost)2 ImageQuality (io.swagger.client.model.ImageQuality)2 NewPostImage (io.swagger.client.model.NewPostImage)2 ArrayList (java.util.ArrayList)2 NewPost (io.swagger.client.model.NewPost)1