Fix typo of some methods' name

Also changes some methods' argument type from Locale to String.

Change-Id: Ib68b528a450dc68a01546483403230f76500bee4
main
Tadashi G. Takaoka 2012-04-18 15:44:34 +09:00
parent 26d97b089d
commit a58ebc73ae
11 changed files with 35 additions and 38 deletions

View File

@ -275,7 +275,7 @@ public class Key {
additionalMoreKeys = style.getStringArray(
keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
}
moreKeys = KeySpecParser.insertAddtionalMoreKeys(moreKeys, additionalMoreKeys);
moreKeys = KeySpecParser.insertAdditionalMoreKeys(moreKeys, additionalMoreKeys);
if (moreKeys != null) {
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
mMoreKeys = new MoreKeySpec[moreKeys.length];

View File

@ -267,7 +267,7 @@ public class KeySpecParser {
}
}
public static String[] insertAddtionalMoreKeys(String[] moreKeySpecs,
public static String[] insertAdditionalMoreKeys(String[] moreKeySpecs,
String[] additionalMoreKeySpecs) {
final String[] moreKeys = filterOutEmptyString(moreKeySpecs);
final String[] additionalMoreKeys = filterOutEmptyString(additionalMoreKeySpecs);

View File

@ -19,7 +19,6 @@ package com.android.inputmethod.latin;
import android.view.inputmethod.InputMethodSubtype;
import java.util.HashMap;
import java.util.Locale;
public class AdditionalSubtype {
public static final String QWERTY = "qwerty";
@ -43,14 +42,14 @@ public class AdditionalSubtype {
return subtype.containsExtraValueKey(SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE);
}
public static InputMethodSubtype createAddtionalSubtype(
Locale locale, String keyboardLayoutSet) {
public static InputMethodSubtype createAdditionalSubtype(
String localeString, String keyboardLayoutSet) {
final String extraValue = String.format(
"%s=%s,%s", LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET, keyboardLayoutSet,
SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE);
Integer nameId = sKeyboardLayoutToNameIdsMap.get(keyboardLayoutSet);
if (nameId == null) nameId = R.string.subtype_generic;
return new InputMethodSubtype(nameId, R.drawable.ic_subtype_keyboard,
locale.toString(), SUBTYPE_MODE_KEYBOARD, extraValue, false, false);
localeString, SUBTYPE_MODE_KEYBOARD, extraValue, false, false);
}
}

View File

@ -441,7 +441,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
loadSettings();
SubtypeUtils.setAditionalInputMethodSubtypes(
SubtypeUtils.setAdditionalInputMethodSubtypes(
this, mSettingsValues.getPrefefinedAdditionalSubtypes());
// TODO: remove the following when it's not needed by updateCorrectionMode() any more

View File

@ -150,10 +150,10 @@ public class SettingsValues {
mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
// Predefined additional subtypes
final InputMethodSubtype DE_QWERTY = AdditionalSubtype.createAddtionalSubtype(
Locale.GERMAN, AdditionalSubtype.QWERTY);
final InputMethodSubtype FR_QWERTZ = AdditionalSubtype.createAddtionalSubtype(
Locale.FRENCH, AdditionalSubtype.QWERTZ);
final InputMethodSubtype DE_QWERTY = AdditionalSubtype.createAdditionalSubtype(
Locale.GERMAN.toString(), AdditionalSubtype.QWERTY);
final InputMethodSubtype FR_QWERTZ = AdditionalSubtype.createAdditionalSubtype(
Locale.FRENCH.toString(), AdditionalSubtype.QWERTZ);
mPredefinedAdditionalSubtypes = new InputMethodSubtype[] {
DE_QWERTY,
FR_QWERTZ,

View File

@ -25,8 +25,7 @@ import java.util.Locale;
public class SubtypeLocale {
// Special language code to represent "no language".
private static final String NO_LANGUAGE = "zz";
public static final Locale LOCALE_NO_LANGUAGE = new Locale(NO_LANGUAGE);
public static final String NO_LANGUAGE = "zz";
// Exceptional locales to display name map.
private static final HashMap<String, String> sExceptionalDisplayNamesMap =

View File

@ -105,7 +105,7 @@ public class SubtypeSwitcher {
mCurrentSubtype = mImm.getCurrentInputMethodSubtype();
mAllEnabledSubtypesOfCurrentInputMethod = null;
mNoLanguageSubtype = SubtypeUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
service, SubtypeLocale.LOCALE_NO_LANGUAGE, AdditionalSubtype.QWERTY);
service, SubtypeLocale.NO_LANGUAGE, AdditionalSubtype.QWERTY);
final NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
mIsNetworkConnected = (info != null && info.isConnected());
@ -333,7 +333,7 @@ public class SubtypeSwitcher {
}
public boolean needsToDisplayLanguage(Locale keyboardLocale) {
if (keyboardLocale.equals(SubtypeLocale.LOCALE_NO_LANGUAGE)) {
if (keyboardLocale.toString().equals(SubtypeLocale.NO_LANGUAGE)) {
return true;
}
if (!keyboardLocale.equals(mInputLocale)) {

View File

@ -24,7 +24,6 @@ import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
public class SubtypeUtils {
private SubtypeUtils() {
@ -132,22 +131,22 @@ public class SubtypeUtils {
}
public static InputMethodSubtype findSubtypeByLocaleAndKeyboardLayoutSet(
Context context, Locale locale, String keyoardLayoutSet) {
final String localeString = locale.toString();
Context context, String localeString, String keyboardLayoutSetName) {
final InputMethodInfo imi = getInputMethodInfo(context.getPackageName());
final int count = imi.getSubtypeCount();
for (int i = 0; i < count; i++) {
final InputMethodSubtype subtype = imi.getSubtypeAt(i);
final String layout = SubtypeLocale.getKeyboardLayoutSetName(subtype);
if (localeString.equals(subtype.getLocale()) && keyoardLayoutSet.equals(layout)) {
final String layoutName = SubtypeLocale.getKeyboardLayoutSetName(subtype);
if (localeString.equals(subtype.getLocale())
&& keyboardLayoutSetName.equals(layoutName)) {
return subtype;
}
}
throw new RuntimeException("Can't find subtype for locale " + localeString
+ " and keyboard layout " + keyoardLayoutSet);
+ " and keyboard layout " + keyboardLayoutSetName);
}
public static void setAditionalInputMethodSubtypes(Context context,
public static void setAdditionalInputMethodSubtypes(Context context,
InputMethodSubtype[] subtypes) {
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
if (imm == null) {

View File

@ -45,7 +45,7 @@ class ProximityInfo {
} ProximityType;
ProximityInfo(const std::string localeStr, const int maxProximityCharsSize,
const int keyboardWidth, const int keybaordHeight, const int gridWidth,
const int keyboardWidth, const int keyboardHeight, const int gridWidth,
const int gridHeight, const int mostCommonkeyWidth,
const int32_t *proximityCharsArray, const int keyCount, const int32_t *keyXCoordinates,
const int32_t *keyYCoordinates, const int32_t *keyWidths, const int32_t *keyHeights,

View File

@ -253,7 +253,7 @@ public class KeySpecParserTests extends AndroidTestCase {
private static void assertMoreKeys(String message, String[] moreKeys,
String[] additionalMoreKeys, String[] expected) {
final String[] actual = KeySpecParser.insertAddtionalMoreKeys(
final String[] actual = KeySpecParser.insertAdditionalMoreKeys(
moreKeys, additionalMoreKeys);
if (expected == null && actual == null) {
return;

View File

@ -115,17 +115,17 @@ public class SubtypeLocaleTests extends AndroidTestCase {
public void testSampleSubtypes() {
final Context context = getContext();
final InputMethodSubtype EN_US = SubtypeUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
context, Locale.US, AdditionalSubtype.QWERTY);
context, Locale.US.toString(), AdditionalSubtype.QWERTY);
final InputMethodSubtype EN_GB = SubtypeUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
context, Locale.UK, AdditionalSubtype.QWERTY);
context, Locale.UK.toString(), AdditionalSubtype.QWERTY);
final InputMethodSubtype FR = SubtypeUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
context, Locale.FRENCH, AdditionalSubtype.AZERTY);
context, Locale.FRENCH.toString(), AdditionalSubtype.AZERTY);
final InputMethodSubtype FR_CA = SubtypeUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
context, Locale.CANADA_FRENCH, AdditionalSubtype.QWERTY);
context, Locale.CANADA_FRENCH.toString(), AdditionalSubtype.QWERTY);
final InputMethodSubtype DE = SubtypeUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
context, Locale.GERMAN, AdditionalSubtype.QWERTZ);
context, Locale.GERMAN.toString(), AdditionalSubtype.QWERTZ);
final InputMethodSubtype ZZ = SubtypeUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
context, SubtypeLocale.LOCALE_NO_LANGUAGE, AdditionalSubtype.QWERTY);
context, SubtypeLocale.NO_LANGUAGE, AdditionalSubtype.QWERTY);
assertFalse(AdditionalSubtype.isAdditionalSubtype(EN_US));
assertFalse(AdditionalSubtype.isAdditionalSubtype(EN_GB));
@ -164,14 +164,14 @@ public class SubtypeLocaleTests extends AndroidTestCase {
}
public void testAdditionalSubtype() {
final InputMethodSubtype DE_QWERTY = AdditionalSubtype.createAddtionalSubtype(
Locale.GERMAN, AdditionalSubtype.QWERTY);
final InputMethodSubtype FR_QWERTZ = AdditionalSubtype.createAddtionalSubtype(
Locale.FRENCH, AdditionalSubtype.QWERTZ);
final InputMethodSubtype EN_AZERTY = AdditionalSubtype.createAddtionalSubtype(
Locale.ENGLISH, AdditionalSubtype.AZERTY);
final InputMethodSubtype ZZ_AZERTY = AdditionalSubtype.createAddtionalSubtype(
SubtypeLocale.LOCALE_NO_LANGUAGE, AdditionalSubtype.AZERTY);
final InputMethodSubtype DE_QWERTY = AdditionalSubtype.createAdditionalSubtype(
Locale.GERMAN.toString(), AdditionalSubtype.QWERTY);
final InputMethodSubtype FR_QWERTZ = AdditionalSubtype.createAdditionalSubtype(
Locale.FRENCH.toString(), AdditionalSubtype.QWERTZ);
final InputMethodSubtype EN_AZERTY = AdditionalSubtype.createAdditionalSubtype(
Locale.ENGLISH.toString(), AdditionalSubtype.AZERTY);
final InputMethodSubtype ZZ_AZERTY = AdditionalSubtype.createAdditionalSubtype(
SubtypeLocale.NO_LANGUAGE, AdditionalSubtype.AZERTY);
assertTrue(AdditionalSubtype.isAdditionalSubtype(FR_QWERTZ));
assertTrue(AdditionalSubtype.isAdditionalSubtype(DE_QWERTY));