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"
|
versionName = "1.2"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
buildConfigField("boolean", "FEATURE_CAMERA_ENABLED", "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ internal fun ItemListScreen(
|
||||||
onItemClick: (String) -> Unit,
|
onItemClick: (String) -> Unit,
|
||||||
onCategoriesClick: () -> Unit,
|
onCategoriesClick: () -> Unit,
|
||||||
onLocationsClick: () -> Unit,
|
onLocationsClick: () -> Unit,
|
||||||
onCameraClick: () -> Unit,
|
onCameraClick: () -> Unit = {},
|
||||||
viewModel: ItemListViewModel = hiltViewModel()
|
viewModel: ItemListViewModel = hiltViewModel()
|
||||||
) {
|
) {
|
||||||
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
|
@ -61,11 +61,13 @@ internal fun ItemListScreen(
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Artikel") },
|
title = { Text("Artikel") },
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = onCameraClick) {
|
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||||
Icon(
|
IconButton(onClick = onCameraClick) {
|
||||||
imageVector = Icons.Default.PhotoCamera,
|
Icon(
|
||||||
contentDescription = "Foto erfassen"
|
imageVector = Icons.Default.PhotoCamera,
|
||||||
)
|
contentDescription = "Foto erfassen"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
IconButton(onClick = { isMenuExpanded = true }) {
|
IconButton(onClick = { isMenuExpanded = true }) {
|
||||||
Icon(
|
Icon(
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,10 @@ internal fun KrisenvorratNavGraph(
|
||||||
onLocationsClick = {
|
onLocationsClick = {
|
||||||
navController.navigate(Screen.LocationManagement)
|
navController.navigate(Screen.LocationManagement)
|
||||||
},
|
},
|
||||||
onCameraClick = {
|
onCameraClick = if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||||
navController.navigate(Screen.CameraCapture)
|
{ navController.navigate(Screen.CameraCapture) }
|
||||||
|
} else {
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -56,13 +58,15 @@ internal fun KrisenvorratNavGraph(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
composable<Screen.CameraCapture> {
|
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||||
CameraScreen(
|
composable<Screen.CameraCapture> {
|
||||||
onNavigateToItemForm = { prefillJson ->
|
CameraScreen(
|
||||||
navController.navigate(Screen.ItemForm(prefillJson = prefillJson))
|
onNavigateToItemForm = { prefillJson ->
|
||||||
},
|
navController.navigate(Screen.ItemForm(prefillJson = prefillJson))
|
||||||
onNavigateBack = { navController.popBackStack() }
|
},
|
||||||
)
|
onNavigateBack = { navController.popBackStack() }
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
composable<Screen.CategoryManagement> {
|
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(
|
||||||
text = "KI-Erkennung",
|
text = "KI-Erkennung",
|
||||||
style = MaterialTheme.typography.titleMedium
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = uiState.openAiApiKey,
|
value = uiState.openAiApiKey,
|
||||||
onValueChange = viewModel::onOpenAiApiKeyChanged,
|
onValueChange = viewModel::onOpenAiApiKeyChanged,
|
||||||
label = { Text("OpenAI API-Key") },
|
label = { Text("OpenAI API-Key") },
|
||||||
visualTransformation = PasswordVisualTransformation(),
|
visualTransformation = PasswordVisualTransformation(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Wird für die KI-gestützte Foto-Erkennung benötigt.",
|
text = "Wird für die KI-gestützte Foto-Erkennung benötigt.",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.secondary
|
color = MaterialTheme.colorScheme.secondary
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue