Exemplo n.º 1
0
        private void spellCheck()
        {
            if (mSpellCheckerSession == null)
            {
                return;
            }
            android.text.Editable editable = (android.text.Editable)mTextView.getText();
            int selectionStart             = android.text.Selection.getSelectionStart(editable);
            int selectionEnd = android.text.Selection.getSelectionEnd(editable);

            android.view.textservice.TextInfo[] textInfos = new android.view.textservice.TextInfo
                                                            [mLength];
            int textInfosCount = 0;

            {
                for (int i = 0; i < mLength; i++)
                {
                    android.text.style.SpellCheckSpan spellCheckSpan = mSpellCheckSpans[i];
                    if (spellCheckSpan.isSpellCheckInProgress())
                    {
                        continue;
                    }
                    int start = editable.getSpanStart(spellCheckSpan);
                    int end   = editable.getSpanEnd(spellCheckSpan);
                    // Do not check this word if the user is currently editing it
                    if (start >= 0 && end > start && (selectionEnd < start || selectionStart > end))
                    {
                        string word = editable.SubSequence(start, end).ToString();
                        spellCheckSpan.setSpellCheckInProgress(true);
                        textInfos[textInfosCount++] = new android.view.textservice.TextInfo(word, mCookie
                                                                                            , mIds[i]);
                    }
                }
            }
            if (textInfosCount > 0)
            {
                if (textInfosCount < textInfos.Length)
                {
                    android.view.textservice.TextInfo[] textInfosCopy = new android.view.textservice.TextInfo
                                                                        [textInfosCount];
                    System.Array.Copy(textInfos, 0, textInfosCopy, 0, textInfosCount);
                    textInfos = textInfosCopy;
                }
                mSpellCheckerSession.getSuggestions(textInfos, android.text.style.SuggestionSpan.
                                                    SUGGESTIONS_MAX_SIZE, false);
            }
        }
Exemplo n.º 2
0
 public virtual void getSuggestions(android.view.textservice.TextInfo textInfo, int
                                    suggestionsLimit)
 {
     throw new System.NotImplementedException();
 }