gjiazhe/PanoramaImageView

PanoramaImageView How to use with Glide?

Opened this issue · 5 comments

Hi,

I'm using Glide for load images and my image not work well how can fix this issue.

Now only work when I add an image with android:src on xml file.

It is possible to load images from url? like networkimageview

I'm having the same issue

You can use the view with Glide if you download the image to a simple target and set it to the view after:

GlideApp.with(panoramaImageView)
                .asBitmap()
                .load(url)
                .listener(listener)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                               panoramaImageView.setImageBitmap(resource);
                    }
                });

You can use the view with Glide if you download the image to a simple target and set it to the view after:

GlideApp.with(panoramaImageView)
                .asBitmap()
                .load(url)
                .listener(listener)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                               panoramaImageView.setImageBitmap(resource);
                    }
                });

Thanks @enel1989
Worked for me, but not able to scroll yet

You can use the view with Glide if you download the image to a simple target and set it to the view after:

GlideApp.with(panoramaImageView)
                .asBitmap()
                .load(url)
                .listener(listener)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                               panoramaImageView.setImageBitmap(resource);
                    }
                });

Thanks for your answer that was helped me also SimpleTarget depreciated below code may help someone

 Glide.with(this)
                .asBitmap()
                .load("https://www.emlakdream.com/wp-content/uploads/2019/06/bogazici-panorama-unye-1.jpg")
                .error(R.drawable.background)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new CustomTarget<Bitmap>() {

                    @Override
                    public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                        panoramaImageView.setImageBitmap(resource);
                    }

                    @Override
                    public void onLoadCleared(@Nullable Drawable placeholder) { }
                });