Java Code Examples for android.view.inputmethod.CorrectionInfo

The following are top voted examples for showing how to use android.view.inputmethod.CorrectionInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AOSP-Kayboard-7.1.2   File: RichInputConnection.java   View source code 5 votes vote down vote up
public void commitCorrection(final CorrectionInfo correctionInfo) {
    if (DEBUG_BATCH_NESTING) checkBatchEdit();
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
    // This has no effect on the text field and does not change its content. It only makes
    // TextView flash the text for a second based on indices contained in the argument.
    if (isConnected()) {
        mIC.commitCorrection(correctionInfo);
    }
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
 
Example 2
Project: MDPreference   File: EditText.java   View source code 5 votes vote down vote up
/**
    * Called by the framework in response to a text auto-correction (such as fixing a typo using a
    * a dictionnary) from the current input method, provided by it calling
    * {@link InputConnection#commitCorrection} InputConnection.commitCorrection()}. The default
    * implementation flashes the background of the corrected word to provide feedback to the user.
    *
    * @param info The auto correct info about the text that was corrected.
    */
public void onCommitCorrection (CorrectionInfo info){
       if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
           ((InternalEditText)mInputView).superOnCommitCorrection(info);
       else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE)
           ((InternalAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
       else
           ((InternalMultiAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
}
 
Example 3
Project: material-master   File: EditText.java   View source code 5 votes vote down vote up
/**
    * Called by the framework in response to a text auto-correction (such as fixing a typo using a
    * a dictionnary) from the current input method, provided by it calling
    * {@link android.view.inputmethod.InputConnection#commitCorrection} InputConnection.commitCorrection()}. The default
    * implementation flashes the background of the corrected word to provide feedback to the user.
    *
    * @param info The auto correct info about the text that was corrected.
    */
public void onCommitCorrection (CorrectionInfo info){
       if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
           ((InternalEditText)mInputView).superOnCommitCorrection(info);
       else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE)
           ((InternalAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
       else
           ((InternalMultiAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
}
 
Example 4
Project: material_fork   File: EditText.java   View source code 5 votes vote down vote up
/**
    * Called by the framework in response to a text auto-correction (such as fixing a typo using a
    * a dictionnary) from the current input method, provided by it calling
    * {@link android.view.inputmethod.InputConnection#commitCorrection} InputConnection.commitCorrection()}. The default
    * implementation flashes the background of the corrected word to provide feedback to the user.
    *
    * @param info The auto correct info about the text that was corrected.
    */
public void onCommitCorrection (CorrectionInfo info){
       if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
           ((InternalEditText)mInputView).superOnCommitCorrection(info);
       else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE)
           ((InternalAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
       else
           ((InternalMultiAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
}
 
Example 5
Project: 365browser   File: ThreadedInputConnection.java   View source code 5 votes vote down vote up
/**
 * @see InputConnection#commitCorrection(android.view.inputmethod.CorrectionInfo)
 */
@Override
public boolean commitCorrection(CorrectionInfo correctionInfo) {
    if (DEBUG_LOGS) {
        Log.i(TAG, "commitCorrection [%s]",
                ImeUtils.getCorrectionInfoDebugString(correctionInfo));
    }
    return false;
}
 
Example 6
Project: Material-Components   File: EditText.java   View source code 5 votes vote down vote up
/**
    * Called by the framework in response to a text auto-correction (such as fixing a typo using a
    * a dictionnary) from the current input method, provided by it calling
    * {@link android.view.inputmethod.InputConnection#commitCorrection} InputConnection.commitCorrection()}. The default
    * implementation flashes the background of the corrected word to provide feedback to the user.
    *
    * @param info The auto correct info about the text that was corrected.
    */
public void onCommitCorrection (CorrectionInfo info){
       if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
           ((InternalEditText)mInputView).superOnCommitCorrection(info);
       else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE)
           ((InternalAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
       else
           ((InternalMultiAutoCompleteTextView)mInputView).superOnCommitCorrection(info);
}
 
Example 7
Project: android-kioskime   File: RichInputConnection.java   View source code 5 votes vote down vote up
public void commitCorrection(final CorrectionInfo correctionInfo) {
    if (DEBUG_BATCH_NESTING) checkBatchEdit();
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
    // This has no effect on the text field and does not change its content. It only makes
    // TextView flash the text for a second based on indices contained in the argument.
    if (null != mIC) {
        mIC.commitCorrection(correctionInfo);
    }
    if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
 
Example 8
Project: android-kioskime   File: LatinIME.java   View source code 5 votes vote down vote up
private void commitCurrentAutoCorrection(final String separatorString) {
    // Complete any pending suggestions query first
    if (mHandler.hasPendingUpdateSuggestions()) {
        updateSuggestionStrip();
    }
    final String typedAutoCorrection = mWordComposer.getAutoCorrectionOrNull();
    final String typedWord = mWordComposer.getTypedWord();
    final String autoCorrection = (typedAutoCorrection != null)
            ? typedAutoCorrection : typedWord;
    if (autoCorrection != null) {
        if (TextUtils.isEmpty(typedWord)) {
            throw new RuntimeException("We have an auto-correction but the typed word "
                    + "is empty? Impossible! I must commit suicide.");
        }
        if (mSettings.isInternal()) {
            Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer);
        }
        if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
            final SuggestedWords suggestedWords = mSuggestedWords;
            ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, autoCorrection,
                    separatorString, mWordComposer.isBatchMode(), suggestedWords);
        }
        mExpectingUpdateSelection = true;
        commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD,
                separatorString);
        if (!typedWord.equals(autoCorrection)) {
            // This will make the correction flash for a short while as a visual clue
            // to the user that auto-correction happened. It has no other effect; in particular
            // note that this won't affect the text inside the text field AT ALL: it only makes
            // the segment of text starting at the supplied index and running for the length
            // of the auto-correction flash. At this moment, the "typedWord" argument is
            // ignored by TextView.
            mConnection.commitCorrection(
                    new CorrectionInfo(mLastSelectionEnd - typedWord.length(),
                    typedWord, autoCorrection));
        }
    }
}
 
Example 9
Project: Auto.js   File: InputConnectProxy.java   View source code 4 votes vote down vote up
@Override
public boolean commitCorrection(CorrectionInfo correctionInfo) {
    return mInputConnection.commitCorrection(correctionInfo);
}
 
Example 10
Project: AOSP-Kayboard-7.1.2   File: InputLogic.java   View source code 4 votes vote down vote up
/**
 * Commit the current auto-correction.
 *
 * This will commit the best guess of the keyboard regarding what the user meant by typing
 * the currently composing word. The IME computes suggestions and assigns a confidence score
 * to each of them; when it's confident enough in one suggestion, it replaces the typed string
 * by this suggestion at commit time. When it's not confident enough, or when it has no
 * suggestions, or when the settings or environment does not allow for auto-correction, then
 * this method just commits the typed string.
 * Note that if suggestions are currently being computed in the background, this method will
 * block until the computation returns. This is necessary for consistency (it would be very
 * strange if pressing space would commit a different word depending on how fast you press).
 *
 * @param settingsValues the current value of the settings.
 * @param separator the separator that's causing the commit to happen.
 */
private void commitCurrentAutoCorrection(final SettingsValues settingsValues,
        final String separator, final LatinIME.UIHandler handler) {
    // Complete any pending suggestions query first
    if (handler.hasPendingUpdateSuggestions()) {
        handler.cancelUpdateSuggestionStrip();
        // To know the input style here, we should retrieve the in-flight "update suggestions"
        // message and read its arg1 member here. However, the Handler class does not let
        // us retrieve this message, so we can't do that. But in fact, we notice that
        // we only ever come here when the input style was typing. In the case of batch
        // input, we update the suggestions synchronously when the tail batch comes. Likewise
        // for application-specified completions. As for recorrections, we never auto-correct,
        // so we don't come here either. Hence, the input style is necessarily
        // INPUT_STYLE_TYPING.
        performUpdateSuggestionStripSync(settingsValues, SuggestedWords.INPUT_STYLE_TYPING);
    }
    final SuggestedWordInfo autoCorrectionOrNull = mWordComposer.getAutoCorrectionOrNull();
    final String typedWord = mWordComposer.getTypedWord();
    final String stringToCommit = (autoCorrectionOrNull != null)
            ? autoCorrectionOrNull.mWord : typedWord;
    if (stringToCommit != null) {
        if (TextUtils.isEmpty(typedWord)) {
            throw new RuntimeException("We have an auto-correction but the typed word "
                    + "is empty? Impossible! I must commit suicide.");
        }
        final boolean isBatchMode = mWordComposer.isBatchMode();
        commitChosenWord(settingsValues, stringToCommit,
                LastComposedWord.COMMIT_TYPE_DECIDED_WORD, separator);
        if (!typedWord.equals(stringToCommit)) {
            // This will make the correction flash for a short while as a visual clue
            // to the user that auto-correction happened. It has no other effect; in particular
            // note that this won't affect the text inside the text field AT ALL: it only makes
            // the segment of text starting at the supplied index and running for the length
            // of the auto-correction flash. At this moment, the "typedWord" argument is
            // ignored by TextView.
            mConnection.commitCorrection(new CorrectionInfo(
                    mConnection.getExpectedSelectionEnd() - stringToCommit.length(),
                    typedWord, stringToCommit));
            String prevWordsContext = (autoCorrectionOrNull != null)
                    ? autoCorrectionOrNull.mPrevWordsContext
                    : "";
            StatsUtils.onAutoCorrection(typedWord, stringToCommit, isBatchMode,
                    mDictionaryFacilitator, prevWordsContext);
            StatsUtils.onWordCommitAutoCorrect(stringToCommit, isBatchMode);
        } else {
            StatsUtils.onWordCommitUserTyped(stringToCommit, isBatchMode);
        }
    }
}
 
Example 11
Project: MDPreference   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 12
Project: MDPreference   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 13
Project: MDPreference   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 14
Project: MDPreference   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 15
Project: MDPreference   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 16
Project: MDPreference   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 17
Project: 920-text-editor-v2   File: InputConnectionHacker.java   View source code 4 votes vote down vote up
@Override
public boolean commitCorrection(CorrectionInfo correctionInfo) {
    return ic.commitCorrection(correctionInfo);
}
 
Example 18
Project: material-master   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 19
Project: material-master   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 20
Project: material-master   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 21
Project: material-master   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 22
Project: material-master   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 23
Project: material-master   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 24
Project: material_fork   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 25
Project: material_fork   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 26
Project: material_fork   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 27
Project: material_fork   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 28
Project: material_fork   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 29
Project: material_fork   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 30
Project: 365browser   File: ImeUtils.java   View source code 4 votes vote down vote up
/**
 * @param correctionInfo The correction info.
 * @return Debug string for the given {@CorrectionInfo}.
 */
static String getCorrectionInfoDebugString(CorrectionInfo correctionInfo) {
    // TODO(changwan): implement it properly if needed.
    return correctionInfo.toString();
}
 
Example 31
Project: Material-Components   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 32
Project: Material-Components   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 33
Project: Material-Components   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 34
Project: Material-Components   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 35
Project: Material-Components   File: EditText.java   View source code 4 votes vote down vote up
@Override
public void onCommitCorrection(CorrectionInfo info) {
    EditText.this.onCommitCorrection(info);
}
 
Example 36
Project: Material-Components   File: EditText.java   View source code 4 votes vote down vote up
void superOnCommitCorrection(CorrectionInfo info) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        super.onCommitCorrection(info);
}
 
Example 37
Project: masked-input   File: InputConnectionWithoutComposing.java   View source code 4 votes vote down vote up
@Override
public boolean commitCorrection(CorrectionInfo correctionInfo) {
    return enabled && super.commitCorrection(correctionInfo);
}
 
Example 38
Project: Tada   File: TextView.java   View source code 2 votes vote down vote up
/**
 * Called by the framework in response to a text auto-correction (such as fixing a typo using a
 * a dictionnary) from the current input method, provided by it calling
 * {@link InputConnection#commitCorrection} InputConnection.commitCorrection()}. The default
 * implementation flashes the background of the corrected word to provide feedback to the user.
 *
 * @param info The auto correct info about the text that was corrected.
 */
public void onCommitCorrection(CorrectionInfo info) {
    if (mEditor != null) mEditor.onCommitCorrection(info);
}