The project enforces consistent code style through a shared scheme file for Java and ktlint for Kotlin. CI runs both checkstyle and detekt on every pull request.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProtonVPN/android-app/llms.txt
Use this file to discover all available pages before exploring further.
Language policy
The codebase is being migrated from Java to Kotlin. New code should be written in Kotlin wherever possible. Large refactors should conform to the preferred tech stack: Kotlin, MVVM, data-binding, and coroutines.Java code style
Java code follows theProtonStyle.xml code scheme, located at the root of the repository. Import it into Android Studio to ensure your IDE formats code consistently with the rest of the project.
Open the Code Style settings
In Android Studio, go to File > Settings > Editor > Code Style (on macOS: Android Studio > Settings > Editor > Code Style).
Select ProtonStyle.xml
Navigate to the root of the
android-app repository and select ProtonStyle.xml.- Star imports are disabled (import threshold set to
Integer.MAX_VALUE) - XML attribute ordering follows Android conventions (
xmlns:androidfirst, then otherxmlns:*alphabetically, thenandroid:id,android:name, and so on) - Kotlin right margin set to 120 characters
- Continuation indent size of 4 for both XML and Kotlin
Kotlin code style
Kotlin code uses ktlint with its default ruleset, based on the official Kotlin coding conventions. No custom ruleset is applied — the default ktlint rules are sufficient. Detekt is also configured to catch common issues. The detekt ruleset is downloaded from the shared Proton Core configuration at build time.Running static analysis
Run these commands locally before opening a pull request to catch issues early.Tech stack conventions
New features and significant refactors should follow these architectural conventions:| Area | Preferred approach |
|---|---|
| Architecture | MVVM |
| UI data flow | Data-binding or Jetpack Compose |
| Async work | Kotlin coroutines |
| Dependency injection | Hilt |
| Database | Room |
| Navigation | Jetpack Navigation |