Skip to content

Commit 3f55412

Browse files
The stop button was remaining visible (and input fields hidden) after a stop operation. This was because commandExecutionStatus was being set to "Stopped." in onStopClicked(), which is not an empty string.
The UI logic in `PhotoReasoningScreen.kt` shows the input fields and hides the stop button only when `uiState` is not `Loading` AND `commandExecutionStatus` is empty. This commit changes `onStopClicked()` in `PhotoReasoningViewModel.kt` to set `_commandExecutionStatus.value = ""` (an empty string). This, combined with `_uiState.value` being set to `Success`, now correctly fulfills the conditions in the UI to hide the stop button and re-display the text input and send button, allowing you to make new requests.
1 parent e2598a2 commit 3f55412

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ class PhotoReasoningViewModel(
208208

209209

210210
// _uiState.value = PhotoReasoningUiState.Stopped; // No longer setting this as the final state.
211-
_commandExecutionStatus.value = "Stopped."
211+
_commandExecutionStatus.value = "" // Set to empty string
212212
_detectedCommands.value = emptyList()
213-
Log.d(TAG, "Stop clicked, operations cancelled.")
213+
Log.d(TAG, "Stop clicked, operations cancelled, command status cleared.")
214214

215215
// Set a success state to indicate the stop operation itself was successful
216216
// and the UI can return to an idle/interactive state.

0 commit comments

Comments
 (0)