Bubble-Picker icon indicating copy to clipboard operation
Bubble-Picker copied to clipboard

is there a way to load image from network ?

Open ismailtosun opened this issue 6 years ago • 5 comments

ismailtosun avatar Dec 31 '17 00:12 ismailtosun

Did you manage to find a work-around for this? This is exactly what I need. @ismailtosun @igalata Irina, can you tell me if there's a way to do this?

MilanVucic avatar Jun 16 '18 09:06 MilanVucic

@ismailtosun @MilanVucic You can simply do it using glide or picasso like:

Glide.with(context)
               .asBitmap()
               .load(url)
               .into(new SimpleTarget<Bitmap>() {
                   @Override
                   public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {

                       ImageView imageView = new ImageView(context);
                       imageView.setImageBitmap(resource);
                       Drawable image = imageView.getDrawable();
                       item.setIcon(image);
                       item.setBackgroundImage(image);
                   }
               });

ibrahimAlii avatar Jun 27 '18 19:06 ibrahimAlii

The only problem with this piece of code is that this is asynchronous while getItem is not, and thus it'll just return the item before the actual image is set as the icon. I like the idea though.

MilanVucic avatar Jun 27 '18 20:06 MilanVucic

@MilanVucic Well you can use AysncTask and return PickerItem and wait until process finish, but it will block the UI for some time.

Or @igalata should suggest more effective solution.

ibrahimAlii avatar Jun 30 '18 13:06 ibrahimAlii

@ismailtosun @MilanVucic @ibrahimAlii please review my lib was developed based on this lib. I fixed this issue https://github.com/hantrungkien/Bubble-Picker

hantrungkien avatar Jul 20 '18 16:07 hantrungkien