An Android application for analyzing and tracking DEXA (Dual-Energy X-Ray Absorptiometry) scan results. Visualize your body composition data with comprehensive charts, trends, and health insights.
- OAuth 2.0 Authentication: Secure login via Keycloak
- DEXA Scan Analysis: View body composition metrics (fat %, muscle mass, bone density, etc.)
- Trend Tracking: Monitor changes in body composition over time
- Interactive Charts: Visualize data with charts and metrics
- Demo Mode: Explore the app with sample data without authentication
- Unit Preferences: Toggle between metric and imperial units
- Dark Theme Support: Native Material Design dark mode
- Language: Kotlin
- UI Framework: Jetpack Compose
- Architecture: MVVM with StateFlow
- Networking: Retrofit + OkHttp
- Data Storage: DataStore (preferences), in-memory repository
- Auth: OAuth 2.0 PKCE flow via Keycloak
- Charts: Custom Compose-based visualizations
- Build System: Gradle 8.x with version catalogs
app/
├── src/main/
│ ├── AndroidManifest.xml
│ ├── java/com/aarw/dexanalyze/
│ │ ├── DEXAnalyzeApp.kt # App entry point
│ │ ├── MainActivity.kt # Activity host
│ │ ├── data/
│ │ │ ├── api/ # API client & service
│ │ │ ├── auth/ # OAuth & token management
│ │ │ ├── model/ # Data models
│ │ │ ├── preferences/ # User settings
│ │ │ └── repository/ # Data layer
│ │ └── ui/
│ │ ├── screens/ # Navigation destinations
│ │ ├── components/ # Reusable UI components
│ │ ├── theme/ # Material Design theme
│ │ ├── navigation/ # Navigation graph
│ │ ├── LocalUnits.kt # Unit preferences
│ │ └── Tooltips.kt # Info tooltips
│ └── res/
│ ├── drawable/ # App icons & assets
│ ├── values/ # Strings, colors, themes
│ └── xml/ # Network security config
└── build.gradle.kts # App module config
- Android Studio Hedgehog or later
- JDK 11+
- Android SDK 28+ (targets API 34)
# Clone and open in Android Studio
git clone <repo-url>
cd DEXAnalyze
# Build and run
./gradlew assembleDebug
# Or use Android Studio's Run button (Shift+F10)OAuth endpoints are configured in OAuthConfig.kt:
- Auth Server:
https://auth.bodyspec.com - API Server:
https://app.bodyspec.com/api/v1 - Client ID:
bodyspec-api-ext-v1(configured for PKCE flow)
To use a different auth server, update the constants in OAuthConfig.kt and AuthRepository.kt.
- OAuth 2.0 with PKCE (Proof Key for Code Exchange) — secure for mobile apps
- Tokens stored in Android
EncryptedSharedPreferences(via TokenStore) - No sensitive data logged (tokens, response bodies)
- Network security config enforces HTTPS
Launch the app without authentication to explore with sample data. Toggle demo mode in Settings.
AuthRepository: OAuth login/token refresh flowScanRepository: Fetch and cache DEXA scans (demo/live)DashboardViewModel: Main screen state managementAnalysisViewModel: Detailed scan analysisBodySpecApiService: Retrofit API interface
Navigation graph defined in AppNavigation.kt:
- Login → Dashboard (after auth)
- Dashboard → Analysis, Progress, Settings
Example unit test provided in ExampleUnitTest.kt.
Example instrumented test provided in ExampleInstrumentedTest.kt.
Run tests:
./gradlew test # Unit tests
./gradlew connectedAndroidTest # Instrumented testsProprietary — BodySpec Inc.
For questions or feedback, reach out to the DEXAnalyze team.