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

Commit 094e64b7 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Clarify the purpose of EditorInfo#hintLocales."

parents a823912f d469f212
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -43606,6 +43606,7 @@ package android.view.inputmethod {
    field public android.os.Bundle extras;
    field public int fieldId;
    field public java.lang.String fieldName;
    field public android.util.LocaleList hintLocales;
    field public java.lang.CharSequence hintText;
    field public int imeOptions;
    field public int initialCapsMode;
@@ -43613,7 +43614,6 @@ package android.view.inputmethod {
    field public int initialSelStart;
    field public int inputType;
    field public java.lang.CharSequence label;
    field public android.util.LocaleList locales;
    field public java.lang.String packageName;
    field public java.lang.String privateImeOptions;
  }
@@ -46860,6 +46860,7 @@ package android.widget {
    method public int getHyphenationFrequency();
    method public int getImeActionId();
    method public java.lang.CharSequence getImeActionLabel();
    method public android.util.LocaleList getImeHintLocales();
    method public int getImeOptions();
    method public boolean getIncludeFontPadding();
    method public android.os.Bundle getInputExtras(boolean);
@@ -46966,6 +46967,7 @@ package android.widget {
    method public void setHorizontallyScrolling(boolean);
    method public void setHyphenationFrequency(int);
    method public void setImeActionLabel(java.lang.CharSequence, int);
    method public void setImeHintLocales(android.util.LocaleList);
    method public void setImeOptions(int);
    method public void setIncludeFontPadding(boolean);
    method public void setInputExtras(int) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+3 −1
Original line number Diff line number Diff line
@@ -46034,6 +46034,7 @@ package android.view.inputmethod {
    field public android.os.Bundle extras;
    field public int fieldId;
    field public java.lang.String fieldName;
    field public android.util.LocaleList hintLocales;
    field public java.lang.CharSequence hintText;
    field public int imeOptions;
    field public int initialCapsMode;
@@ -46041,7 +46042,6 @@ package android.view.inputmethod {
    field public int initialSelStart;
    field public int inputType;
    field public java.lang.CharSequence label;
    field public android.util.LocaleList locales;
    field public java.lang.String packageName;
    field public java.lang.String privateImeOptions;
  }
@@ -49614,6 +49614,7 @@ package android.widget {
    method public int getHyphenationFrequency();
    method public int getImeActionId();
    method public java.lang.CharSequence getImeActionLabel();
    method public android.util.LocaleList getImeHintLocales();
    method public int getImeOptions();
    method public boolean getIncludeFontPadding();
    method public android.os.Bundle getInputExtras(boolean);
@@ -49720,6 +49721,7 @@ package android.widget {
    method public void setHorizontallyScrolling(boolean);
    method public void setHyphenationFrequency(int);
    method public void setImeActionLabel(java.lang.CharSequence, int);
    method public void setImeHintLocales(android.util.LocaleList);
    method public void setImeOptions(int);
    method public void setIncludeFontPadding(boolean);
    method public void setInputExtras(int) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+3 −1
Original line number Diff line number Diff line
@@ -43622,6 +43622,7 @@ package android.view.inputmethod {
    field public android.os.Bundle extras;
    field public int fieldId;
    field public java.lang.String fieldName;
    field public android.util.LocaleList hintLocales;
    field public java.lang.CharSequence hintText;
    field public int imeOptions;
    field public int initialCapsMode;
@@ -43629,7 +43630,6 @@ package android.view.inputmethod {
    field public int initialSelStart;
    field public int inputType;
    field public java.lang.CharSequence label;
    field public android.util.LocaleList locales;
    field public java.lang.String packageName;
    field public java.lang.String privateImeOptions;
  }
@@ -46876,6 +46876,7 @@ package android.widget {
    method public int getHyphenationFrequency();
    method public int getImeActionId();
    method public java.lang.CharSequence getImeActionLabel();
    method public android.util.LocaleList getImeHintLocales();
    method public int getImeOptions();
    method public boolean getIncludeFontPadding();
    method public android.os.Bundle getInputExtras(boolean);
@@ -46982,6 +46983,7 @@ package android.widget {
    method public void setHorizontallyScrolling(boolean);
    method public void setHyphenationFrequency(int);
    method public void setImeActionLabel(java.lang.CharSequence, int);
    method public void setImeHintLocales(android.util.LocaleList);
    method public void setImeOptions(int);
    method public void setIncludeFontPadding(boolean);
    method public void setInputExtras(int) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+26 −14
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view.inputmethod;

import android.annotation.Nullable;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -341,20 +342,26 @@ public class EditorInfo implements InputType, Parcelable {
    public Bundle extras;

    /**
     * Additional context information that tells what languages are expected by the user.
     * List of the languages that the user is supposed to switch to no matter what input method
     * subtype is currently used.  This special "hint" can be used mainly for, but not limited to,
     * multilingual users who want IMEs to switch language context automatically.
     *
     * <p><strong>IME authors:</strong> Possible use cases for IME developers would be:</p>
     * <ul>
     *     <li>Automatically switching keyboard layout.</li>
     *     <li>Changing language model for better typing experience.</li>
     * </ul>
     * <p>{@code null} means that no special language "hint" is needed.</p>
     *
     * <p><strong>Editor authors:</strong> Providing this context information can help IMEs to
     * improve text input experience.  For example, chat applications can remember what language is
     * used in the last conversation for each chat session, and put the last used language at the
     * top of {@link #locales}.</p>
     * <p><strong>Editor authors:</strong> Specify this only when you are confident that the user
     * will switch to certain languages in this context no matter what input method subtype is
     * currently selected.  Otherwise, keep this {@code null}.  Explicit user actions and/or
     * preferences would be good signals to specify this special "hint",  For example, a chat
     * application may be able to put the last used language at the top of {@link #hintLocales}
     * based on whom the user is going to talk, by remembering what language is used in the last
     * conversation.  Do not specify {@link android.widget.TextView#getTextLocales()} only because
     * it is used for text rendering.</p>
     *
     * @see android.widget.TextView#setImeHintLocales(LocaleList)
     * @see android.widget.TextView#getImeHintLocales()
     */
    public LocaleList locales = LocaleList.getEmptyLocaleList();
    @Nullable
    public LocaleList hintLocales = null;

    /**
     * Ensure that the data in this EditorInfo is compatible with an application
@@ -410,7 +417,7 @@ public class EditorInfo implements InputType, Parcelable {
                + " fieldId=" + fieldId
                + " fieldName=" + fieldName);
        pw.println(prefix + "extras=" + extras);
        pw.println(prefix + "locales=" + locales);
        pw.println(prefix + "hintLocales=" + hintLocales);
    }

    /**
@@ -434,7 +441,11 @@ public class EditorInfo implements InputType, Parcelable {
        dest.writeInt(fieldId);
        dest.writeString(fieldName);
        dest.writeBundle(extras);
        locales.writeToParcel(dest, flags);
        if (hintLocales != null) {
            hintLocales.writeToParcel(dest, flags);
        } else {
            LocaleList.getEmptyLocaleList().writeToParcel(dest, flags);
        }
    }

    /**
@@ -458,7 +469,8 @@ public class EditorInfo implements InputType, Parcelable {
                    res.fieldId = source.readInt();
                    res.fieldName = source.readString();
                    res.extras = source.readBundle();
                    res.locales = LocaleList.CREATOR.createFromParcel(source);
                    LocaleList hintLocales = LocaleList.CREATOR.createFromParcel(source);
                    res.hintLocales = hintLocales.isEmpty() ? null : hintLocales;
                    return res;
                }

+2 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import android.text.style.SuggestionSpan;
import android.text.style.TextAppearanceSpan;
import android.text.style.URLSpan;
import android.util.DisplayMetrics;
import android.util.LocaleList;
import android.util.Log;
import android.util.SparseArray;
import android.view.ActionMode;
@@ -5299,6 +5300,7 @@ public class Editor {
        Bundle extras;
        OnEditorActionListener onEditorActionListener;
        boolean enterDown;
        LocaleList imeHintLocales;
    }

    static class InputMethodState {
Loading