# Onboarding Shown once on first launch. Walks the user through language selection, security setup, and appearance configuration before creating any credentials. --- ## Activity — `OnboardingActivity` `OnboardingActivity` hosts three sequential fragments managed by a `ViewPager2` with manual paging (swipe disabled). Progress dots are shown below the pager. Each fragment has a **Continue** button that is only enabled after the user satisfies a completion requirement. Scrolling to the bottom of a slide is required before Continue activates on content slides. --- ## Slide 1 — Language & Welcome (`OnboardingFragment`) - Displays a welcome illustration and app name - Language selector chip group (English / Dhivehi) - Selecting a language immediately updates the app locale - Continue button becomes active once a language is selected (or immediately if system locale is already supported) --- ## Slide 2 — Security Setup (`SecuritySetupFragment`) The user chooses a lock method to protect the app. ### Lock Methods | Method | Description | |---|---| | PIN | 4–8 digit numeric PIN | | Pattern | Grid pattern draw (minimum 4 nodes) | ### PIN Entry - Two `EditText` fields: PIN + confirm PIN - Continue activates only when both fields match and length ≥ 4 ### Pattern Entry - Custom `PatternView` widget - Draws connecting lines between touched grid nodes in real time - Two-phase: draw → confirm (must match first drawing) - Continue activates after a valid matching pattern is confirmed ### Key Derivation The chosen PIN or pattern string is hardened with **PBKDF2-HMAC-SHA256** (100 000 iterations, random 16-byte salt) before storage. The derived key is stored in encrypted `SharedPreferences` via `CredentialStore`. ### Biometric Option After setting a PIN or pattern an optional **Enable Biometrics** toggle appears. If enabled, biometric authentication (fingerprint / face — `BIOMETRIC_WEAK`) can be used as an alternative to the PIN/pattern at the lock screen and optionally for transfer confirmation. --- ## Slide 3 — Configure (`OnboardingConfigureFragment`) Appearance and navigation preferences, set before first login. ### Options | Setting | Choices | |---|---| | Navigation mode | Drawer / Bottom Navigation | | Theme | System default / Light / Dark | | Accent colour | Chip selector (several Material colours) | All preferences are written to `CredentialStore` / `SharedPreferences` immediately on selection so that `HomeActivity` inherits them on first launch. --- ## Completion When the user taps Continue on slide 3, `OnboardingActivity` sets the `onboardingDone` flag and finishes. `MainActivity` then routes to `LoginActivity` (no credentials yet) on the next launch or immediately via `startActivity`. ---   --- [← App Overview](00-app-overview.md)     **Next →** [Lock Screen](02-lock-screen.md)