feat: FEATURE_CAMERA_ENABLED compile flag für KI-Kamera
- build.gradle.kts: buildConfigField FEATURE_CAMERA_ENABLED (default: true) - ItemListScreen: Camera-Icon nur wenn Flag gesetzt, onCameraClick optional - KrisenvorratNavGraph: CameraCapture-Route und Lambda nur wenn Flag gesetzt - SettingsScreen: KI-Erkennung-Section nur wenn Flag gesetzt
This commit is contained in:
parent
dd571f46fc
commit
809e6aa069
4 changed files with 46 additions and 37 deletions
|
|
@ -19,6 +19,7 @@ android {
|
|||
versionName = "1.2"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
buildConfigField("boolean", "FEATURE_CAMERA_ENABLED", "true")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ internal fun ItemListScreen(
|
|||
onItemClick: (String) -> Unit,
|
||||
onCategoriesClick: () -> Unit,
|
||||
onLocationsClick: () -> Unit,
|
||||
onCameraClick: () -> Unit,
|
||||
onCameraClick: () -> Unit = {},
|
||||
viewModel: ItemListViewModel = hiltViewModel()
|
||||
) {
|
||||
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
||||
|
|
@ -61,11 +61,13 @@ internal fun ItemListScreen(
|
|||
TopAppBar(
|
||||
title = { Text("Artikel") },
|
||||
actions = {
|
||||
IconButton(onClick = onCameraClick) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.PhotoCamera,
|
||||
contentDescription = "Foto erfassen"
|
||||
)
|
||||
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||
IconButton(onClick = onCameraClick) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.PhotoCamera,
|
||||
contentDescription = "Foto erfassen"
|
||||
)
|
||||
}
|
||||
}
|
||||
IconButton(onClick = { isMenuExpanded = true }) {
|
||||
Icon(
|
||||
|
|
|
|||
|
|
@ -42,8 +42,10 @@ internal fun KrisenvorratNavGraph(
|
|||
onLocationsClick = {
|
||||
navController.navigate(Screen.LocationManagement)
|
||||
},
|
||||
onCameraClick = {
|
||||
navController.navigate(Screen.CameraCapture)
|
||||
onCameraClick = if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||
{ navController.navigate(Screen.CameraCapture) }
|
||||
} else {
|
||||
{}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -56,13 +58,15 @@ internal fun KrisenvorratNavGraph(
|
|||
)
|
||||
}
|
||||
|
||||
composable<Screen.CameraCapture> {
|
||||
CameraScreen(
|
||||
onNavigateToItemForm = { prefillJson ->
|
||||
navController.navigate(Screen.ItemForm(prefillJson = prefillJson))
|
||||
},
|
||||
onNavigateBack = { navController.popBackStack() }
|
||||
)
|
||||
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||
composable<Screen.CameraCapture> {
|
||||
CameraScreen(
|
||||
onNavigateToItemForm = { prefillJson ->
|
||||
navController.navigate(Screen.ItemForm(prefillJson = prefillJson))
|
||||
},
|
||||
onNavigateBack = { navController.popBackStack() }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
composable<Screen.CategoryManagement> {
|
||||
|
|
|
|||
|
|
@ -316,35 +316,37 @@ internal fun SettingsScreen(
|
|||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(32.dp))
|
||||
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||
Spacer(modifier = Modifier.height(32.dp))
|
||||
|
||||
HorizontalDivider()
|
||||
HorizontalDivider()
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Text(
|
||||
text = "KI-Erkennung",
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
)
|
||||
Text(
|
||||
text = "KI-Erkennung",
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
OutlinedTextField(
|
||||
value = uiState.openAiApiKey,
|
||||
onValueChange = viewModel::onOpenAiApiKeyChanged,
|
||||
label = { Text("OpenAI API-Key") },
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
singleLine = true,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = uiState.openAiApiKey,
|
||||
onValueChange = viewModel::onOpenAiApiKeyChanged,
|
||||
label = { Text("OpenAI API-Key") },
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
singleLine = true,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Text(
|
||||
text = "Wird für die KI-gestützte Foto-Erkennung benötigt.",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
Text(
|
||||
text = "Wird für die KI-gestützte Foto-Erkennung benötigt.",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue