Fixed
Status Update
Comments
si...@google.com <si...@google.com> #2
Hi. Thanks for reporting this. Fixed in alpha-04
tc...@google.com <tc...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit e782987543a9f8ccd485e970ddc74564b24378db
Author: Vighnesh Raut <vighnesh.raut13@gmail.com>
Date: Mon Jan 02 15:27:40 2023
fix: tab row crashes when only 1 tab is added
Bug: b/264018028
Test: Added unit test
Change-Id: I6381dbac304fc1d69d3708c6655f8b595668e93f
M tv/tv-material/src/androidTest/java/androidx/tv/material/TabRowTest.kt
M tv/tv-material/src/main/java/androidx/tv/material/TabRow.kt
https://android-review.googlesource.com/2373449
Branch: androidx-main
commit e782987543a9f8ccd485e970ddc74564b24378db
Author: Vighnesh Raut <vighnesh.raut13@gmail.com>
Date: Mon Jan 02 15:27:40 2023
fix: tab row crashes when only 1 tab is added
Bug:
Test: Added unit test
Change-Id: I6381dbac304fc1d69d3708c6655f8b595668e93f
M tv/tv-material/src/androidTest/java/androidx/tv/material/TabRowTest.kt
M tv/tv-material/src/main/java/androidx/tv/material/TabRow.kt
si...@google.com <si...@google.com>
si...@google.com <si...@google.com>
si...@google.com <si...@google.com>
se...@google.com <se...@google.com>
ap...@google.com <ap...@google.com> #4
deleted
se...@google.com <se...@google.com>
se...@google.com <se...@google.com>
ap...@google.com <ap...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.tv:tv-material:1.0.0-alpha04
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit b11ae5ab95f5c9ccea1c46ab749d64fc28db4f04
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Feb 16 18:24:44 2021
Add SoftwareKeyboardController.
----
Revert "Revert "Add new SoftwareKeyboardController interface""
This reverts commit 070816bb482f21ce33955f845cccc99e7eab0630.
Reason for revert:
- Re-adding SoftwareKeyboardController after beta cut due to last minute revert.
Relnote: "Added new LocalSoftwareKeyboardController composition local
API to replace previous SoftwareKeyboardController interface on
TextField."
Test: Manual, automatic, demos
Bug: b/168778053
Change-Id: I658b6bfc5c917db486c631312e3456469a615831
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/TextFieldSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/SoftwareKeyboardControllerDemo.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/UiDemos.kt
A compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardController.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt
https://android-review.googlesource.com/1590532
Branch: androidx-main
commit b11ae5ab95f5c9ccea1c46ab749d64fc28db4f04
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Feb 16 18:24:44 2021
Add SoftwareKeyboardController.
----
Revert "Revert "Add new SoftwareKeyboardController interface""
This reverts commit 070816bb482f21ce33955f845cccc99e7eab0630.
Reason for revert:
- Re-adding SoftwareKeyboardController after beta cut due to last minute revert.
Relnote: "Added new LocalSoftwareKeyboardController composition local
API to replace previous SoftwareKeyboardController interface on
TextField."
Test: Manual, automatic, demos
Bug:
Change-Id: I658b6bfc5c917db486c631312e3456469a615831
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/TextFieldSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/SoftwareKeyboardControllerDemo.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/UiDemos.kt
A compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardController.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit 291aa6c357ee9c232a29e707f606a747d67ac9f4
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Feb 16 18:24:44 2021
Add SoftwareKeyboardController.
Relnote: "Added new LocalSoftwareKeyboardController composition local
API to replace previous SoftwareKeyboardController interface on
TextField."
Test: Manual, automatic, demos
Bug: b/168778053
Change-Id: I5951e802fbec7c26862b976de64b78640accd1f7
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/TextFieldSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
M compose/ui/ui/api/1.0.0-beta02.txt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_1.0.0-beta02.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_1.0.0-beta02.txt
M compose/ui/ui/api/restricted_current.txt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/SoftwareKeyboardControllerDemo.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/UiDemos.kt
A compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardController.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt
https://android-review.googlesource.com/1593054
Branch: androidx-main
commit 291aa6c357ee9c232a29e707f606a747d67ac9f4
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Feb 16 18:24:44 2021
Add SoftwareKeyboardController.
Relnote: "Added new LocalSoftwareKeyboardController composition local
API to replace previous SoftwareKeyboardController interface on
TextField."
Test: Manual, automatic, demos
Bug:
Change-Id: I5951e802fbec7c26862b976de64b78640accd1f7
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/TextFieldSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
M compose/ui/ui/api/1.0.0-beta02.txt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_1.0.0-beta02.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_1.0.0-beta02.txt
M compose/ui/ui/api/restricted_current.txt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/SoftwareKeyboardControllerDemo.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/UiDemos.kt
A compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardController.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt
Description
Specifically, a user wanted to "close the software keyboard in onClick on a button", and Fudge's workaround was to capture the SoftwareKeyboardController in the onTextInputStarted callback and write it into a field in the parent. var controller by remember { mutableStateOf<SoftwareKeyboardController?> { null } } Button("Close", onClick={controller!!.hideSoftwareKeyboard()}) // Pray this doesn't crash (NPE) TextField(value=..., onClick=..., onTextInputStarted={c -> controller = c})
A better pattern would be to have the user create a SoftwareKeyboardController as-if it were a hoisted state object and pass it into the TextField. val controller by remember { SoftwareKeyboardController() } Button("Close", onClick={controller.hideSoftwareKeyboard()}) TextField(value=..., onClick=..., controller=controller)
We realize/expect this requires playing a bit of a trick with the internal implementation of the SoftwareKeyboardController, to make the hideSoftwareKeyboard() function capable of operating as if it were the source of truth, even though the actual source of truth doesn't exist until later when the TextField is initialized by Android, which is probably one reason why it didn't occur to the original author of this widget. But it results in a much cleaner declarative API with less reasoning about the flow of information.
Discussion in API Council back in August, but I don't think a bug ever got filed for this.