keepass2android
keepass2android copied to clipboard
[BUG] Android Compose + KP2A Autofill
Hi, i'm trying to implement autofill in an Android app with Compose. I am using AutofillType and AutofillNode.
My problem is that when I want to select an entry, it shows all the entries having androidapp://some.package.name in their additional fields, and not only the one having androidapp://my.app.package.
I don't know it it is a question or a bug, because in my memories this used to work.
I created a simple project to test this : https://github.com/lolo-io/DebugAutofill with just an email an password input, and all the code in the MainActivity.
It should work with androidapp://com.lolo.io.debugautofill
Maybe I'm doing something wrong. If you have an Idea let me know.
I test on a Pixel 6a device.
Thank you,
Basically this is how I add autofill support :
private fun Modifier.autofill(
autofillTypes: List<AutofillType>,
onFill: ((String) -> Unit),
) = composed {
val autofill = LocalAutofill.current
val autofillNode = AutofillNode(onFill = onFill, autofillTypes = autofillTypes)
LocalAutofillTree.current += autofillNode
this
.onGloballyPositioned {
autofillNode.boundingBox = it.boundsInWindow()
}
.onFocusChanged { focusState ->
autofill?.run {
if (focusState.isFocused) {
requestAutofillForNode(autofillNode)
} else {
cancelAutofillForNode(autofillNode)
}
}
}
}