Commit 8a7e935
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>1 parent ef21d53 commit 8a7e935
2 files changed
Lines changed: 62 additions & 7 deletions
File tree
- app/src/main/kotlin/com/google/ai/sample
- feature/multimodal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| |||
286 | 294 | | |
287 | 295 | | |
288 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
289 | 317 | | |
290 | 318 | | |
291 | 319 | | |
| |||
752 | 780 | | |
753 | 781 | | |
754 | 782 | | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
755 | 788 | | |
756 | 789 | | |
757 | 790 | | |
| |||
Lines changed: 29 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
168 | 172 | | |
169 | 173 | | |
170 | 174 | | |
171 | | - | |
| 175 | + | |
| 176 | + | |
172 | 177 | | |
173 | 178 | | |
174 | 179 | | |
| |||
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
186 | | - | |
| 191 | + | |
| 192 | + | |
187 | 193 | | |
188 | 194 | | |
189 | 195 | | |
| 196 | + | |
190 | 197 | | |
191 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
192 | 205 | | |
193 | 206 | | |
194 | 207 | | |
| |||
223 | 236 | | |
224 | 237 | | |
225 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
226 | 246 | | |
227 | 247 | | |
228 | 248 | | |
229 | 249 | | |
230 | 250 | | |
231 | 251 | | |
232 | | - | |
233 | | - | |
234 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
235 | 256 | | |
236 | 257 | | |
237 | 258 | | |
| |||
633 | 654 | | |
634 | 655 | | |
635 | 656 | | |
636 | | - | |
| 657 | + | |
| 658 | + | |
637 | 659 | | |
638 | 660 | | |
639 | 661 | | |
640 | 662 | | |
641 | 663 | | |
642 | 664 | | |
643 | | - | |
| 665 | + | |
644 | 666 | | |
645 | 667 | | |
0 commit comments