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

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

Merge "Use public APIs to instantiate InputMethodSubtype" into lmp-dev

parents ec19d621 443c2baf
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -210,18 +210,6 @@ public final class InputMethodSubtype implements Parcelable {
         return builder;
     }

    /**
     * Constructor with no subtype ID specified, overridesImplicitlyEnabledSubtype not specified.
     * Arguments for this constructor have the same meanings as
     * {@link InputMethodSubtype#InputMethodSubtype(int, int, String, String, String, boolean,
     * boolean, int)} except "id" and "overridesImplicitlyEnabledSubtype".
     * @hide
     */
    public InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue,
            boolean isAuxiliary) {
        this(nameId, iconId, locale, mode, extraValue, isAuxiliary, false);
    }

    /**
     * Constructor with no subtype ID specified.
     * @deprecated use {@link InputMethodSubtypeBuilder} instead.
+10 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder;

import java.util.ArrayList;
import java.util.List;
@@ -159,8 +160,15 @@ public class InputMethodTest extends InstrumentationTestCase {

    private static InputMethodSubtype createDummyInputMethodSubtype(String locale, String mode,
            boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype) {
        return new InputMethodSubtype(0, 0, locale, mode, "", isAuxiliary,
                overridesImplicitlyEnabledSubtype);
        return new InputMethodSubtypeBuilder()
                .setSubtypeNameResId(0)
                .setSubtypeIconResId(0)
                .setSubtypeLocale(locale)
                .setSubtypeMode(mode)
                .setSubtypeExtraValue("")
                .setIsAuxiliary(isAuxiliary)
                .setOverridesImplicitlyEnabledSubtype(overridesImplicitlyEnabledSubtype)
                .build();
    }

    private static InputMethodInfo createDefaultAutoDummyVoiceIme() {
+9 −3
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ import android.view.inputmethod.InputMethod;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
@@ -3455,9 +3456,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                                parser.getAttributeValue(null, ATTR_IME_SUBTYPE_EXTRA_VALUE);
                        final boolean isAuxiliary = "1".equals(String.valueOf(
                                parser.getAttributeValue(null, ATTR_IS_AUXILIARY)));
                        final InputMethodSubtype subtype =
                                new InputMethodSubtype(label, icon, imeSubtypeLocale,
                                        imeSubtypeMode, imeSubtypeExtraValue, isAuxiliary);
                        final InputMethodSubtype subtype = new InputMethodSubtypeBuilder()
                                .setSubtypeNameResId(label)
                                .setSubtypeIconResId(icon)
                                .setSubtypeLocale(imeSubtypeLocale)
                                .setSubtypeMode(imeSubtypeMode)
                                .setSubtypeExtraValue(imeSubtypeExtraValue)
                                .setIsAuxiliary(isAuxiliary)
                                .build();
                        tempSubtypesArray.add(subtype);
                    }
                }