-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline autofill support #336
Conversation
The Doesn't it work when you add the changes to |
Is the toolbar needed during autofill? If not the icon could be hidden. |
Do the suggestions fit into the normal style? I see you set hardcoded text colors, which might look bad depending on the user's chosen colors. |
Adding the changes to method_dummy makes it work, I just thought it was redundant to have two methods. The toolbar is not needed during autofill, but wouldn't hiding it require making it visible again when it is used? I think it would be better if there is a solution that does not need modifying other parts of the code. The suggestions are black text on a white background (pill shaped) so it should be look fine (or at least visible) on all colors. I believe the default autofill service is also just black text on a white background. The text color can be changed to R.attr.suggestionWordStyle but then the background will need to be changed to something suitable. |
I think if it's just setting the key to visible again on
I'm pretty sure that the first issue about this autofill implementation will be lack of theming support |
I do not think theming support is something that will be easy to implement since the background of the suggestions uses a drawable. What are pinned keys? I don't see anything in the suggestion bar other than the toolbar icon, but the suggestions start from after the toolbar icon and end outside the screen, when scrolling, the left suggestion will overlap the toolbar icon and go outside the screen. If there is anything in the suggestion bar then it will be underneath the suggestions. |
When you long-press a key in the tool bar, the key will appear on the right edge of the suggestion strip.
You can simply set color filters or state lists, that's how it's done for other drawables, e.g. here: https://github.com/Helium314/openboard/blob/new/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardView.java#L634 |
While implementing the hide keys, I found an even worse bug. The onCreateInlineSuggestionsRequest() and onInlineSuggestionsResponse() functions get called on every text field. They only show suggestions on fields that actually need it but it causes issues when hiding the keys. I have no idea what is causing it and I could not narrow down the issue so I will be putting it on hold for now. You can close this PR. |
Can't you just return false when the suggestion list in the response is empty? |
That is probably the best solution, it seems like in the sample code provided by Google, there is a check for start input and if the response is empty. I can only guess that these functions being called on all text fields is intentional. I have implemented the hide keys functionality and unhide them on clear(). I think theming is the only thing left. |
Great job! Thank you!! I just have 2 questions:
Watch videoSVID_20231219_223258_1.mp4 |
Only the site name and username are visible in the suggestion strip, but clicking it should autofill the username and password properly. I use Bitwarden and it is working for me so I am not sure what is going on. Also the username is not visible in your case probably because the site name is long? I can try making the suggestion width longer if it needs it. Should be possible, I think it can be disabled along side the keys and re enabled with them. Do you know the setting name? |
Can you check if the autofill displays now and autofills properly? I did not changed the width because I tried it with keePassDX and saw the "..." is just how it displays the password manager entry. |
keePassDX also only shows the username in the suggestions. Bitwarden shows the site name and username. |
@Helium314 Are color filters set on a drawable object? The background of the suggestions is created using Icon.createWithResource(), which takes in the context and the ID of the drawable resource. I can't seem to figure out how to set the color filter because the ID is what is used to determine the drawable. |
|
.setBackground() takes Icon, I will try setTint. |
I have added theme support, I believe that is all for this PR. |
Sorry for the late reply. (I have a lot of work at my "real" job...) After testing, I can confirm that it now works properly. 👍💪 Just a small suggestion:
If you resolve the merge conflicts, the code will be very simple to write:
override fun get(color: ColorType): Int = when (color) {
…
CHIP, EMOJI_CATEGORY_BACKGROUND, … -> adjustedBackground
…
}
enum class ColorType {
…
BACKGROUND,
CHIP,
CLEAR_CLIPBOARD_HISTORY_KEY,
…
.setSingleIconChipStyle(
new ViewStyle.Builder()
.setBackground(
Icon.createWithResource(mDisplayContext,
androidx.autofill.R.drawable.autofill_inline_suggestion_chip_background)
.setTint(themeColors.get(ColorType.CHIP))) |
@Helium314 is there a reason to hide the entire suggestion strip for password fields? |
I created a trial throwaway 1Password account for testing this. If you have an email address that you are happy to provide here, I can send you an invite from within 1Password to access the vault. Otherwise, I can post the 1Password logon details here. Its a throwaway account, so whichever you prefer (and if you don't mind testing 1Password, please). |
I'm not even sure whether suggestion strip can still be hidden in the current version. |
@popogomo Thank you for the offer, but I do not want to log in with someone else's account. |
I tested it with the latest version (or about 2 commits behind the latest version) and it appears to be inconsistent. The suggestion strip for the password field sometimes appears and sometimes it does not. When it appears, the inline autofill works correctly. |
So the remaining issues are coloring (will be a new PR), and the sometimes missing suggestion strip, or is there anything else? |
I think that is all the remaining issues. |
Sure, that's totally understandable. Maybe you could share the debug apk with these changes so I could test 1Password and report back? Thanks. |
You can try this. |
Thanks for this. The results of the test (GrapheneOS, Android 14):
|
Thank you for testing it. Does the inline autofill work for 1Password with other keyboards? |
I think this should fix it, can you try the apk below? |
Thanks, we have some good progress here. So:
Shall I try GBoard instead and report back? |
Yeah please try it with Gboard. |
I've tried both GBoard and Microsoft Keyboard with the same results (in fact, the latest debug version you shared worked even better than these!). After digging a bit, it seems the issue is with Brave (and Chromium in general) itself. So I assume we can't do much with this unless Brave will provide a full support. Did you try Keepass and Bitwarden in Brave by a chance? Are they working as expected? |
I tried it with bitwarden in brave and it works fine. I don't really know what is the issue with 1Password but if it is behaving the same with Gboard then I don't think much can be done about it. |
Agree - the latest debug one is good enough to use with other browsers/apps, much better than the first debug. Thanks a million for working on this! |
app/src/main/java/org/dslul/openboard/inputmethod/latin/utils/InlineAutofillUtils.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/dslul/openboard/inputmethod/latin/utils/InlineAutofillUtils.java
Show resolved
Hide resolved
Tried on GrapheneOS 14, Mull (Firefox) and Proton Pass, seems to work well! I will report any problems, thank you |
Please also remember every typed email address, or in "frequently typed words", gBoard always remembered email addresses, it's so annoying to type exact/long email addresses (maybe cache them from address book?) |
This PR aims to add support for inline autofill.
The code is complete and works from my testing. There is only one minor issue that I could not find a fix for and that is the inline autofill overlapping with the toolbar icon when scrolling.
I had to modify the manifest to change "method_dummy" to "method" for it to work with the debug app (I am not sure if method_dummy is even needed so if it is unused then it could be deleted).
I am also sorry for making a new PR, but I did not know how to add to the old one.