Files
tern-android/docs/android-client-spec.md
Mateusz PstruchaandClaude Opus 5 6d63d92766 Initial Android app scaffold
Compose + Material 3 with dynamic color and the branding palette as
static fallback, edge-to-edge drawing, SplashScreen API, and predictive
back. Adaptive launcher icon includes a monochrome variant for themed
icons; the mark itself is a placeholder pending icon design.

No Play Services or Firebase anywhere in the dependency tree, verified
against the resolved runtime classpath.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 19:01:07 +02:00

86 lines
5.6 KiB
Markdown

# Android Client — Design & UI/UX Doc
Companion to the server architecture spec. Covers the Android client only; webapp UI/UX will be a separate doc.
---
## 1. Goals
- Modern, native-feeling Android app — built for the latest platform conventions, not a cross-platform shell.
- Full support for Material You (dynamic color), light/dark/system theming, and gesture navigation.
- Runs cleanly on GrapheneOS: no Play Services/Firebase dependency anywhere.
---
## 2. Theming
- **Dynamic color (Material You)**: pull the user's system wallpaper-derived color scheme via `dynamicLightColorScheme()` / `dynamicDarkColorScheme()` (Material 3). Fall back to a defined static brand palette on API levels below 12 or if dynamic color is unavailable.
- **Theme modes**: Light / Dark / Follow system — standard three-way setting, default to "follow system."
- **Material 3, not Material 2**: build on Jetpack Compose + Material 3 from the start. Dynamic color, adaptive layout, and current motion patterns are all designed around M3 — implementing this on the View system means re-building what M3 already gives you.
- Consider Material 3 **Expressive** (2025 update) for shape/motion personality, so the app doesn't read as "generic M3 from 2022."
- **Themed (monochrome) adaptive app icon** (API 33+) — so the launcher icon also tints to match the system dynamic color, not just in-app surfaces.
---
## 3. Navigation & Gestures
- **Edge-to-edge by default**: draw behind the status bar and gesture nav area; use Compose `Scaffold` inset handling, and explicitly pad any custom bottom sheets, FABs, or snackbars that aren't covered by it.
- **No dependency on a bottom nav bar area as a safe zone** — assume gesture nav (no persistent system bar) is the common case.
- **Predictive back gesture** (API 34+): implement `PredictiveBackHandler` so back-swipes show the live preview/animation. High-value here since back is core to the list → thread → back flow.
- **Swipe actions on list rows** (archive/delete/tag): trigger from anywhere on the row, not from a screen edge — an edge-anchored swipe will conflict with the system back gesture.
---
## 4. Adaptive Layout
- Build **list-detail (two-pane)** layout from the start using Material 3 adaptive scaffold components — single pane on phones, list+reading-pane side by side on tablets/foldables/large screens.
- Support **multi-window / resizable activity** — expected default behavior, not an edge case.
- Respect system font scaling; avoid hardcoded `sp`/`dp` values that break at larger accessibility text sizes.
---
## 5. Notifications
- **Conversation-style notifications** (`MessagingStyle`), grouped per thread — a busy thread shouldn't produce a flood of separate notifications.
- **Direct actions from the notification shade**: archive, mark read, and (consider) quick reply — ties into the server's rule engine/API rather than being client-only logic.
- **Runtime `POST_NOTIFICATIONS` permission** (API 33+): request contextually (e.g. right before enabling push, or on first sync success) rather than blindly on first launch.
- Delivery path stays as previously scoped: **UnifiedPush** as the primary transport (no FCM/Play Services), content-free payloads that just trigger a pull-sync over the authenticated API.
---
## 6. Launch & First-Run
- Use the Android 12+ **SplashScreen API** for a themed, consistent launch — not a custom splash `Activity`.
- First-run flow: connect to server → add account(s) → grant notification permission (contextually, see §5) → optional app-lock setup (see §7).
---
## 7. Privacy & Security (client-side)
- **No Firebase/Play Services dependency**, anywhere in the dependency tree — hard constraint, not just for push. Watch for libraries that pull these in transitively (e.g. certain analytics/crash-reporting SDKs, in-app review APIs).
- **Optional biometric/PIN app-lock** (`BiometricPrompt`) as a privacy layer independent of the account/API auth — email is sensitive, and a phone-unlock-only model may not be enough for some users.
- Local cache (Room/SQLite) should be treated as sensitive data — standard Android app-sandboxing applies, but avoid writing anything email-related to shared/world-readable storage, logs, or backups you haven't thought through (consider `android:allowBackup` implications for a mail cache).
---
## 8. Accessibility
- TalkBack content descriptions on all icon-only actions (archive/delete/tag/star icons etc. — anything without a visible text label).
- Font scaling support (§4) doubles as an accessibility requirement, not just a layout nicety.
- Sufficient contrast/touch-target sizing — Material 3 defaults mostly cover this, but custom components (swipe actions, compact list rows) need explicit checking.
---
## 9. Background & Sync Efficiency
- Sync is push-driven (UnifiedPush), not polled — this already plays well with Doze/App Standby battery restrictions.
- Push-triggered sync work should run via `WorkManager` (or a foreground service only if genuinely long-running/user-visible, e.g. active large-attachment download) rather than fighting Android's background execution limits with raw services.
---
## 10. Open Items for Later
- Quick-reply-from-notification: how much composition capability lives in the notification action vs. requiring opening the app — revisit once the main compose UI is designed.
- App-lock: PIN-only fallback if biometrics aren't enrolled/available — needs its own small flow.
- Whether swipe actions are user-configurable (e.g. left-swipe = archive vs. delete) — a preference, not a hardcoded default, likely worth adding once core UX is validated.