Example usage for android.view.inputmethod CompletionInfo getText

List of usage examples for android.view.inputmethod CompletionInfo getText

Introduction

In this page you can find the example usage for android.view.inputmethod CompletionInfo getText.

Prototype

public CharSequence getText() 

Source Link

Document

Return the actual text associated with this completion.

Usage

From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java

/**
 * This tells us about completions that the editor has determined based
 * on the current text in it.  We want to use this in fullscreen mode
 * to show the completions ourself, since the editor can not be seen
 * in that situation.//from   w  w w  .j  a  v  a 2s  .  co m
 */
@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
    if (mCompletionOn) {
        mCompletions = completions;
        if (completions == null) {
            setSuggestions(null, false, false);
            return;
        }

        List<String> stringList = new ArrayList<String>();
        for (int i = 0; i < completions.length; i++) {
            CompletionInfo ci = completions[i];
            if (ci != null)
                stringList.add(ci.getText().toString());
        }
        setSuggestions(stringList, true, true);
    }
}

From source file:com.strathclyde.highlightingkeyboard.SoftKeyboardService.java

/**
 * This tells us about completions that the editor has determined based
 * on the current text in it.  We want to use this in fullscreen mode
 * to show the completions ourself, since the editor can not be seen
 * in that situation.//www . j a  va2s.co  m
 */
@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
    if (mCompletionOn) {
        mCompletions = completions;
        if (completions == null) {
            setSuggestions(null, false, false);
            return;
        }

        List<String> stringList = new ArrayList<String>();
        for (int i = 0; i < (completions != null ? completions.length : 0); i++) {
            CompletionInfo ci = completions[i];
            if (ci != null)
                stringList.add(ci.getText().toString());
        }
        setSuggestions(stringList, true, true);
    }
}

From source file:com.anysoftkeyboard.AnySoftKeyboard.java

@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
    if (BuildConfig.DEBUG) {
        Logger.d(TAG, "Received completions:");
        for (int i = 0; i < (completions != null ? completions.length : 0); i++) {
            Logger.d(TAG, "  #" + i + ": " + completions[i]);
        }//  w  w  w.  j  ava 2  s .  c  o  m
    }

    // completions should be shown if dictionary requires, or if we are in
    // full-screen and have outside completions
    if (mCompletionOn || (isFullscreenMode() && (completions != null))) {
        mCompletions = completions;
        // we do completions :)

        mCompletionOn = true;
        if (completions == null) {
            clearSuggestions();
            return;
        }

        List<CharSequence> stringList = new ArrayList<>();
        for (CompletionInfo ci : completions) {
            if (ci != null)
                stringList.add(ci.getText());
        }
        // CharSequence typedWord = mWord.getTypedWord();
        setSuggestions(stringList, true, true, true);
        mWord.setPreferredWord(null);
        // I mean, if I'm here, it must be shown...
        setCandidatesViewShown(true);
    }
}

From source file:org.pocketworkstation.pckeyboard.LatinIME.java

@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
    if (mCompletionOn) {
        mCompletions = completions;// ww  w  .  ja  v  a 2 s  . c  om
        if (completions == null) {
            clearSuggestions();
            return;
        }

        List<CharSequence> stringList = new ArrayList<CharSequence>();
        for (int i = 0; i < (completions != null ? completions.length : 0); i++) {
            CompletionInfo ci = completions[i];
            if (ci != null)
                stringList.add(ci.getText());
        }
        // When in fullscreen mode, show completions generated by the
        // application
        setSuggestions(stringList, true, true, true);
        mBestWord = null;
        setCandidatesViewShown(true);
    }
}

From source file:org.distantshoresmedia.keyboard.LatinIME.java

@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
    if (DEBUG) {/*w ww.  j ava  2s. c  o  m*/
        Log.i("foo", "Received completions:");
        for (int i = 0; i < (completions != null ? completions.length : 0); i++) {
            Log.i("foo", "  #" + i + ": " + completions[i]);
        }
    }
    if (mCompletionOn) {
        mCompletions = completions;
        if (completions == null) {
            clearSuggestions();
            return;
        }

        List<CharSequence> stringList = new ArrayList<CharSequence>();
        for (int i = 0; i < (completions != null ? completions.length : 0); i++) {
            CompletionInfo ci = completions[i];
            if (ci != null)
                stringList.add(ci.getText());
        }
        // When in fullscreen mode, show completions generated by the
        // application
        setSuggestions(stringList, true, true, true);
        mBestWord = null;
        setCandidatesViewShown(true);
    }
}