Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2afcfa42 authored by Gilles Debunne's avatar Gilles Debunne
Browse files

resolved conflicts for merge of 5371a165 to master

Change-Id: I61830ec96c277ebba9db3e40842597b9c98d53c7
parents f3aa0f78 5371a165
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -863,6 +863,17 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
        return new String(buf);
    }

    /**
     * Return a String containing a copy of the chars in this buffer, limited to the
     * [start, end[ range.
     * @hide
     */
    public String substring(int start, int end) {
        char[] buf = new char[end - start];
        getChars(start, end, buf, 0);
        return new String(buf);
    }

    private TextWatcher[] sendTextWillChange(int start, int before, int after) {
        TextWatcher[] recip = getSpans(start, start + before, TextWatcher.class);
        int n = recip.length;
+6 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
package android.text.method;

import android.text.Selection;
import android.text.SpannableStringBuilder;

import java.text.BreakIterator;
import java.util.Locale;
@@ -58,7 +59,11 @@ public class WordIterator implements Selection.PositionIterator {
        mOffsetShift = Math.max(0, start - WINDOW_WIDTH);
        final int windowEnd = Math.min(charSequence.length(), end + WINDOW_WIDTH);

        mString = charSequence.toString().substring(mOffsetShift, windowEnd);
        if (charSequence instanceof SpannableStringBuilder) {
            mString = ((SpannableStringBuilder) charSequence).substring(mOffsetShift, windowEnd);
        } else {
            mString = charSequence.subSequence(mOffsetShift, windowEnd).toString();
        }
        mIterator.setText(mString);
    }

+4 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.widget;
import android.content.Context;
import android.text.Editable;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.method.WordIterator;
import android.text.style.SpellCheckSpan;
@@ -220,7 +221,6 @@ public class SpellChecker implements SpellCheckerSessionListener {
        TextInfo[] textInfos = new TextInfo[mLength];
        int textInfosCount = 0;

        final String text = editable.toString();
        for (int i = 0; i < mLength; i++) {
            final SpellCheckSpan spellCheckSpan = mSpellCheckSpans[i];
            if (spellCheckSpan.isSpellCheckInProgress()) continue;
@@ -230,7 +230,9 @@ public class SpellChecker implements SpellCheckerSessionListener {

            // Do not check this word if the user is currently editing it
            if (start >= 0 && end > start && (selectionEnd < start || selectionStart > end)) {
                final String word = text.substring(start, end);
                final String word = (editable instanceof SpannableStringBuilder) ?
                        ((SpannableStringBuilder) editable).substring(start, end) :
                        editable.subSequence(start, end).toString();
                spellCheckSpan.setSpellCheckInProgress(true);
                textInfos[textInfosCount++] = new TextInfo(word, mCookie, mIds[i]);
            }