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

Commit b3fc1a5b authored by satok's avatar satok
Browse files

Rename CorrectionSpan to SuggestionSpan

Change-Id: I004b2e012b2de4de959a31da1f55b63ca7c14199
parent 43a17654
Loading
Loading
Loading
Loading
+169 −169
Original line number Diff line number Diff line
@@ -202341,175 +202341,6 @@
</parameter>
</method>
</class>
<class name="CorrectionSpan"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.text.ParcelableSpan">
</implements>
<constructor name="CorrectionSpan"
 type="android.text.style.CorrectionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
</constructor>
<constructor name="CorrectionSpan"
 type="android.text.style.CorrectionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="locale" type="java.util.Locale">
</parameter>
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
</constructor>
<constructor name="CorrectionSpan"
 type="android.text.style.CorrectionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="locale" type="java.util.Locale">
</parameter>
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
<parameter name="originalString" type="java.lang.String">
</parameter>
</constructor>
<constructor name="CorrectionSpan"
 type="android.text.style.CorrectionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="src" type="android.os.Parcel">
</parameter>
</constructor>
<method name="describeContents"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getFlags"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getLocale"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getOriginalString"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSpanTypeId"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSuggestions"
 return="java.lang.String[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="writeToParcel"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="dest" type="android.os.Parcel">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_VERBATIM"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="DrawableMarginSpan"
 extends="java.lang.Object"
 abstract="false"
@@ -204298,6 +204129,175 @@
</parameter>
</method>
</class>
<class name="SuggestionSpan"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.text.ParcelableSpan">
</implements>
<constructor name="SuggestionSpan"
 type="android.text.style.SuggestionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
</constructor>
<constructor name="SuggestionSpan"
 type="android.text.style.SuggestionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="locale" type="java.util.Locale">
</parameter>
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
</constructor>
<constructor name="SuggestionSpan"
 type="android.text.style.SuggestionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="locale" type="java.util.Locale">
</parameter>
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
<parameter name="originalString" type="java.lang.String">
</parameter>
</constructor>
<constructor name="SuggestionSpan"
 type="android.text.style.SuggestionSpan"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="src" type="android.os.Parcel">
</parameter>
</constructor>
<method name="describeContents"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getFlags"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getLocale"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getOriginalString"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSpanTypeId"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSuggestions"
 return="java.lang.String[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="writeToParcel"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="dest" type="android.os.Parcel">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_VERBATIM"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="SuperscriptSpan"
 extends="android.text.style.MetricAffectingSpan"
 abstract="false"
+1 −1
Original line number Diff line number Diff line
@@ -16,4 +16,4 @@

package android.text.style;

parcelable CorrectionSpan;
parcelable SuggestionSpan;
+14 −14
Original line number Diff line number Diff line
@@ -28,11 +28,11 @@ import java.util.Locale;
/**
 * Sets correction candidates of words under this span.
 */
public class CorrectionSpan implements ParcelableSpan {
public class SuggestionSpan implements ParcelableSpan {

