Skip to content

Commit 1b8322b

Browse files
Fix: Wrap status cards in a dedicated Column
To address Z-axis overlapping of "Command Status" and "Detected Commands" cards, this commit wraps them (and their visibility conditions) in their own dedicated `Column`. This new `Column` is a child of the main screen `Column` in `PhotoReasoningScreen.kt`. This change aims to ensure that these two cards are laid out sequentially relative to each other. I will conduct further testing to determine if this group is positioned correctly on the screen and if it still overlaps other UI elements.
1 parent 447b9a9 commit 1b8322b

1 file changed

Lines changed: 29 additions & 20 deletions

File tree

app/src/main/kotlin/com/google/ai/sample/feature/multimodal/PhotoReasoningScreen.kt

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -400,29 +400,38 @@ fun PhotoReasoningScreen(
400400
}
401401
}
402402

403-
if (commandExecutionStatus.isNotEmpty()) {
404-
Card(modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp).wrapContentHeight(), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.secondaryContainer)) {
405-
Column(modifier = Modifier.padding(16.dp)) {
406-
Text("Command Status:", style = MaterialTheme.typography.titleMedium)
407-
Spacer(Modifier.height(4.dp))
408-
Text(commandExecutionStatus, color = MaterialTheme.colorScheme.onSecondaryContainer)
403+
// 5 & 6. Status and Commands Cards Column
404+
Column(modifier = Modifier.fillMaxWidth()) { // This new Column wraps the two cards
405+
if (commandExecutionStatus.isNotEmpty()) {
406+
Card(
407+
modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp).wrapContentHeight(),
408+
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.secondaryContainer)
409+
) {
410+
Column(modifier = Modifier.padding(16.dp)) {
411+
Text("Command Status:", style = MaterialTheme.typography.titleMedium)
412+
Spacer(Modifier.height(4.dp))
413+
Text(commandExecutionStatus, color = MaterialTheme.colorScheme.onSecondaryContainer)
414+
}
409415
}
410416
}
411-
}
412-
if (detectedCommands.isNotEmpty()) {
413-
Card(modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp).wrapContentHeight(), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.tertiaryContainer)) {
414-
Column(modifier = Modifier.padding(16.dp)) {
415-
Text("Detected Commands:", style = MaterialTheme.typography.titleMedium)
416-
Spacer(Modifier.height(4.dp))
417-
detectedCommands.forEachIndexed { index, command ->
418-
val commandText = when (command) {
419-
is Command.ClickButton -> "Click on button: \"${command.buttonText}\""
420-
is Command.TapCoordinates -> "Tap coordinates: (${command.x}, ${command.y})"
421-
is Command.TakeScreenshot -> "Take screenshot"
422-
else -> command::class.simpleName ?: "Unknown Command"
417+
if (detectedCommands.isNotEmpty()) {
418+
Card(
419+
modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp).wrapContentHeight(),
420+
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.tertiaryContainer)
421+
) {
422+
Column(modifier = Modifier.padding(16.dp)) {
423+
Text("Detected Commands:", style = MaterialTheme.typography.titleMedium)
424+
Spacer(Modifier.height(4.dp))
425+
detectedCommands.forEachIndexed { index, command ->
426+
val commandText = when (command) {
427+
is Command.ClickButton -> "Click on button: \"${command.buttonText}\""
428+
is Command.TapCoordinates -> "Tap coordinates: (${command.x}, ${command.y})"
429+
is Command.TakeScreenshot -> "Take screenshot"
430+
else -> command::class.simpleName ?: "Unknown Command"
431+
}
432+
Text("${index + 1}. $commandText", color = MaterialTheme.colorScheme.onTertiaryContainer)
433+
if (index < detectedCommands.size - 1) Divider(Modifier.padding(vertical = 4.dp), color = MaterialTheme.colorScheme.onTertiaryContainer.copy(alpha = 0.2f))
423434
}
424-
Text("${index + 1}. $commandText", color = MaterialTheme.colorScheme.onTertiaryContainer)
425-
if (index < detectedCommands.size - 1) Divider(Modifier.padding(vertical = 4.dp), color = MaterialTheme.colorScheme.onTertiaryContainer.copy(alpha = 0.2f))
426435
}
427436
}
428437
}

0 commit comments

Comments
 (0)