Status Update
Comments
se...@google.com <se...@google.com> #2
We have some support in androidx.compose.ui.autofill
Leaving this bug open in case Ralston wants to add more info
so...@google.com <so...@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?
so...@google.com <so...@google.com> #6
so...@google.com <so...@google.com> #7
lu...@meta.com <lu...@meta.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.
lu...@meta.com <lu...@meta.com> #10
Works perfectly fine on the latest stable and alpha versions. Did you check in my second comment if you enabled everything?
so...@google.com <so...@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.
lu...@meta.com <lu...@meta.com> #12
lu...@meta.com <lu...@meta.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...
so...@google.com <so...@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
ap...@google.com <ap...@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
so...@google.com <so...@google.com> #16
lu...@meta.com <lu...@meta.com> #17
pr...@google.com <pr...@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>
na...@google.com <na...@google.com> #19
so...@google.com <so...@google.com>
ap...@google.com <ap...@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
pr...@google.com <pr...@google.com> #22
Please fix 1password and compose
Description
- Jetpack Compose component used: BasicText
- Android Studio Build: N/A
- Kotlin version: 1.9
- Devices/Android versions reproduced on: Samsung a306B
- Keyboard (i.e. Gboard, Samsung, etc): Samsung
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).
- Stack trace (if applicable)
FATAL EXCEPTION: main
Process: com.instagram.barcelona, PID: 19463
java.lang.IndexOutOfBoundsException: Index -4 out of bounds for length 3
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.util.Objects.checkIndex(Objects.java:359)
at java.util.ArrayList.get(ArrayList.java:434)
at androidx.compose.ui.text.MultiParagraphKt.findParagraphsByRange-Sb-Bc2M(MultiParagraph.kt:973)
at androidx.compose.ui.text.MultiParagraph.getPathForRange(MultiParagraph.kt:447)
at androidx.compose.ui.text.TextLayoutResult.getPathForRange(TextLayoutResult.kt:562)
at androidx.compose.foundation.text.TextLinkScope.pathForRangeInRangeCoordinates(TextLinkScope.kt:118)
at androidx.compose.foundation.text.TextLinkScope.shapeForRange(TextLinkScope.kt:103)
at androidx.compose.foundation.text.TextLinkScope.LinksComposables(TextLinkScope.kt:157)
at androidx.compose.foundation.text.TextLinkScope$LinksComposables$2.invoke(Unknown Source:10)
at androidx.compose.foundation.text.TextLinkScope$LinksComposables$2.invoke(Unknown Source:10)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2825)
at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:3139)
at com.instagram.compose.core.ui.IgClickableTextKt.IgClickableText-0fM_ruI(IgClickableText.kt:147)
at com.instagram.compose.core.ui.IgAccessibleClickableTextKt.IgAccessibleClickableText-oLbMNUE(IgAccessibleClickableText.kt:62)
at com.instagram.compose.core.ui.IgAccessibleClickableTextKt$IgAccessibleClickableText$2.invoke(Unknown Source:50)
at com.instagram.compose.core.ui.IgAccessibleClickableTextKt$IgAccessibleClickableText$2.invoke(Unknown Source:10)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2825)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3116)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3607)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3552)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:948)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1206)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:132)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:616)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:585)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1299)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309)
at android.view.Choreographer.doCallbacks(Choreographer.java:923)
at android.view.Choreographer.doFrame(Choreographer.java:847)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1283)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.appperf.messagequeue.interceptor.MessageQueueBase.deliverMessage(MessageQueueBase.java:84)
at com.facebook.appperf.messagequeue.interceptor.MessageQueueLooper.loopOnce(MessageQueueLooper.java:40)
at com.facebook.appperf.messagequeue.interceptor.MessageQueueLooper.loop(MessageQueueLooper.java:28)
at com.facebook.appperf.messagequeue.interceptor.MessageQueueLooper.install(MessageQueueLooper.java:22)
at com.facebook.appperf.messagequeue.interceptor.MessageQueueBase.run(MessageQueueBase.java:56)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
at Z.init(1729180395740-03614ed2-4e79-0972-f931-dc9e5d69c1b8)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@2d3377f, androidx.compose.ui.platform.MotionDurationScaleImpl@a11834c, StandaloneCoroutine{Cancelling}@83e3f95, AndroidUiDispatcher@c1ea8aa]