public InputConnection createInputConnection(InputConnection base) {
return base == null ? null : new InputConnectionWrapper(base, true) {
@Override
public boolean sendKeyEvent(KeyEvent event) {
// TODO: this could be improved by working even when we are not empty.
// The behavior should be 'delete isLast character from mPre'.
// In that case, we should check also that getSelectionStart() == 0.
if (!isFirst() && mView.getText().length() == 0 &&
event.getAction() == KeyEvent.ACTION_DOWN &&
event.getKeyCode() == KeyEvent.KEYCODE_DEL) {
removeFromChain(mView);
return false;
}
return super.sendKeyEvent(event);
}
};
}
java类android.view.inputmethod.InputConnectionWrapper的实例源码
AutoSplitTextHelper.java 文件源码
项目:ViewPrinter
阅读 25
收藏 0
点赞 0
评论 0
AutocompleteEditText.java 文件源码
项目:365browser
阅读 27
收藏 0
点赞 0
评论 0
@VisibleForTesting
public InputConnectionWrapper getInputConnection() {
return mInputConnection;
}