aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputTestsBase.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-02-17 14:44:01 +0900
committerYohei Yukawa <yukawa@google.com>2014-02-17 15:32:33 +0900
commit6d43124215ca49feb35022c602d1dae7b5f23e4d (patch)
tree8cd1bc0ab80d6ca4e2ff1ac814bd1842a77f09aa /tests/src/com/android/inputmethod/latin/InputTestsBase.java
parent95d16561e0e6c38dbd99c893f09c5dbe9d4a465d (diff)
downloadlatinime-6d43124215ca49feb35022c602d1dae7b5f23e4d.tar.gz
latinime-6d43124215ca49feb35022c602d1dae7b5f23e4d.tar.xz
latinime-6d43124215ca49feb35022c602d1dae7b5f23e4d.zip
Stop using deprecated InputMethodSubtype constructor
The constructors of InputMethodSubtype were deprecated in API level 19. However we cannot yet switch to a new InputMethodSubtypeBuilder style due to our minimum support API level. As an intermediate solution, this patch replaces the these API calls with InputMethodSubtypeCompatUtils.newInputMethodSubtype so that these legacy API call can be consolidated at the same place. BUG: 13030512 Change-Id: I561a585f5dbea56c337680b645be5ef07015a0b1
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputTestsBase.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputTestsBase.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
index 06b64b439..4b157e700 100644
--- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
@@ -35,6 +35,7 @@ import android.view.inputmethod.InputMethodSubtype;
import android.widget.EditText;
import android.widget.FrameLayout;
+import com.android.inputmethod.compat.InputMethodSubtypeCompatUtils;
import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
@@ -290,17 +291,25 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
protected void changeLanguageWithoutWait(final String locale) {
mEditText.mCurrentLocale = LocaleUtils.constructLocaleFromString(locale);
- final InputMethodSubtype subtype = new InputMethodSubtype(
- R.string.subtype_no_language_qwerty, R.drawable.ic_ime_switcher_dark,
- locale, "keyboard", "KeyboardLayoutSet="
- // TODO: this is forcing a QWERTY keyboard for all locales, which is wrong.
- // It's still better than using whatever keyboard is the current one, but we
- // should actually use the default keyboard for this locale.
- + SubtypeLocaleUtils.QWERTY
- + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
- + "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
- + "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE,
- false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */);
+ // TODO: this is forcing a QWERTY keyboard for all locales, which is wrong.
+ // It's still better than using whatever keyboard is the current one, but we
+ // should actually use the default keyboard for this locale.
+ // TODO: Use {@link InputMethodSubtype.InputMethodSubtypeBuilder} directly or indirectly so
+ // that {@link InputMethodSubtype#isAsciiCapable} can return the correct value.
+ final String EXTRA_VALUE_FOR_TEST =
+ "KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY
+ + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
+ + "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
+ + "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
+ final InputMethodSubtype subtype = InputMethodSubtypeCompatUtils.newInputMethodSubtype(
+ R.string.subtype_no_language_qwerty,
+ R.drawable.ic_ime_switcher_dark,
+ locale,
+ Constants.Subtype.KEYBOARD_MODE,
+ EXTRA_VALUE_FOR_TEST,
+ false /* isAuxiliary */,
+ false /* overridesImplicitlyEnabledSubtype */,
+ 0 /* id */);
SubtypeSwitcher.getInstance().forceSubtype(subtype);
mLatinIME.loadKeyboard();
runMessages();