Implement export functionality in the Settings screen allowing users to
share their inventory data as JSON (via FileProvider + ACTION_SEND with
EXTRA_STREAM) or Markdown (via ACTION_SEND with EXTRA_TEXT).
Key changes:
- ShareContent sealed interface for export events (Json with URI,
Markdown with text)
- SettingsViewModel: exportJson() writes to cache file and creates
FileProvider URI; exportMarkdown() provides text directly
- SettingsUiState: isExporting, shareContent, exportError fields
- SettingsScreen: LaunchedEffect consumes share events and opens
Android Share Sheet via Intent.createChooser
- FileProvider registered in AndroidManifest with cache-path config
- MockK added as test dependency for FileProvider static mocking
- 8 new unit tests covering export success, failure, and state cleanup
Closes#37
Closes#25
ui/category/:
- CategoryListViewModel: StateFlow-based ViewModel with add/delete
dialog state management, backed by CategoryRepository
- CategoryListScreen: Material 3 Scaffold with LazyColumn, FAB for
adding, delete confirmation dialog with CASCADE warning
ui/location/:
- LocationListViewModel: same pattern for LocationRepository
- LocationListScreen: same UI pattern for location management
Tests:
- CategoryListViewModelTest: 11 tests covering init, add, delete,
dialog state, blank name rejection
- LocationListViewModelTest: 11 tests (same coverage)
Dependencies:
- Added lifecycle-runtime-compose for collectAsStateWithLifecycle
- Added kotlinx-coroutines-test for ViewModel unit tests
- KrisenvorratDatabase mit allen 4 Entities und LocalDateConverter
- CategoryDao, LocationDao, ItemDao, SettingsDao mit CRUD und Flow-Queries
- ItemDao.getExpiringSoon(daysUntil) als Default-Interface-Methode
- SettingsDao mit @Upsert (Room 2.6.1)
- Instrumentierungstests für alle 4 DAOs (in-memory DB)
- androidx.room:room-testing zu Dependencies ergänzt
app/build.gradle.kts:
- Enabled buildConfig in buildFeatures to expose VERSION_NAME
app/src/main/java/de/krisenvorrat/app/MainActivity.kt:
- Replaced plain Text greeting with centered Column layout
- Shows app title 'Krisenvorrat' (headlineLarge) and version
'v1.0' via BuildConfig.VERSION_NAME (bodyMedium, onSurfaceVariant)
Verified: built, deployed to emulator, and confirmed via screenshot.