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

Commit e3797a15 authored by satok's avatar satok
Browse files

Removed APIs for setCorrectionSpan from InputConnection

("setCorrectionSpan" was added in Id3abc9ea4d11753cd )

Also..
- Added a class java doc for CorrectionSpan
- Removed FLAG_DEFAULT
- Changed the return type of getSuggestions from Array<CharSequence> to String[]

Change-Id: If5eb091e307a7a40c5b4a70ec1fe6059ecd9fb2d
parent c50232d5
Loading
Loading
Loading
Loading
+5 −100
Original line number Diff line number Diff line
@@ -202139,7 +202139,7 @@
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="suggests" type="java.util.List&lt;java.lang.CharSequence&gt;">
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
@@ -202153,7 +202153,7 @@
>
<parameter name="locale" type="java.util.Locale">
</parameter>
<parameter name="suggests" type="java.util.List&lt;java.lang.CharSequence&gt;">
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
@@ -202169,7 +202169,7 @@
</parameter>
<parameter name="locale" type="java.util.Locale">
</parameter>
<parameter name="suggests" type="java.util.List&lt;java.lang.CharSequence&gt;">
<parameter name="suggestions" type="java.lang.String[]">
</parameter>
<parameter name="flags" type="int">
</parameter>
@@ -202241,8 +202241,8 @@
 visibility="public"
>
</method>
<method name="getSuggests"
 return="java.util.List&lt;java.lang.CharSequence&gt;"
<method name="getSuggestions"
 return="java.lang.String[]"
 abstract="false"
 native="false"
 synchronized="false"
@@ -202277,17 +202277,6 @@
 visibility="public"
>
</field>
<field name="FLAG_DEFAULT"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_VERBATIM"
 type="int"
 transient="false"
@@ -237093,27 +237082,6 @@
<parameter name="newCursorPosition" type="int">
</parameter>
</method>
<method name="setCorrectionSpan"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="token" type="android.os.IBinder">
</parameter>
<parameter name="correctionSpan" type="android.text.style.CorrectionSpan">
</parameter>
<parameter name="start" type="int">
</parameter>
<parameter name="end" type="int">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<method name="setSelection"
 return="boolean"
 abstract="false"
@@ -238384,27 +238352,6 @@
<parameter name="newCursorPosition" type="int">
</parameter>
</method>
<method name="setCorrectionSpan"
 return="boolean"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="token" type="android.os.IBinder">
</parameter>
<parameter name="correctionSpan" type="android.text.style.CorrectionSpan">
</parameter>
<parameter name="start" type="int">
</parameter>
<parameter name="end" type="int">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<method name="setSelection"
 return="boolean"
 abstract="true"
@@ -238735,27 +238682,6 @@
<parameter name="newCursorPosition" type="int">
</parameter>
</method>
<method name="setCorrectionSpan"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="token" type="android.os.IBinder">
</parameter>
<parameter name="correctionSpan" type="android.text.style.CorrectionSpan">
</parameter>
<parameter name="start" type="int">
</parameter>
<parameter name="end" type="int">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<method name="setSelection"
 return="boolean"
 abstract="false"
@@ -265082,27 +265008,6 @@
<parameter name="bottom" type="android.graphics.drawable.Drawable">
</parameter>
</method>
<method name="setCorrectionSpan"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="token" type="android.os.IBinder">
</parameter>
<parameter name="span" type="android.text.style.CorrectionSpan">
</parameter>
<parameter name="start" type="int">
</parameter>
<parameter name="end" type="int">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<method name="setCursorVisible"
 return="void"
 abstract="false"
+21 −25
Original line number Diff line number Diff line
@@ -22,23 +22,21 @@ import android.os.Parcelable;
import android.text.ParcelableSpan;
import android.text.TextUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Locale;

public class CorrectionSpan implements ParcelableSpan {

/**
     * Flag for the default value.
 * Sets correction candidates of words under this span.
 */
    public static final int FLAG_DEFAULT = 0x0000;
public class CorrectionSpan implements ParcelableSpan {

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

    private static final int SUGGESTS_MAX_SIZE = 5;
    private static final int SUGGESTIONS_MAX_SIZE = 5;

    /*
     * TODO: Needs to check the validity and add a feature that TextView will change
@@ -48,7 +46,7 @@ public class CorrectionSpan implements ParcelableSpan {
     */

