Status Update
Comments
lp...@google.com <lp...@google.com> #2
We have some support in androidx.compose.ui.autofill
Leaving this bug open in case Ralston wants to add more info
ap...@google.com <ap...@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>
ma...@google.com <ma...@google.com>
ju...@google.com <ju...@google.com> #6
jo...@muzz.com <jo...@muzz.com> #7
lp...@google.com <lp...@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.
lp...@google.com <lp...@google.com> #10
Works perfectly fine on the latest stable and alpha versions. Did you check in my second comment if you enabled everything?
jd...@google.com <jd...@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.
jd...@google.com <jd...@google.com> #12
lp...@google.com <lp...@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...
jd...@google.com <jd...@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
lp...@google.com <lp...@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
jd...@google.com <jd...@google.com> #16
jj...@google.com <jj...@google.com> #17
lp...@google.com <lp...@google.com> #18
1.3.1 won't dialog prompt to save a password for me but will prompt to autofill for google.
As a workaround, you can wrap the TextInputLayout from a layout file to an AndroidView in compose.
@Composable
fun TextFieldView(
modifier: Modifier = Modifier,
textState: MutableState<String>,
@LayoutRes layoutRes: Int,
textChanged: () -> Unit = {},
) {
AndroidView(
modifier = modifier
.fillMaxWidth(),
factory = { context ->
val layout = LayoutInflater.from(context).inflate(layoutRes, null)
layout.findViewById<TextInputEditText>(R.id.tilET).apply {
doAfterTextChanged {
textState.value = safeText
textChanged.invoke()
}
}
layout
},
update = {
}
)
}
val EditText?.safeText: String get() = this?.editableText?.toString().orEmpty().trim()
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textfield.TextInputLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/til"
style="@style/TextInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tilET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textfield.TextInputLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/til"
style="@style/TextInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
app:endIconMode="password_toggle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tilET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
jj...@google.com <jj...@google.com> #19
lp...@google.com <lp...@google.com> #20
jj...@google.com <jj...@google.com> #21
I tried using similar to above example. But its not working & following logs are getting printed.
getAutofillClient(): null on super, trying to find activity thread getAutofillClient(): none of the 1 activities on com.xx@8b0a7bc have focus No AutofillClient for com.xx on context com.xxn@8b0a7bc requestHideFillUi(null): anchor = null
Autofill popup isn't shown because autofill is not available. Did you set up autofill?
- Go to Settings > System > Languages&input > Advanced > Autofill Service
- Pick a service
Did you add an account?
- Go to Settings > System > Languages&input > Advanced
- Click on the settings icon next to the Autofill Service
- Add your account
setSessionFinished(): from ACTIVE to FINISHED; autofillableIds=null
Can anyone help
jd...@google.com <jd...@google.com> #22
Please fix 1password and compose
lp...@google.com <lp...@google.com> #23
jd...@google.com <jd...@google.com> #24
Any update? It would be good to fix it asap, please.
lp...@google.com <lp...@google.com> #25
Any update on this?
It can be overlooked since it is simple but one of the important convenience feature.
Description
In b/168524931 we globally added a delay before emitting a
PressInteraction
in case we are in a scrollable container, and in case the 'down' event is actually part of a scroll. This is important so that we don't show a ripple if the user is actually beginning a scroll motion.However, currently because we don't have any 'in scrollable container' metadata, this is globally enabled, whether or not we actually need to delay. This has the unfortunate effect of delaying
PressInteraction
s unnecessarily, and hence causing ripples and other indication to be delayed and feel laggy.With the recently added
ModifierLocal
APIs, we can now provide and consume this metadata, so we should now implement support for this so we only delayPressInteraction
s if necessary.Compose work:
ModifierLocal
to represent scrollable container metadataModifier.scrollable
- this is used in other APIs such as lazy lists andModifier.verticalScroll
, so just setting it here should cover all cases.PressInteraction
, so that we only delay if we are truly inside a scrollable containerInterop work:
ComposeView
is in a scrollable container, as even if there are no scrollable containers in the Compose part of the hierarchy, if theComposeView
itself is in a scrollableViewGroup
, we should still delay pressesAndroidViewHolder
should also consume this metadata and use it to overrideViewGroup#shouldDelayChildPressedState()
, so anyView
s hosted inside of Compose can also delay their pressed state if they are inside scrollable Compose containers, or inside non-scrollable Compose containers inside a non-scrollableAndroidView
inside a scrollable Compose container...Because the interop work requires APIs between
ui
andfoundation
(presumably theModifierLocal
needs to be public API inui
, so we can use it fromfoundation
), for now we can just ignore theAndroidViewHolder
support, and just queryLocalView
instead of setting this metadata at theComposeView
layer to unblock the most common cases.