FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix: User input text is lost on screen rotation by AndreSand · Pull Request #14 · android/appfunctions · GitHub

Fix: User input text is lost on screen rotation - #14

Open
AndreSand wants to merge 3 commits into
android:mainfrom
AndreSand:fix/agent-text-field-state
Open

Fix: User input text is lost on screen rotation#14
AndreSand wants to merge 3 commits into
android:mainfrom
AndreSand:fix/agent-text-field-state

Conversation

Copy link
Copy Markdown
  • Add OnMessageTextChanged to AgentUiEvent to capture user input.
  • Migrate message text state from local Compose state to the ViewModel, utilizing SavedStateHandle for state persistence across configuration changes.

What I have done and why
Fix #13

Video fix:
https://github.com/user-attachments/assets/00c9b9ce-e24a-437d-bb81-e314438afe22

- Add `OnMessageTextChanged` to `AgentUiEvent` to capture user input.
- Migrate message text state from local Compose state to the ViewModel, utilizing `SavedStateHandle` for state persistence across configuration changes and process death.
- Reset the message text in the ViewModel when an `OnSendMessage` event is processed.

gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Code Review

This pull request refactors the messageText state in the AgentDemo screen, moving it from local UI state to the AgentDemoViewModel backed by SavedStateHandle to ensure state persistence across configuration changes. The reviewer suggested adding unit tests to verify that the view model correctly updates and clears this state.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +167 to +169
is AgentUiEvent.OnMessageTextChanged -> {
savedStateHandle[KEY_MESSAGE_TEXT] = event.text
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Consider adding unit tests in AgentDemoViewModelTest.kt to verify that OnMessageTextChanged correctly updates the savedStateHandle and that OnSendMessage clears it. This ensures the state persistence logic remains robust against future refactoring.

# Conflicts:
#	agent/app/src/main/java/com/example/appfunctions/agent/ui/screens/agentdemo/AgentDemoScreen.kt
#	agent/app/src/main/java/com/example/appfunctions/agent/ui/screens/agentdemo/AgentDemoViewModel.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Agent App Text input state lost on screen rotation

1 participant


Back | FazBrowse Home | New Git URL