$ show foobnix/LibreraReader
LibreraReader is a full-featured, multi-format e-book reader for Android (with an experimental iOS/desktop port via Kotlin Multiplatform). It supports PDF, EPUB, MOBI, DjVu, FB2, CBR/CBZ, DOC/DOCX, ODT, RTF, and many other formats through a combination of native C/C++ libraries (MuPDF, DjVuLibre, libmobi, libantiword, libwebp, liblame) and Java-based document translators (ODF/SVM/WMF to HTML/SVG). The app provides a rich reading experience with customizable themes, text-to-speech, OPDS catalog browsing, cloud sync (Google Drive, Dropbox), annotations, bookmarks, and a smart reflow feature for scanned documents. The codebase is large and monolithic, with significant third-party code vendored into the source tree. Development has been frozen (as noted in the README), so the project is in a maintenance-only state. Despite its age and complexity, it contains several well-crafted, reusable utility libraries (e.g., LWXML streaming XML framework, SVM-to-SVG translator, and general-purpose Android utilities) that could be extracted for other projects.
The LLM identified 4 files worth highlighting for reuse:
A lightweight, event-driven XML streaming framework (LWXML) that provides a full pipeline of readers, writers, filters, and translators. It is cleanly abstracted with interfaces for reading/writing XML events and supports composition (tee, filter, pushback). This framework is used internally for ODF document conversion but is entirely self-contained and could be reused in any Java project needing efficient, streaming XML processing without DOM overhead.
A complete converter from SVM (StarView Metafile) format to SVG. It parses binary SVM actions and translates each into corresponding SVG elements via a pluggable translator pattern. The code is well-structured, with separate translators for different action types (text, polygons, colors, etc.) and handles complex state management (color, font, map mode). This is a standalone conversion library that could be extracted for any project requiring SVM/SVG rendering.
A utility class for reading and writing files with built-in per-file locking and a read cache. It provides methods for readObject/writeObject (serialization), readString/writeString, and readBytes/writeBytes, all with optional synchronization. The design is simple and robust, making it easy to reuse for any Android (or Java) project that needs thread-safe file persistence with caching.
A utility class for converting between density-independent pixels (dp), scaled pixels (sp), and raw pixels, as well as detecting screen size and e-ink displays. It encapsulates all Android display metrics in one place and provides reusable static methods. This is a common pattern in Android apps, but the implementation here is clean, well-documented, and easily extractable.