$ show plateaukao/einkbro
EinkBro is a full-featured Android WebView-based browser specifically optimized for e-ink displays. It provides a rich reading experience with features like ad blocking (via a native C++ engine forked from Brave), paragraph-level translation (Google/DeepL/OpenAI/Gemini), text-to-speech (Edge TTS, system TTS, Web Speech polyfill), reader mode, EPUB reading, user script support, and AI agent capabilities (chat-with-web, multi-step browsing tasks). The architecture is a monolith Android app with three Gradle modules (app, ad-filter, adblock-client) using Kotlin, Jetpack Compose, Koin DI, Room database, and OkHttp. Key entry points include BrowserActivity (main browser), EBWebView (custom WebView wrapper), and various delegate classes for tab management, translation, AI chat, and gesture handling. The codebase demonstrates strong engineering practices with extensive unit tests, a well-structured delegate pattern, and several reusable components such as type-safe SharedPreferences delegates, a standalone PDF parser, and a jsdom-based test harness for WebView-injected JavaScript.
The LLM identified 4 files worth highlighting for reuse:
A fully functional in-memory implementation of Android's SharedPreferences interface for unit testing. Supports listeners, type checking (throws ClassCastException on mismatch), and real read-after-write semantics. Can be extracted and reused in any Android project to replace SharedPreferences in tests without mocking frameworks.
A set of Kotlin property delegates (BooleanPreference, IntPreference, StringPreference, etc.) that provide type-safe access to SharedPreferences. Each delegate handles default values, commit vs apply, and can be observed via a callback. This pattern is cleanly isolated and can be extracted as a small library for any Android project using SharedPreferences.
A jsdom-based test harness for WebView-injected JavaScript assets. It creates a mock androidApp bridge (with controllable getTranslation responses), sets up IntersectionObserver stubs, and provides a reusable setup for testing DOM manipulation scripts. This pattern is directly applicable to any project that injects JavaScript into WebView and needs to test it in a Node.js environment.
A standalone, read-only PDF parser written in pure Kotlin. It handles classic and cross-reference streams, object streams, FlateDecode with PNG predictors, and builds a COS object model. No external PDF libraries are used. This component demonstrates deep understanding of the PDF specification and can be extracted as a lightweight PDF parsing library for Android or JVM projects.