How dimuthuupe/androidpdfviewer works
Project type and purpose
• This is an Android library (“android-pdf-viewer” module) for embedding PDF viewing capability into Android apps, plus a “sample” Android application module that demonstrates usage.
• The library provides a custom View (PDFView) that decodes PDF pages (via PdfiumAndroid native libs), handles gestures/animations, caching, link handling, and exposes a fluent Configurator API.
File structure
• Top-level:
• android-pdf-viewer/ ← library module
• sample/ ← demo Android app
• gradle wrapper, settings.gradle, root build.gradle
• Inside the library:
• java/com/github/barteksc/pdfviewer/ – core classes
• sub-packages: exception, link, listener (observer callbacks), model, scroll, source (DocumentSource implementations), util
• res/ – drawable scroll handles, attrs, styles
• build scripts (build.gradle, bintray.gradle)
• Inside the sample:
• PDFViewActivity – shows layout with <com.github.barteksc.pdfviewer.PDFView>
• sample.pdf in assets
• layouts, menus, resource qualifiers, strings, styles
README for additional insights
• Confirms architecture: PDFView is entry point, Configurator builder pattern, multiple DocumentSource providers, listener callbacks, scroll handle interface, link handler interface.
• Uses PdfiumAndroid native library under the hood for decoding.
Essential architectural elements
[Sample App UI] → [PDFView widget] → [Configurator] → [DocumentSource] → [PagesLoader] → [DecodingAsyncTask] → [PdfiumAndroid native] → [Bitmap] → [RenderingHandler] → [Canvas/UI]
• Around it, overlay:
• Gesture managers (DragPinchManager, AnimationManager) intercepting UI events
• CacheManager caching bitmaps
• Listener interfaces & LinkHandle entry points