stfalcon-studio / ChatKit

Android library. Flexible components for chat UI implementation with flexible possibilities for styling, customizing and data management. Made by Stfalcon
http://stfalcon.com
Apache License 2.0
3.67k stars 811 forks source link

How to show upload & download progress for Images,Videos ? #109

Open satnamvision opened 6 years ago

satnamvision commented 6 years ago

how to show upload download progress or progress bar for the images,videos & other custom content types. I am using default implementation of messageAdapter with some custom content type using messageHolder. So my problem is show progress bar while a video/image file is getting upload on the server. Is there any that can help me with this or do i need to create custom Message Adapter?

ChiHwe commented 6 years ago

hi, you found way to upload video ? if yes, can show me how to do it ?

tusharuit25 commented 6 years ago

I am struggling with same problem

satnamvision commented 6 years ago

I don't think so. I am using firebase as backend. so I was purposing to change the sequences of operations for uploading & downloading file. I haven't implemented it yet but that was the only way I have found.

ChrisLMills commented 5 years ago

This may be seen as a hack, but this is how I handled it: (I'm also using Firebase)

ImageLoader imageLoader = new ImageLoader() { @Override public void loadImage(ImageView imageView, String url) {

            RelativeLayout imageParent = (RelativeLayout) imageView.getParent();

            ProgressBar spinner = new ProgressBar(getContext());
            spinner.setLayoutParams(new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.MATCH_PARENT,
                    RelativeLayout.LayoutParams.MATCH_PARENT
                    ));
            spinner.setIndeterminate(true);

            imageParent.addView(spinner);

            //Ok, this is a hack. I couldn't get the onResourceReady method for Glide to work, at which
            //point I would have set the spinner to invisible. However, bringing the imageView to the
            //front seems to do the trick.
            imageView.bringToFront();

            imageView.getLayoutParams().width = RelativeLayout.LayoutParams.MATCH_PARENT;
            Glide.with(MessageListFragment.this).load(url).into(imageView);
        }
    };