Status Update
Comments
ch...@google.com <ch...@google.com> #2
We have some support in androidx.compose.ui.autofill
Leaving this bug open in case Ralston wants to add more info
lp...@google.com <lp...@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?
lp...@google.com <lp...@google.com> #5
ch...@google.com <ch...@google.com> #6
ap...@google.com <ap...@google.com> #7
an...@gmail.com <an...@gmail.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.
le...@google.com <le...@google.com>
ap...@google.com <ap...@google.com> #10
Works perfectly fine on the latest stable and alpha versions. Did you check in my second comment if you enabled everything?
le...@google.com <le...@google.com>
lp...@google.com <lp...@google.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.
tc...@google.com <tc...@google.com> #12
ap...@google.com <ap...@google.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...
Description
```
@Composable
fun FooComponent(number: Int = +ambient(NumberAmbient)) {
...
}
NumberAmbient.Provider(someChangingValue) {
FooComponent()
}
```
When the ambient value changes, because the ambient is being consumed inside the default value it looks like we are not correctly generating the code / observing changes to this ambient, so when we go to compare parameters, (my assumption is that) we see that no parameters have changed, and hence do not recompose.
The workaround is explicitly adding the `+ambient` consumption to the function body, and not in the default value, but then this defeats the point of default values. This currently causes smaller components that contain only comparable parameters, such as ProgressIndicators, to not recompose when the colour in the theme changes.