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

This commit is contained in:
Yohei Yukawa
2014-09-10 08:29:29 +00:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 17 deletions

View File

@@ -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.

View File

@@ -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() {

View File

@@ -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);
}
}