|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +### Building |
| 8 | +- `./gradlew assembleProDebug` - Build the Pro debug variant |
| 9 | +- `./gradlew assembleProDebugAndroidTest` - Build the Pro debug test APK |
| 10 | +- `./gradlew assembleLiteDebug` - Build the Lite debug variant |
| 11 | +- `./gradlew bundleProRelease` - Build Pro release bundle for Play Store |
| 12 | +- `./gradlew bundleLiteRelease` - Build Lite release bundle for Play Store |
| 13 | +- `./build-test.sh` - Convenience script to build Pro debug and test APKs |
| 14 | + |
| 15 | +### Testing |
| 16 | +- `./gradlew connectedAndroidTest` - Run instrumented tests on connected device |
| 17 | +- `fastlane android tests` - Alternative way to run connected tests |
| 18 | + |
| 19 | +### Linting |
| 20 | +- `./gradlew lint` - Run Android lint checks (configured to not abort on errors) |
| 21 | + |
| 22 | +### Deployment |
| 23 | +- `fastlane android deployPro` - Deploy Pro version to Google Play internal track |
| 24 | +- `fastlane android deployLite` - Deploy Lite version to Google Play internal track |
| 25 | + |
| 26 | +### Clean |
| 27 | +- `./gradlew clean` - Clean build artifacts (includes custom .cxx directory cleanup) |
| 28 | + |
| 29 | +## Architecture Overview |
| 30 | + |
| 31 | +### Core Components |
| 32 | + |
| 33 | +**Document Processing Pipeline:** |
| 34 | +- `CoreLoader` - Primary document processor using the native C++ ODR core library |
| 35 | +- `WvwareDocLoader` - MS Word document processor using wvware library |
| 36 | +- `RawLoader` - Plain text and other raw file processor |
| 37 | +- `OnlineLoader` - Remote document fetcher |
| 38 | +- `MetadataLoader` - Document metadata extractor |
| 39 | + |
| 40 | +**Service Architecture:** |
| 41 | +- `LoaderService` - Background service managing all document loading operations |
| 42 | +- `LoaderServiceQueue` - Queue management for multiple document loading requests |
| 43 | +- Document loaders implement `FileLoaderListener` interface for async communication |
| 44 | + |
| 45 | +**UI Architecture:** |
| 46 | +- `MainActivity` - Main activity with service binding and menu management |
| 47 | +- `DocumentFragment` - Primary document display fragment using WebView |
| 48 | +- `PageView` - Custom WebView for document rendering |
| 49 | +- Action mode callbacks for edit, find, and TTS functionality |
| 50 | + |
| 51 | +### Build System |
| 52 | + |
| 53 | +**Multi-flavor Android App:** |
| 54 | +- **Lite flavor**: Free version with ads and tracking enabled |
| 55 | +- **Pro flavor**: Paid version with ads disabled and tracking disabled |
| 56 | + |
| 57 | +**Native Dependencies:** |
| 58 | +- Uses Conan package manager for C++ dependencies |
| 59 | +- CMake build system for native C++ core library (`odr-core`) |
| 60 | +- NDK version 26.3.11579264 required |
| 61 | +- C++20 standard |
| 62 | + |
| 63 | +**Core Library Integration:** |
| 64 | +- Native C++ wrapper (`CoreWrapper.cpp`) provides JNI interface |
| 65 | +- Supports multiple architectures: armv8, armv7, x86, x86_64 |
| 66 | +- Assets deployed to `assets/core` directory via custom Conan deployer |
| 67 | + |
| 68 | +### Key Directories |
| 69 | + |
| 70 | +- `app/src/main/java/at/tomtasche/reader/background/` - Document processing services |
| 71 | +- `app/src/main/java/at/tomtasche/reader/ui/` - UI components and activities |
| 72 | +- `app/src/main/java/at/tomtasche/reader/nonfree/` - Analytics, billing, and ads |
| 73 | +- `app/src/main/cpp/` - Native C++ JNI wrapper |
| 74 | +- `app/src/main/assets/` - HTML templates and fonts for document rendering |
| 75 | + |
| 76 | +### Dependencies |
| 77 | + |
| 78 | +**Core Android:** |
| 79 | +- AndroidX libraries (AppCompat, Core, Material, WebKit) |
| 80 | +- Firebase (Analytics, Crashlytics, Storage, Auth, Remote Config) |
| 81 | +- Google Play Services (Ads, Review, User Messaging Platform) |
| 82 | + |
| 83 | +**Document Processing:** |
| 84 | +- `app.opendocument:wvware-android` - MS Word document support |
| 85 | +- Custom ODR core library via Conan |
| 86 | + |
| 87 | +**Testing:** |
| 88 | +- Espresso for UI testing |
| 89 | +- JUnit for unit testing |
| 90 | +- Test APKs require connected device/emulator |
| 91 | + |
| 92 | +### Configuration Notes |
| 93 | + |
| 94 | +- Minimum SDK: 23, Target SDK: 34 |
| 95 | +- MultiDex enabled for large dependency set |
| 96 | +- R8/ProGuard enabled for release builds with resource shrinking |
| 97 | +- Configuration cache enabled for parallel Conan installs |
| 98 | +- Custom lint configuration allows non-fatal errors |
0 commit comments