Exemplo n.º 1
0
        public virtual void spellCheck(int start, int end)
        {
            if (!isSessionActive())
            {
                return;
            }
            int length = mSpellParsers.Length;

            {
                for (int i = 0; i < length; i++)
                {
                    android.widget.SpellChecker.SpellParser spellParser = mSpellParsers[i];
                    if (spellParser.isDone())
                    {
                        spellParser.init(start, end);
                        spellParser.parse();
                        return;
                    }
                }
            }
            // No available parser found in pool, create a new one
            android.widget.SpellChecker.SpellParser[] newSpellParsers = new android.widget.SpellChecker
                                                                        .SpellParser[length + 1];
            System.Array.Copy(mSpellParsers, 0, newSpellParsers, 0, length);
            mSpellParsers = newSpellParsers;
            android.widget.SpellChecker.SpellParser spellParser_1 = new android.widget.SpellChecker
                                                                    .SpellParser(this);
            mSpellParsers[length] = spellParser_1;
            spellParser_1.init(start, end);
            spellParser_1.parse();
        }
Exemplo n.º 2
0
 public virtual void onGetSuggestions(android.view.textservice.SuggestionsInfo[] results
                                      )
 {
     android.text.Editable editable = (android.text.Editable)mTextView.getText();
     {
         for (int i = 0; i < results.Length; i++)
         {
             android.view.textservice.SuggestionsInfo suggestionsInfo = results[i];
             if (suggestionsInfo.getCookie() != mCookie)
             {
                 continue;
             }
             int sequenceNumber = suggestionsInfo.getSequence();
             {
                 for (int j = 0; j < mLength; j++)
                 {
                     if (sequenceNumber == mIds[j])
                     {
                         int  attributes     = suggestionsInfo.getSuggestionsAttributes();
                         bool isInDictionary = ((attributes & android.view.textservice.SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY
                                                 ) > 0);
                         bool looksLikeTypo = ((attributes & android.view.textservice.SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO
                                                ) > 0);
                         android.text.style.SpellCheckSpan spellCheckSpan = mSpellCheckSpans[j];
                         if (!isInDictionary && looksLikeTypo)
                         {
                             createMisspelledSuggestionSpan(editable, suggestionsInfo, spellCheckSpan);
                         }
                         editable.removeSpan(spellCheckSpan);
                         break;
                     }
                 }
             }
         }
     }
     int length = mSpellParsers.Length;
     {
         for (int i_1 = 0; i_1 < length; i_1++)
         {
             android.widget.SpellChecker.SpellParser spellParser = mSpellParsers[i_1];
             if (!spellParser.isDone())
             {
                 spellParser.parse();
             }
         }
     }
 }