-
Notifications
You must be signed in to change notification settings - Fork 10
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
当edittext文字太多时,并且包含话题时,长按键盘删除按钮删除太快导致崩溃问题解决 #5
Comments
大佬牛批,我也遇到这个崩溃了,学习一波! |
@zombiu @wzhangmoumou 请问 isDeletable 这个值是怎么判断的 |
我试了一下,删除的时候还是在 setSelection(closestRange.getTo(), closestRange.getFrom()); 这个地方崩溃,请问您那边会这样吗 |
不会,这个功能已经上线几个月了,从来没出现过相关崩溃。 |
|
你那边改了能修复吗,要是可以的话,你就这样修改吧! |
我这样是可以的,暂时没有发现其他问题。感谢您的回复! |
报的是Fatal Exception: java.lang.IllegalArgumentException这个错误么,我仔细检查了下崩溃情况,有一例崩溃跟你发出来的类似! |
|
谢谢大佬回复,加你了! |
测试过程中发现在华为和vivo上级上出现这个问题,小米手机上没事。
出现问题的原因是,达到快速删除的时候,vivo手机上会一次删除两个字符,华为手机上就***
贴上解决代码,直接修改MentionInputConnection类sendKeyEvent就可以
` private int lastStart=-1;
private int lastend=-1;
@OverRide public boolean sendKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_DEL) {
if (null != mRangeManager) {
int selectionStart = mEditText.getSelectionStart();
int selectionEnd = mEditText.getSelectionEnd();
if (lastStart==selectionStart && lastend==selectionEnd){
return true;
}
Range closestRange =
mRangeManager.getRangeOfClosestMentionString(selectionStart, selectionEnd);
}
`
The text was updated successfully, but these errors were encountered: