Add ViewModel for state preservation and centralize color constants

- Create CameraViewModel with AndroidViewModel to survive configuration
  changes (rotation). All blur params, capture state, gallery preview,
  and thumbnail state now live in StateFlow fields
- Create AppColors object to centralize the 12+ hardcoded color literals
  into a single source of truth
- Add lifecycle-viewmodel-compose dependency

Fixes: state lost on rotation, orphaned capture coroutines on config
change, accent color maintenance risk

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-05 12:07:39 +01:00
commit 6a1d66bd4b
4 changed files with 229 additions and 0 deletions

View file

@ -14,6 +14,7 @@ playServicesLocation = "21.3.0"
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }