Java Code Examples for android.view.inputmethod.CompletionInfo#getText()

The following examples show how to use android.view.inputmethod.CompletionInfo#getText() . 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: RichInputConnection.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
public void commitCompletion(final CompletionInfo completionInfo) {
    if (DEBUG_BATCH_NESTING) checkBatchEdit();
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
    CharSequence text = completionInfo.getText();
    // text should never be null, but just in case, it's better to insert nothing than to crash
    if (null == text) text = "";
    mCommittedTextBeforeComposingText.append(text);
    mExpectedSelStart += text.length() - mComposingText.length();
    mExpectedSelEnd = mExpectedSelStart;
    mComposingText.setLength(0);
    if (isConnected()) {
        mIC.commitCompletion(completionInfo);
    }
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
 
Example 2
Source File: SuggestedWords.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
public static ArrayList<SuggestedWordInfo> getFromApplicationSpecifiedCompletions(
        final CompletionInfo[] infos) {
    final ArrayList<SuggestedWordInfo> result = new ArrayList<>();
    for (final CompletionInfo info : infos) {
        if (null == info || null == info.getText()) {
            continue;
        }
        result.add(new SuggestedWordInfo(info));
    }
    return result;
}
 
Example 3
Source File: RichInputConnection.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
public void commitCompletion(final CompletionInfo completionInfo) {
    if (DEBUG_BATCH_NESTING) checkBatchEdit();
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
    CharSequence text = completionInfo.getText();
    // text should never be null, but just in case, it's better to insert nothing than to crash
    if (null == text) text = "";
    mCommittedTextBeforeComposingText.append(text);
    mExpectedSelStart += text.length() - mComposingText.length();
    mExpectedSelEnd = mExpectedSelStart;
    mComposingText.setLength(0);
    if (isConnected()) {
        mIC.commitCompletion(completionInfo);
    }
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
 
Example 4
Source File: SuggestedWords.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
public static ArrayList<SuggestedWordInfo> getFromApplicationSpecifiedCompletions(
        final CompletionInfo[] infos) {
    final ArrayList<SuggestedWordInfo> result = new ArrayList<>();
    for (final CompletionInfo info : infos) {
        if (null == info || null == info.getText()) {
            continue;
        }
        result.add(new SuggestedWordInfo(info));
    }
    return result;
}
 
Example 5
Source File: RichInputConnection.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
public void commitCompletion(final CompletionInfo completionInfo) {
    if (DEBUG_BATCH_NESTING) checkBatchEdit();
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
    CharSequence text = completionInfo.getText();
    // text should never be null, but just in case, it's better to insert nothing than to crash
    if (null == text) text = "";
    mCommittedTextBeforeComposingText.append(text);
    mExpectedSelStart += text.length() - mComposingText.length();
    mExpectedSelEnd = mExpectedSelStart;
    mComposingText.setLength(0);
    if (isConnected()) {
        mIC.commitCompletion(completionInfo);
    }
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
 
Example 6
Source File: SuggestedWords.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
public static ArrayList<SuggestedWordInfo> getFromApplicationSpecifiedCompletions(
        final CompletionInfo[] infos) {
    final ArrayList<SuggestedWordInfo> result = new ArrayList<>();
    for (final CompletionInfo info : infos) {
        if (null == info || null == info.getText()) {
            continue;
        }
        result.add(new SuggestedWordInfo(info));
    }
    return result;
}