    /**
     * Flag for indicating that the input is verbatim. TextView refers to this flag to determine
     * how it displays a word with CorrectionSpan.
     * how it displays a word with SuggestionSpan.
     */
    public static final int FLAG_VERBATIM = 0x0001;

@@ -40,8 +40,8 @@ public class CorrectionSpan implements ParcelableSpan {

    /*
     * TODO: Needs to check the validity and add a feature that TextView will change
     * the current IME to the other IME which is specified in CorrectionSpan.
     * An IME needs to set the span by specifying the target IME and Subtype of CorrectionSpan.
     * the current IME to the other IME which is specified in SuggestionSpan.
     * An IME needs to set the span by specifying the target IME and Subtype of SuggestionSpan.
     * And the current IME might want to specify any IME as the target IME including other IMEs.
     */

@@ -59,7 +59,7 @@ public class CorrectionSpan implements ParcelableSpan {
     * @param suggestions Suggestions for the string under the span
     * @param flags Additional flags indicating how this span is handled in TextView
     */
    public CorrectionSpan(Context context, String[] suggestions, int flags) {
    public SuggestionSpan(Context context, String[] suggestions, int flags) {
        this(context, null, suggestions, flags, null);
    }

@@ -68,7 +68,7 @@ public class CorrectionSpan implements ParcelableSpan {
     * @param suggestions Suggestions for the string under the span
     * @param flags Additional flags indicating how this span is handled in TextView
     */
    public CorrectionSpan(Locale locale, String[] suggestions, int flags) {
    public SuggestionSpan(Locale locale, String[] suggestions, int flags) {
        this(null, locale, suggestions, flags, null);
    }

@@ -79,7 +79,7 @@ public class CorrectionSpan implements ParcelableSpan {
     * @param flags Additional flags indicating how this span is handled in TextView
     * @param originalString originalString for suggestions
     */
    public CorrectionSpan(Context context, Locale locale, String[] suggestions, int flags,
    public SuggestionSpan(Context context, Locale locale, String[] suggestions, int flags,
            String originalString) {
        final int N = Math.min(SUGGESTIONS_MAX_SIZE, suggestions.length);
        mSuggestions = Arrays.copyOf(suggestions, N);
@@ -92,7 +92,7 @@ public class CorrectionSpan implements ParcelableSpan {
        mOriginalString = originalString;
    }

    public CorrectionSpan(Parcel src) {
    public SuggestionSpan(Parcel src) {
        mSuggestions = src.readStringArray();
        mFlags = src.readInt();
        mLocaleString = src.readString();
@@ -142,16 +142,16 @@ public class CorrectionSpan implements ParcelableSpan {
        return TextUtils.CORRECTION_SPAN;
    }

    public static final Parcelable.Creator<CorrectionSpan> CREATOR =
            new Parcelable.Creator<CorrectionSpan>() {
    public static final Parcelable.Creator<SuggestionSpan> CREATOR =
            new Parcelable.Creator<SuggestionSpan>() {
        @Override
        public CorrectionSpan createFromParcel(Parcel source) {
            return new CorrectionSpan(source);
        public SuggestionSpan createFromParcel(Parcel source) {
            return new SuggestionSpan(source);
        }

        @Override
        public CorrectionSpan[] newArray(int size) {
            return new CorrectionSpan[size];
        public SuggestionSpan[] newArray(int size) {
            return new SuggestionSpan[size];
        }
    };
}
+7 −7
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ import android.text.method.TextKeyListener;
import android.text.method.TimeKeyListener;
import android.text.method.TransformationMethod;
import android.text.style.ClickableSpan;
import android.text.style.CorrectionSpan;
import android.text.style.SuggestionSpan;
import android.text.style.ParagraphStyle;
import android.text.style.URLSpan;
import android.text.style.UpdateAppearance;
@@ -8305,20 +8305,20 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

            final int pos = TextView.this.getSelectionStart();
            Spannable spannable = (Spannable)TextView.this.mText;
            CorrectionSpan[] correctionSpans = spannable.getSpans(pos, pos, CorrectionSpan.class);
            final int nbSpans = correctionSpans.length;
            SuggestionSpan[] suggestionSpans = spannable.getSpans(pos, pos, SuggestionSpan.class);
            final int nbSpans = suggestionSpans.length;

            ViewGroup viewGroup = getViewGroup(true);
            mContainer.setContentView(viewGroup);

            int totalNbSuggestions = 0;
            for (int spanIndex = 0; spanIndex < nbSpans; spanIndex++) {
                CorrectionSpan correctionSpan = correctionSpans[spanIndex];
                final int spanStart = spannable.getSpanStart(correctionSpan);
                final int spanEnd = spannable.getSpanEnd(correctionSpan);
                SuggestionSpan suggestionSpan = suggestionSpans[spanIndex];
                final int spanStart = spannable.getSpanStart(suggestionSpan);
                final int spanEnd = spannable.getSpanEnd(suggestionSpan);
                final Long spanRange = packRangeInLong(spanStart, spanEnd);

                String[] suggestions = correctionSpan.getSuggestions();
                String[] suggestions = suggestionSpan.getSuggestions();
                int nbSuggestions = suggestions.length;
                for (int suggestionIndex = 0; suggestionIndex < nbSuggestions; suggestionIndex++) {
                    TextView textView = (TextView) viewGroup.getChildAt(totalNbSuggestions);
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.os.Bundle;
import android.os.IBinder;
import android.text.Editable;
import android.text.method.KeyListener;
import android.text.style.CorrectionSpan;
import android.util.Log;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.CompletionInfo;