Search in sources :

Example 41 with InputConnection

use of android.view.inputmethod.InputConnection in project android_frameworks_base by DirtyUnicorns.

the class InputMethodService method onExtractedReplaceText.

/**
     * @hide
     */
public void onExtractedReplaceText(int start, int end, CharSequence text) {
    InputConnection conn = getCurrentInputConnection();
    if (conn != null) {
        conn.setComposingRegion(start, end);
        conn.commitText(text, 1);
    }
}
Also used : InputConnection(android.view.inputmethod.InputConnection)

Example 42 with InputConnection

use of android.view.inputmethod.InputConnection in project android_frameworks_base by DirtyUnicorns.

the class InputMethodService method onExtractedSetSpan.

/**
     * @hide
     */
public void onExtractedSetSpan(Object span, int start, int end, int flags) {
    InputConnection conn = getCurrentInputConnection();
    if (conn != null) {
        if (!conn.setSelection(start, end))
            return;
        CharSequence text = conn.getSelectedText(InputConnection.GET_TEXT_WITH_STYLES);
        if (text instanceof Spannable) {
            ((Spannable) text).setSpan(span, 0, text.length(), flags);
            conn.setComposingRegion(start, end);
            conn.commitText(text, 1);
        }
    }
}
Also used : InputConnection(android.view.inputmethod.InputConnection) Spannable(android.text.Spannable)

Example 43 with InputConnection

use of android.view.inputmethod.InputConnection in project wifikeyboard by IvanVolosyuk.

the class WiFiInputMethod method getText.

String getText() {
    String text = "";
    try {
        InputConnection conn = getCurrentInputConnection();
        ExtractedTextRequest req = new ExtractedTextRequest();
        req.hintMaxChars = 1000000;
        req.hintMaxLines = 10000;
        req.flags = 0;
        req.token = 1;
        text = conn.getExtractedText(req, 0).text.toString();
    } catch (Throwable t) {
    }
    return text;
}
Also used : InputConnection(android.view.inputmethod.InputConnection) ExtractedTextRequest(android.view.inputmethod.ExtractedTextRequest)

Example 44 with InputConnection

use of android.view.inputmethod.InputConnection in project android_frameworks_base by ParanoidAndroid.

the class InputMethodService method onExtractedDeleteText.

/**
     * @hide
     */
public void onExtractedDeleteText(int start, int end) {
    InputConnection conn = getCurrentInputConnection();
    if (conn != null) {
        conn.setSelection(start, start);
        conn.deleteSurroundingText(0, end - start);
    }
}
Also used : InputConnection(android.view.inputmethod.InputConnection)

Example 45 with InputConnection

use of android.view.inputmethod.InputConnection in project android_frameworks_base by ParanoidAndroid.

the class InputMethodService method onExtractedReplaceText.

/**
     * @hide
     */
public void onExtractedReplaceText(int start, int end, CharSequence text) {
    InputConnection conn = getCurrentInputConnection();
    if (conn != null) {
        conn.setComposingRegion(start, end);
        conn.commitText(text, 1);
    }
}
Also used : InputConnection(android.view.inputmethod.InputConnection)

Aggregations

InputConnection (android.view.inputmethod.InputConnection)81 EditorInfo (android.view.inputmethod.EditorInfo)20 InputBinding (android.view.inputmethod.InputBinding)14 InputConnectionWrapper (com.android.internal.view.InputConnectionWrapper)14 KeyEvent (android.view.KeyEvent)9 ViewGroup (android.view.ViewGroup)9 ExtractedTextRequest (android.view.inputmethod.ExtractedTextRequest)9 Editable (android.text.Editable)8 View (android.view.View)8 BaseInputConnection (android.view.inputmethod.BaseInputConnection)8 IBinder (android.os.IBinder)7 InputMethod (android.view.inputmethod.InputMethod)7 LinearLayout (android.widget.LinearLayout)7 TextView (android.widget.TextView)7 IInputContext (com.android.internal.view.IInputContext)7 IInputMethod (com.android.internal.view.IInputMethod)7 EditableInputConnection (com.android.internal.widget.EditableInputConnection)7 FileDescriptor (java.io.FileDescriptor)7 PrintWriter (java.io.PrintWriter)7 Spannable (android.text.Spannable)6