$ show goweii/WanAndroid
WanAndroid is a polished, feature-rich Android client for the WanAndroid platform (wanandroid.com), a Chinese community for Android developers. The application provides comprehensive browsing of articles, projects, WeChat articles, knowledge trees, navigation, Q&A, book tutorials, and daily news aggregation from multiple Chinese sources. It implements a classic MVP architecture with a modular project structure (app, basic/core, basic/ui, basic/utils, basic/l10n, component/ad). Key entry points include SplashActivity and MainActivity (hosting a bottom-tab fragment container). The system heavily leverages OkHttp/RxHttp for network requests to the WanAndroid REST API, DiskLruCache for offline caching, Room for local persistence (read-later and read-history), and EventBus for cross-component events. Beyond vanilla browsing, it features a custom WebView subsystem (WebInstance, WebContainer) with resource interception, offline HTML/ CSS caching, a reading mode using readability4j and Jsoup, and JavaScript injection for image clicks. It also includes text-to-speech (TTS) via Android TTS engine with AI-powered summarization, biometric quick login, QR code scanning, card/article sharing, a coin/ranking gamification system, and in-app updates. External dependencies include Google AdMob for ads, optional AI provider APIs (e.g., DeepSeek), and the WanAndroid server endpoints. The codebase is a mix of Java and Kotlin, with several reusable custom UI components like BottomDrawerLayout, ImagePreviewView, CollectView, and custom pull-to-refresh headers with Chinese poetry.
The LLM identified 5 files worth highlighting for reuse:
A fully custom BottomDrawerLayout that supports drag-to-expand/collapse, nested scrolling coordination, and a configurable handle view. It uses custom OnDragListener and ScrollCompat to delegate drag events and handle overscroll physics. The widget is self-contained, relies only on standard Android View classes, and can be extracted for use in any Android app needing a bottom sheet with customizable behavior.
A TTS manager that wraps the Android TextToSpeech engine and integrates with a notification (TtsNotification) for playback controls. It provides play, pause, resume, skip, and stop functionality, supports streaming text via Kotlin coroutines (Playable), and handles lifecycle with context bindings. The component is decoupled from app-specific logic and can be reused to add TTS capabilities to any Android app.
A singleton disk cache built on DiskLruCache that stores JSON-serializable objects with MD5-based keys. It supports put, get, remove, and clear operations, configurable cache size and directory, and uses callback listeners for async access. The class is generic and could be extracted to cache any serializable data in any Android or Java project, demonstrating a clean abstraction over DiskLruCache.
Manages a pool of reusable WebView instances (ResuableWebView) to avoid memory leaks and reduce WebView creation overhead. Provides obtain() (with optional URL) and recycle() methods, handles WebView destruction, cookie syncing, and scroll position restoration. The pattern is applicable across Android apps that need to embed multiple WebViews efficiently and can be extracted with minimal changes.
A utility class that uses reflection to detect notch screens across multiple OEMs (Huawei, Xiaomi, OPPO, Vivo, etc.) by reading internal system resource IDs. It provides methods to check if a device has a notch and to get the notch height. This solves a recurring Android UI problem and can be reused directly in any app needing safe display area calculations.