android.view.inputmethod.InputConnectionWrapper Java Examples

The following examples show how to use android.view.inputmethod.InputConnectionWrapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoSplitTextHelper.java    From ViewPrinter with Apache License 2.0 6 votes vote down vote up
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);
        }
    };
}
 
Example #2
Source File: AutocompleteEditText.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
public InputConnectionWrapper getInputConnection() {
    return mInputConnection;
}