Change color of Circular Progress Bar in DownloadDialog

Product: Native Android SDK

Product Version: 9.2.3

Please give a brief summary of your issue:
Change color of Circular Progress Bar in DownloadDialog

Please describe your issue and provide steps to reproduce it:
When opening the PdfViewCtrlTabHostFragment2 a downloading dialog is displayed.

I would like to change the color of this circular progress bar to the white labelled color. Is that exposed somewhere?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi Seth,

You can configure the color the progress bar by changing your colorAccent propery on the AppTheme style:

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorAccent">Your color here</color>
   ...
</resources>

styles.xml

    <style name="YourCustomAppTheme" parent="PDFTronAppTheme">
        <item name="colorAccent">@color/accent_color</item>
       ...

Could you please give this a try to see if it works for you?

Thanks,
Andrew

Sadly this doesn’t work. The resource color and style is determined on compile time but we don’t know the white label color for the client until runtime :grimacing:

Thanks for letting us know. In this case, I recommend disabling our built-in download dialog and creating your own custom download dialog.

For example, you can disable the download dialog using ViewerConfig:

        ViewerConfig viewerConfig = new ViewerConfig.Builder()
                // ...
                .showDownloadDialog(false)
                .build();
        mPdfViewCtrlTabHostFragment = ViewerBuilder2.withUri(uri)
                // ...
                .usingConfig(viewerConfig)
                .build(this);

When you launch the viewer, you can show your custom download dialog, then when the document is loaded you can hide the dialog. You can listen for document loaded events using a TabHostListener as follows:

        private PdfViewCtrlTabHostFragment2 mPdfViewCtrlTabHostFragment;
        // ... 
        
        mPdfViewCtrlTabHostFragment.addHostListener(new PdfViewCtrlTabHostFragment2.TabHostListener() {
            @Override
            public void onTabDocumentLoaded(String tag) {
                // Hide my custom download dialog on document loaded
            }

            // ...

Thank you @Branden_Fung! I actually did this exact thing! I forgot to add a comment here on this post. Your solution here works great. Thanks! Hopefully this helps others who have dynamic white label colors in their app :slight_smile:

Glad this solution has worked for you, please feel free to reach out to us again if you encounter any new issues!