Status Update
Comments
kf...@gmail.com <kf...@gmail.com> #2
I'm not completely sure but his might be expected, as the buttons inside of the AndroidView might be consuming the down event, so it doesn't get propagated to the outter onKeyEvent modifier. ralu@ could you please confirm?
al...@google.com <al...@google.com> #3
I was able to reproduce this using this snippet:
import android.widget.Button as ButtonView
@Composable
fun TestBox(modifier: Modifier = Modifier) {
val requester = remember { FocusRequester() }
Row(modifier) {
Column(modifier = Modifier.focusGroup()) {
Button({}, modifier = Modifier.focusRequester(requester)) { Text("Button 1") }
Button({}) { Text("Button 2") }
}
Column {
Button({}) { Text("Button 3") }
AndroidView(
factory = { context ->
LinearLayout(context).apply {
orientation = LinearLayout.VERTICAL
addView(ButtonView(context).apply {
text = "Android Button 4"
setOnClickListener { requester.requestFocus() }
})
addView(ButtonView(context).apply { text = "Android Button 5" })
addView(ButtonView(context).apply { text = "Android Button 6" })
}
}
)
}
}
}
Step 1: Use the arrow keys to navigate to Buttton 4.
Step 2: Press enter (Trigger requester.requestFocus()).
Step 3: Observer that focus moves to Button 5 insteade of Button 1.
It looks like the onExit of Modifier.focusInteropModifier() intercepts the focus exit and performs a requestFocus(FOCUS_DOWN) instead:
George, can you help debug this further?
al...@google.com <al...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
Author: George Mount <
Link:
Fix several focus issues
Expand for full commit details
Fix several focus issues
Fixes: 369256395
Fixes: 378570682
Fixes: 376142752
Relnote: "Fixed several focus-related issues, including
crashes when IME tries to focus on ComposeView without
focusable items, focus change within child AndroidViews,
and focus request leaving an AndroidView."
Allow focus to leave AndroidView using requestFocus()
When requestFocus() is called to move focus from an
Android View within Compose to a compose focus requester,
the ComposeView should be focused and the focus target
should have focus.
This CL moves the functionality for moving focus
between child Views to the key handler, moveFocus(),
and requestFocus().
Test: new test, manual test
Change-Id: Ia03c3c04dc9fd9d55d8fcae6b15e15cb2384f467
Files:
- M
compose/ui/ui/api/current.txt
- M
compose/ui/ui/api/restricted_current.txt
- M
compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/focus/FocusViewInteropTest.kt
- M
compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/focus/OwnerFocusTest.kt
- M
compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
- A
compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/FocusFinderCompat.android.kt
- M
compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidViewHolder.android.kt
- M
compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/FocusGroupNode.android.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/ComposeUiFlags.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTransactions.kt
Hash: 1467e40d3c1253ebb6e3b54f9bfdcdc93ef53da7
Date: Mon Dec 02 18:21:31 2024
al...@google.com <al...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.ui:ui:1.8.0-alpha08
androidx.compose.ui:ui-android:1.8.0-alpha08
androidx.compose.ui:ui-jvmstubs:1.8.0-alpha08
androidx.compose.ui:ui-linuxx64stubs:1.8.0-alpha08
kf...@gmail.com <kf...@gmail.com> #6
al...@google.com <al...@google.com> #7
No, we're all set. The CL has been merged and we'll credit you in the release notes. Thanks!
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-main
Author: Kamal Faraj <
Link:
Add mutability flag to TaskStackBuilder
Expand for full commit details
Add mutability flag to TaskStackBuilder
Relnote: Added mutability flag to TaskStackBuilder
Fixes: 371534781
Test: ./gradlew core:core:assemble
Change-Id: Ife0ec30e6c08d6ed56781cdb58a722a6c1f6b6c1
Signed-off-by: Kamal Faraj <kfaraj.dev@gmail.com>
Files:
- M
core/core/api/current.txt
- M
core/core/api/restricted_current.txt
- M
core/core/src/main/java/androidx/core/app/PendingIntentCompat.java
- M
core/core/src/main/java/androidx/core/app/TaskStackBuilder.java
Hash: 6458efe5d178ea600cd4620b7acfbcc0c380c9fd
Date: Sun Oct 06 18:23:47 2024
pr...@google.com <pr...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.core:core:1.16.0-alpha01
Description
Version used: 1.13.1
Devices/Android versions reproduced on: N/A
This is a feature request to add mutability flag to TaskStackBuilder.
The implementation should be consistent with PendingIntentCompat and provide a variant of getPendingIntent that takes an additional isMutable parameter.