zotero / zotero-android

Zotero for Android
Other
377 stars 36 forks source link

Adding Page Counter & In-Pdf quick navigation bottom bar to Pdf Screen #121

Closed Dima-Android closed 3 months ago

Dima-Android commented 9 months ago

I’ve been looking through documentation and even tried peering through pspdfkit’s decompiled obfuscated code but I haven’t found the way to easily add page counter + back and forth arrows to the PdfFragment component that we are using from the PSPDFKIT’s library. The thumbnail bar is available as an attachable component for PdfFragment (we’ve added it earlier), but not these views.

Good news is that yes indeed PSDPFKIT does have those components as part of it and you can see them in their Catalog Sample app. They are integrated into the PdfActivity, that we cannot use with our Jetpack Compose, but it’s also available in their Experimental PdfUiFragment (which is supposed to support everything that PdfActivity has without us having to attach any extra views). There is one problem though.The PSPDFKIT’s UI consists of two components - top bar (where you have various pspdfkit’s buttons that allow you do add/edit annotations, their own search bar and so on) and bottom bar (which consists of thumbnail bar, arrows, and page counter). I’ve been trying to find a way to disable the top bar without disabling the bottom bar, but I wasn’t able to find how. They seem to be tied up together and controlled by one boolean switch in config. I’ve tried hacking this, by going through the entire UI node tree and locating the bottom bar and manually just removing it from the view tree. I succeeded at it, but there is a problem. There is no way to prevent a small visual glitch from happening: When opening a PDF user is able to see a top bar for about half a second. I’ve been trying to improve upon it but wasn’t successful. At the end I’ve noticed a bug within the PSPDFKIT’s PdfUiFragment itself - if you open their Catalog Sample app and you set the boolean flag of “show pspdfkit’s UI” to false you will see is the same exact glitch happening.

So we have a situation of the bug within the PSPDFKIT’s library and we also have to resort to hacking to get rid of the top bar. I will write them an email describing our problem and ask to either point out to how I can implement what we need with PdfFragment we already using (maybe there is an attachable view for what we need and I haven’t found it), or how can we disable just the top bar in their PdfUiFragment.