VEINHORN / ScrollGalleryView

:bridge_at_night: Android image gallery with bottom scroll view
MIT License
531 stars 157 forks source link

Glide with ScrollGalleryView is real? #47

Closed iamnotacoder-djs closed 5 years ago

iamnotacoder-djs commented 7 years ago

Hi, Thanks a lot for your library. It really helps. But I have a strange error and dont know how to handle it.(Sry for duplicate of ^that text) Console sometimes returns me a fatal error with "ImageFragment.onSaveInstanceState getBitmap()' on a null"... Plus. I can not zoom picture. Initialization here:

List<String> s = g.fromJson(stringExtra, listType);

List<MediaInfo> infos = new ArrayList<>(s.size());
for (String url : s)
    infos.add(MediaInfo.mediaLoader(new MediaLoader() {
        @Override
        public boolean isImage() {
            return true;
        }

        @Override
        public void loadMedia(Context context, ImageView imageView, SuccessCallback callback) {
            Glide
                    .with(context)
                    .load(url)
                    .asBitmap()
                    .into(imageView);
        }

        @Override
        public void loadThumbnail(Context context, ImageView thumbnailView, SuccessCallback callback) {
        }
    }));
scrollGalleryView
        .setThumbnailSize(100)
        .setZoom(true)
        .hideThumbnails(true)
        .setFragmentManager(supportFragmentManager)
        .addMedia(infos);
Mak601 commented 7 years ago
            @Override
            public void loadMedia(Context context, final ImageView imageView, final SuccessCallback callback)
            {

                Glide.with(context).load(image.getImage_file())
                        .asBitmap().fitCenter().into(new SimpleTarget<Bitmap>()
                {
                    @Override
                    public void onResourceReady(Bitmap bitmap, GlideAnimation<? super Bitmap> glideAnimation)
                    {
                        imageView.setImageBitmap(bitmap);
                        callback.onSuccess();
                    }
                });

            }
VEINHORN commented 5 years ago

There is GlideImageLoader which is based on Glide library. It's was added in #73. So now it's available in separate module.