-
Notifications
You must be signed in to change notification settings - Fork 428
Added flag to allow clearing textfield without toggling keyboard on Android #3319
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
Conversation
@shai-almog hi... just wondering, will this be merged before Friday? Thx |
This looks identical to #3318 |
I added the curly braces as requested. Can you please ask me what isn't understood of this change? I will repeat again the purpose of this: to provide a way to clear TextAreas on Android that doesn't fold/toggle the keyboard. If CN1 wants it can create a wrapper that does what the 4 points in the change's comments mention, but without this small change keeping the keyboard on while clearing is currently impossible. I have tested this on my end by replicating an edited version of InPaceEditView and it works fine. But the change needs to go into CN1's InPaceEditView. It's a super-small change that won't affect regression in any way because the flag is false by default. Please, In know you might be busy, but spend a couple minutes on this as forcing to toggle the keyboard is a death blow to many applications (chat applications have no hope without this) |
You addressed the minor part of my comment. My problem with the previous PR is that it's a PR strictly to enable a hack. If this isn't exposed in a couple of weeks we'll forget this hack exists and will write code that breaks it. I think you might have assumed the keyboard folding is something we wanted? |
I can expose the new "better?" way if you want, I can create a PR for that. Does that sound good? It will strictly be for Android/iOS as I haven't dealt with any other platforms before (nor can I build into them I think) |
Sure, but why not add it to this PR? |
ok, will do |
I think the right way to do this would be to "bind" the native text field contents to the "CN1 text field" contents, perhaps using a DataChangedListener so that if setText(sometext) is called on the CN1 textfield while the native editor is opened, it will automatically update the value in the native editor. Care just needs to be take to prevent cycles since. Right now it is only a one-way binding (Native -> CN1 - i.e. when the Native textfield is edited, it propagates changes to the Cn1 text field, but not vice versa). Creating a method to stopEditing without closing the keyboard is a can of worms. |
Ok, I have added the new TextField I know this looks hacky, and it is. The current implementations is also hacky, so in the interest of not affecting regression this might be the safest way to achieve this. I have thoroughly tested this (I've spent the last week just trying to get on top of this). As @shannah says changing the |
@javieranton-zz I'm moving this issue to @shannah as he has strong strong feelings about this and a lot of experience in this specific area. |
Sure, makes sense |
@shannah pls note that |
I know we're all super busy, but it would be great if we could start using this with today's update. I understand if that's not possible, but asking is free :) |
@shannah hate to put pressure on anyone, but this is a bit of a blocker for me. Can the PR be reviewed/accepted? Or alternatively, can an estimate be given for how long this will take? Thanks |
…e native android editor while editing is in progress so that changes to the textarea contents will be reflected during editing. This is an alternative solution to the one presented in #3319 which added a special method to clear the textfield contents without closing the keyboard. This solution is more generalized (as you can clear the text field, or set its contents to any other string), and it doesn't require any API changes. It improves consistency with iOS since iOS already behaves this way.
I have just committed an alternate fix for this issue. This will be available in the next update on Friday. Summary of change (pasted from commit comments):
|
Nice one, I will thoroughly test it come Friday. Thanks a lot :) |
Works well, just one thing: On Android, with the new code, if the following is done:
The text field isn't guaranteed to show "B". The listener gets executed asynchronously and sometimes the first instruction will come after the second, resulting in "A" It's not a huge deal but it might break existing code. I know I will have to change mine to prevent issues |
@all-contributors please add @javieranton-zz for code |
I've put up a pull request to add @javieranton-zz! 🎉 |
I know this is very specific to Android, but that's because:
setText("")
InPlaceEditView
static methodpublic static void stopEdit()
, which stops editing without closing the keyboard, isn't exposed in the interface implementation so calling it fromDisplay
(to avoid having to call it natively) isn't currently possibleFeel free to create a wrapper to call the 4 points in the comments (and then remove the comments). I tried doing this but then as I went along I felt very confident that you would object to my implementation, so it's best CN1 does this
For now, can we please have this merged so I can call this from my side? It will fix a big source of pain