Status Update
Comments
st...@google.com <st...@google.com>
lo...@gmail.com <lo...@gmail.com> #2
We have some support in androidx.compose.ui.autofill
Leaving this bug open in case Ralston wants to add more info
an...@google.com <an...@google.com> #3
I found an example
D/Autofill Status: Autofill popup isn't shown because autofill is not available.
Did you set up autofill?
1. Go to Settings > System > Languages&input > Advanced > Autofill Service
2. Pick a service
Did you add an account?
1. Go to Settings > System > Languages&input > Advanced
2. Click on the settings icon next to the Autofill Service
3. Add your account
Is this a bug on your side or do the app developers of these password managers need to change their implementation?
an...@google.com <an...@google.com> #5
lo...@gmail.com <lo...@gmail.com> #6
ap...@google.com <ap...@google.com> #7
na...@google.com <na...@google.com> #8
I setup this modifier:
@OptIn(ExperimentalComposeUiApi::class)
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)
}
}
}
}
And use it like this:
val emailState = remember { EmailState() }
Email(
modifier = Modifier.autofill(
autofillTypes = listOf(
AutofillType.Username,
AutofillType.EmailAddress
),
onFill = { emailState.text = it },
),
emailState = emailState,
onImeAction = { onForgotPasswordSubmitted(emailState.text) }
)
With these steps, autofill works for me.
an...@google.com <an...@google.com> #10
Works perfectly fine on the latest stable and alpha versions. Did you check in my second comment if you enabled everything?
ch...@gmail.com <ch...@gmail.com> #11
I believe so?
I copied the modifier and then used
modifier = Modifier.autofill(
autofillTypes = listOf(
AutofillType.Username,
AutofillType.EmailAddress
),
onFill = { emailState.text = it },
)
on my text field.
an...@google.com <an...@google.com> #12
ch...@gmail.com <ch...@gmail.com> #13
The auto-filling works for me with the latest alpha version, but I'm never presented with the save dialog though.
I am having exactly same problem. Autofill works, but the Save dialog is never shown...
an...@google.com <an...@google.com> #14
Any updates on this? I can't get LastPass to display at all. I can ONLY get the Google Auto-fill service to work
pr...@google.com <pr...@google.com> #15
Same here, autofill in Jetpack Compose only works with the Google auto-fill service. When picking 1Password as the Auto-fill service in Settings, the debug log prints out:
D/Autofill Status: Autofill popup isn't shown because autofill is not available.
Did you set up autofill?
1. Go to Settings > System > Languages&input > Advanced > Autofill Service
2. Pick a service
Did you add an account?
1. Go to Settings > System > Languages&input > Advanced
2. Click on the settings icon next to the Autofill Service
3. Add your account
Description
1) Via composition local to find a parent pinnable parent
2) Call pin on it, which means that this composable will be kept composed even if it will naturally be scrolled our of the viewport of this pinnable parent
3) To be defined if we need to place such layoutnode or not. Probably we should, we can try to first pin it at some fake position outside the viewbounds
4) There should be a possibility to unpin it when the pinning is not needed anymore (for example the item is not focused anymore)
5) Such logic should work for nested lazy lists recursively, for example for cases when we have focused item inside LazyRow inside LazyColumn
6) Eventually the code should be abstracted away so it is easy to add such logic into your own LazyLayout implementation, for the first implementation we can just add it in LazyColumn as an internal api