splitwise / TokenAutoComplete

Gmail style MultiAutoCompleteTextView for Android
Apache License 2.0
1.3k stars 384 forks source link

Search text not cleared on Samsung S9 (Android 8.0) #351

Closed slowcar closed 5 years ago

slowcar commented 6 years ago

We have an issue that occurs only on the S9 (tested two devices, both on 8.0), not on Pixel, S5 and other test devices or simulators.

When we enter text and complete it to a token the text re-appears when typing another character. Example: Enter "gui", complete it to a token, enter "m", the field displays the token and "guim".

I have added logging in the textchangelistener that shows this behavior: beforeTextChanged: gui //now the token is created onTextChanged: ,, afterTextChanged: ,, //now enter "m" beforeTextChanged: ,, onTextChanged: ,, guim afterTextChanged: ,, guim

When using a standard MultiAutoCompleteTextView on the device the issue does not come up. I am a bit clueless about where the text comes from as it is not there in beforeTextChanged.

evgens83 commented 6 years ago

Also found this problem. Moreover, this behavior arises precisely after 3 entered characters and selecting an entry from the list.

riyase commented 6 years ago

I tried in SplitWise app and there are no problems. this is strange.

riyase commented 6 years ago

It seems some problem with TokenDeleteStyle.Clear. I dont see any problem when i use any other TokenDeleteStyle

mgod commented 6 years ago

I'm working on a fix for this in version 3.0 (you may be able to just use the code from master right now, but I don't have docs yet on the changes) and I'm removing the TokenDeleteStyle options as they do not actually work as expected due to keyboard implementation details, so maybe see if not setting it at all fixes the issue?

I am still seeing this issue in the Splitwise app, but this issue is related to keyboards replacing characters in unexpected ways in the input connection, so it's pretty OS/keyboard specific.

riyase commented 6 years ago

@mgod and this is happening only after the first chip . is it related to the completionText restore logic for the recent chip with TokenDeleteStyle.Clear?

mgod commented 6 years ago

I don't think so. I'm pretty sure you happen to be running into a very specific edge case where the replacement the keyboard is doing happens to interact with the Clear style. I'm pretty sure you'll find you're still able to reproduce the issue even with the Clear style, but maybe not with the specific keyboard/OS you are currently testing with.

slowcar commented 6 years ago

We did not set a TokenDeleteStyle, and it seems it is set to _Parent by default (which has a comment "not recommended"). I'll try the other styles as soon as i have access to the device again.

riyase commented 6 years ago

@slowcar _Parent used only for initialization. It is set to Clear at the end of init(). try setting PartialCompletion in your code

evgens83 commented 6 years ago

Initially, I did not specify a value for TokenDeleteStyle. I tried to check different states: if set .PartialCompletion or ._Parent - the problem disappears. For my purposes, behavior for .PartialCompletion is quite satisfied. Thanks for the feedback :)

slowcar commented 6 years ago

You are correct, i overlooked the assignment in the init. When i set it to ParticalCompletion it works correctly on our test devices, thanks!

arunarajput commented 5 years ago

@mgod I'm also getting the same issue. what is the solution? Can you please help me out for the same.

mgod commented 5 years ago

@arunarajput you can try using the current HEAD on master where I've got a fix that should work, but I'm wrapping up testing and final changes for that version, so it might be a little unstable at the moment. Other than that, I assume you've tried all the suggestions in this thread?

arunarajput commented 5 years ago

Thanks @mgod . Sure I'll use current HEAD . Yeah I have tried every possible suggestion.

mgod commented 5 years ago

3.0.0 should resolve this issue.