    private final int mFlags;
    private final List<CharSequence> mSuggests = new ArrayList<CharSequence>();
    private final String[] mSuggestions;
    private final String mLocaleString;
    private final String mOriginalString;
    /*
@@ -58,35 +56,33 @@ public class CorrectionSpan implements ParcelableSpan {

    /**
     * @param context Context for the application
     * @param suggests Suggests for the string under the span
     * @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, List<CharSequence> suggests, int flags) {
        this(context, null, suggests, flags, null);
    public CorrectionSpan(Context context, String[] suggestions, int flags) {
        this(context, null, suggestions, flags, null);
    }

    /**
     * @param locale Locale of the suggestions
     * @param suggests Suggests for the string under the span
     * @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, List<CharSequence> suggests, int flags) {
        this(null, locale, suggests, flags, null);
    public CorrectionSpan(Locale locale, String[] suggestions, int flags) {
        this(null, locale, suggestions, flags, null);
    }

    /**
     * @param context Context for the application
     * @param locale locale Locale of the suggestions
     * @param suggests suggests Suggests for the string under the span
     * @param suggestions Suggestions for the string under the span
     * @param flags Additional flags indicating how this span is handled in TextView
     * @param originalString originalString for suggests
     * @param originalString originalString for suggestions
     */
    public CorrectionSpan(Context context, Locale locale, List<CharSequence> suggests, int flags,
    public CorrectionSpan(Context context, Locale locale, String[] suggestions, int flags,
            String originalString) {
        final int N = Math.min(SUGGESTS_MAX_SIZE, suggests.size());
        for (int i = 0; i < N; ++i) {
            mSuggests.add(suggests.get(i));
        }
        final int N = Math.min(SUGGESTIONS_MAX_SIZE, suggestions.length);
        mSuggestions = Arrays.copyOf(suggestions, N);
        mFlags = flags;
        if (context != null && locale == null) {
            mLocaleString = context.getResources().getConfiguration().locale.toString();
@@ -97,7 +93,7 @@ public class CorrectionSpan implements ParcelableSpan {
    }

    public CorrectionSpan(Parcel src) {
        src.readList(mSuggests, null);
        mSuggestions = src.readStringArray();
        mFlags = src.readInt();
        mLocaleString = src.readString();
        mOriginalString = src.readString();
@@ -106,8 +102,8 @@ public class CorrectionSpan implements ParcelableSpan {
    /**
     * @return suggestions
     */
    public List<CharSequence> getSuggests() {
        return new ArrayList<CharSequence>(mSuggests);
    public String[] getSuggestions() {
        return Arrays.copyOf(mSuggestions, mSuggestions.length);
    }

    /**
@@ -135,7 +131,7 @@ public class CorrectionSpan implements ParcelableSpan {

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(mSuggests);
        dest.writeStringArray(mSuggestions);
        dest.writeInt(mFlags);
        dest.writeString(mLocaleString);
        dest.writeString(mOriginalString);
+1 −12
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.SystemClock;
import android.text.Editable;
import android.text.NoCopySpan;
@@ -30,7 +29,6 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.method.MetaKeyKeyListener;
import android.text.style.CorrectionSpan;
import android.util.Log;
import android.util.LogPrinter;
import android.view.KeyCharacterMap;
@@ -191,15 +189,6 @@ public class BaseInputConnection implements InputConnection {
        return true;
    }

    /**
     * Default implementation does nothing and returns false.
     */
    @Override
    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
            int end, int flags) {
        return false;
    }

    /**
     * The default implementation performs the deletion around the current
     * selection position of the editable text.
+0 −8
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
package android.view.inputmethod;

import android.os.Bundle;
import android.os.IBinder;
import android.text.style.CorrectionSpan;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;

@@ -355,10 +353,4 @@ public interface InputConnection {
     * valid.
     */
    public boolean performPrivateCommand(String action, Bundle data);

    /**
     * Add a correction span.
     */
    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
            int end, int flags);
}
+1 −9
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
package android.view.inputmethod;

import android.os.Bundle;
import android.os.IBinder;
import android.text.style.CorrectionSpan;
import android.view.KeyEvent;

/**
@@ -60,8 +58,7 @@ public class InputConnectionWrapper implements InputConnection {
        return mTarget.getCursorCapsMode(reqModes);
    }
    
    public ExtractedText getExtractedText(ExtractedTextRequest request,
            int flags) {
    public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
        return mTarget.getExtractedText(request, flags);
    }

@@ -128,9 +125,4 @@ public class InputConnectionWrapper implements InputConnection {
    public boolean performPrivateCommand(String action, Bundle data) {
        return mTarget.performPrivateCommand(action, data);
    }

    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
            int end, int flags) {
        return mTarget.setCorrectionSpan(token, correctionSpan, start, end, flags);
    }
}
Loading