Skip to content

System message dynamic height#23

Merged
Android-PowerUser merged 3 commits intofeature/purchase-thank-you-messagefrom
system-message-dynamic-height
Jun 1, 2025
Merged

System message dynamic height#23
Android-PowerUser merged 3 commits intofeature/purchase-thank-you-messagefrom
system-message-dynamic-height

Conversation

@Android-PowerUser
Copy link
Owner

No description provided.

Implements dynamic height changes for the system message text field in the PhotoReasoningScreen based on focus and keyboard visibility:
- Focused + Keyboard open: 600dp
- Focused + Keyboard closed: 1000dp
- Not focused: 120dp

Additionally, modifies back button behavior:
- If the system message field is focused with the keyboard closed (1000dp height), the first back press deselects the field, changing its height to 120dp.
- Subsequent back presses perform the default navigation.

Keyboard visibility is detected in MainActivity and propagated to the PhotoReasoningScreen.
Adds the import `androidx.compose.ui.focus.onFocusChanged` to `PhotoReasoningScreen.kt` to resolve a build compilation error.
Addresses your feedback on the system message TextField in PhotoReasoningScreen:

- Sets focused height with keyboard to 450dp (was 600dp).
- Dynamically adjusts minLines and maxLines of the OutlinedTextField to ensure the text input area expands with the component's height.
- Modifies the BackHandler to explicitly clear focus from the TextField (in addition to collapsing it) when it's focused without the keyboard and back is pressed. This ensures it can be re-expanded correctly on subsequent focus.

These changes improve the usability and appearance of the system message input field.
@Android-PowerUser Android-PowerUser merged commit 8a7e935 into feature/purchase-thank-you-message Jun 1, 2025
1 check passed
@Android-PowerUser Android-PowerUser deleted the system-message-dynamic-height branch June 1, 2025 19:28
Android-PowerUser added a commit that referenced this pull request Jun 1, 2025
* feat: Display thank you message on purchase

I modified MainScreen (MenuScreen.kt) to display a "Thank you" message
when the app has been purchased.

Changes:
- Added `isPurchased` parameter to `MenuScreen`.
- `MainActivity` now passes the purchase status (`currentTrialState == TrialManager.TrialState.PURCHASED`) to `MenuScreen`.
- In `MenuScreen`, if `isPurchased` is true, the donation button and related text are replaced with "Thank you for supporting the development! 🎉💛".
- Added a new preview for the purchased state in `MenuScreen.kt`.

* System message dynamic height (#23)

* feat: Adjust system message height and back button behavior

Implements dynamic height changes for the system message text field in the PhotoReasoningScreen based on focus and keyboard visibility:
- Focused + Keyboard open: 600dp
- Focused + Keyboard closed: 1000dp
- Not focused: 120dp

Additionally, modifies back button behavior:
- If the system message field is focused with the keyboard closed (1000dp height), the first back press deselects the field, changing its height to 120dp.
- Subsequent back presses perform the default navigation.

Keyboard visibility is detected in MainActivity and propagated to the PhotoReasoningScreen.

* fix: Add missing import for onFocusChanged

Adds the import `androidx.compose.ui.focus.onFocusChanged` to `PhotoReasoningScreen.kt` to resolve a build compilation error.

* fix: Correct system message TextField behavior

Addresses your feedback on the system message TextField in PhotoReasoningScreen:

- Sets focused height with keyboard to 450dp (was 600dp).
- Dynamically adjusts minLines and maxLines of the OutlinedTextField to ensure the text input area expands with the component's height.
- Modifies the BackHandler to explicitly clear focus from the TextField (in addition to collapsing it) when it's focused without the keyboard and back is pressed. This ensures it can be re-expanded correctly on subsequent focus.

These changes improve the usability and appearance of the system message input field.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
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.

1 participant