PRDownloader icon indicating copy to clipboard operation
PRDownloader copied to clipboard

How to download multiple files and display the progress in a recycler view using viewholder

Open adtoba opened this issue 6 years ago • 6 comments

I need a quick response

adtoba avatar Sep 18 '18 23:09 adtoba

It is very similar to the example added in the example. You can easily do it with recycler view.

amitshekhariitbhu avatar Sep 19 '18 05:09 amitshekhariitbhu

It was not fully implemented. They created several progress bar and buttons in the layout manually.. Recycler view was not implemented.

I'd appreciate if you can just put me through. Even if you can do it over email right here

On Wed, Sep 19, 2018, 6:04 AM AMIT SHEKHAR [email protected] wrote:

It is very similar to the example added in the example. You can easily do it with recycler view.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MindorksOpenSource/PRDownloader/issues/74#issuecomment-422654070, or mute the thread https://github.com/notifications/unsubscribe-auth/AXHPf1RFbBAyEx6haJYIJovm_5vfmfz2ks5ucdBagaJpZM4WvBI6 .

adtoba avatar Sep 19 '18 07:09 adtoba

This is pretty easy to do. The ReadMe and example already explains it.

JideGuru avatar Feb 02 '19 01:02 JideGuru

This is pretty easy to do. The ReadMe and example already explains it.

i also need prdownloader in recyclerview to download multiple files with progress.

it will be very helpful if you can provide me a demo for it.

Thanks, Regards.

Jatin-Sondagar avatar Jul 02 '20 14:07 Jatin-Sondagar

You can simply fix the issue following this task.

PRDownloader.download(pdfUrl, dirPath, fileName)
                .setTag(fileName)
                .build()

Declare the PRDownloader into the ViewHolder in Recycler view. setTag() is very important to control the download.

Here I add my code.

PRDownloader.download(pdfUrl, dirPath, fileName)
                .setTag(fileName)
                .build()
                .setOnStartOrResumeListener(() -> {

                })
                .setOnPauseListener(() -> {

                })
                .setOnCancelListener(() -> {

                })
                .setOnProgressListener(progress -> {
                    long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                    progressBar.setProgress((int) progressPercent);
                })
                .start(new OnDownloadListener() {

                    @Override
                    public void onDownloadComplete() {
                        relativeLayout.setVisibility(View.GONE);
                    }

                    @Override
                    public void onError(Error error) {

                    }
                });

If you want to cancel each download you can use this. PRDownloader.cancel("You're Predefined Tag");

Tarikul711 avatar Jul 21 '20 15:07 Tarikul711

@Tarikul711 how about to pause and resume?

user74273 avatar Jan 15 '22 15:01 user74273