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

Commit a00972ab authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Fix around suggestionSpan.

Since the kind was unknown, doing a copy/cut on text with a SuggestionSpan crashed.

Change-Id: I10c0677b3587897b82c794db57d7b07149f12e09
parent 3220d0a1
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.text.style.ScaleXSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
import android.text.style.SubscriptSpan;
import android.text.style.SuggestionSpan;
import android.text.style.SuperscriptSpan;
import android.text.style.TextAppearanceSpan;
import android.text.style.TypefaceSpan;
@@ -566,7 +567,7 @@ public class TextUtils {
    /** @hide */
    public static final int ANNOTATION = 18;
    /** @hide */
    public static final int CORRECTION_SPAN = 19;
    public static final int SUGGESTION_SPAN = 19;

    /**
     * Flatten a CharSequence and whatever styles can be copied across processes
@@ -712,6 +713,10 @@ public class TextUtils {
                    readSpan(p, sp, new Annotation(p));
                    break;

                case SUGGESTION_SPAN:
                    readSpan(p, sp, new SuggestionSpan(p));
                    break;

                default:
                    throw new RuntimeException("bogus span encoding " + kind);
                }
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import java.util.Arrays;
import java.util.Locale;

/**
 * Sets correction candidates of words under this span.
 * Holds suggestion candidates of words under this span.
 */
public class SuggestionSpan implements ParcelableSpan {

@@ -139,7 +139,7 @@ public class SuggestionSpan implements ParcelableSpan {

    @Override
    public int getSpanTypeId() {
        return TextUtils.CORRECTION_SPAN;
        return TextUtils.SUGGESTION_SPAN;
    }

    public static final Parcelable.Creator<SuggestionSpan> CREATOR =