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( additionalMoreKeys = style.getStringArray(
keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys); keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
} }
moreKeys = KeySpecParser.insertAddtionalMoreKeys(moreKeys, additionalMoreKeys); moreKeys = KeySpecParser.insertAdditionalMoreKeys(moreKeys, additionalMoreKeys);
if (moreKeys != null) { if (moreKeys != null) {
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS; actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
mMoreKeys = new MoreKeySpec[moreKeys.length]; 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) { String[] additionalMoreKeySpecs) {
final String[] moreKeys = filterOutEmptyString(moreKeySpecs); final String[] moreKeys = filterOutEmptyString(moreKeySpecs);
final String[] additionalMoreKeys = filterOutEmptyString(additionalMoreKeySpecs); final String[] additionalMoreKeys = filterOutEmptyString(additionalMoreKeySpecs);

View File

@ -19,7 +19,6 @@ package com.android.inputmethod.latin;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
public class AdditionalSubtype { public class AdditionalSubtype {
public static final String QWERTY = "qwerty"; public static final String QWERTY = "qwerty";
@ -43,14 +42,14 @@ public class AdditionalSubtype {
return subtype.containsExtraValueKey(SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE); return subtype.containsExtraValueKey(SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE);
} }
public static InputMethodSubtype createAddtionalSubtype( public static InputMethodSubtype createAdditionalSubtype(
Locale locale, String keyboardLayoutSet) { String localeString, String keyboardLayoutSet) {
final String extraValue = String.format( final String extraValue = String.format(
"%s=%s,%s", LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET, keyboardLayoutSet, "%s=%s,%s", LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET, keyboardLayoutSet,
SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE); SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE);
Integer nameId = sKeyboardLayoutToNameIdsMap.get(keyboardLayoutSet); Integer nameId = sKeyboardLayoutToNameIdsMap.get(keyboardLayoutSet);
if (nameId == null) nameId = R.string.subtype_generic; if (nameId == null) nameId = R.string.subtype_generic;
return new InputMethodSubtype(nameId, R.drawable.ic_subtype_keyboard, 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(); loadSettings();
SubtypeUtils.setAditionalInputMethodSubtypes( SubtypeUtils.setAdditionalInputMethodSubtypes(
this, mSettingsValues.getPrefefinedAdditionalSubtypes()); this, mSettingsValues.getPrefefinedAdditionalSubtypes());
// TODO: remove the following when it's not needed by updateCorrectionMode() any more // 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); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
// Predefined additional subtypes // Predefined additional subtypes
final InputMethodSubtype DE_QWERTY = AdditionalSubtype.createAddtionalSubtype( final InputMethodSubtype DE_QWERTY = AdditionalSubtype.createAdditionalSubtype(
Locale.GERMAN, AdditionalSubtype.QWERTY); Locale.GERMAN.toString(), AdditionalSubtype.QWERTY);
final InputMethodSubtype FR_QWERTZ = AdditionalSubtype.createAddtionalSubtype( final InputMethodSubtype FR_QWERTZ = AdditionalSubtype.createAdditionalSubtype(
Locale.FRENCH, AdditionalSubtype.QWERTZ); Locale.FRENCH.toString(), AdditionalSubtype.QWERTZ);
mPredefinedAdditionalSubtypes = new InputMethodSubtype[] { mPredefinedAdditionalSubtypes = new InputMethodSubtype[] {
DE_QWERTY, DE_QWERTY,
FR_QWERTZ, FR_QWERTZ,

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ class ProximityInfo {
} ProximityType; } ProximityType;
ProximityInfo(const std::string localeStr, const int maxProximityCharsSize, 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 int gridHeight, const int mostCommonkeyWidth,
const int32_t *proximityCharsArray, const int keyCount, const int32_t *keyXCoordinates, const int32_t *proximityCharsArray, const int keyCount, const int32_t *keyXCoordinates,
const int32_t *keyYCoordinates, const int32_t *keyWidths, const int32_t *keyHeights, 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, private static void assertMoreKeys(String message, String[] moreKeys,
String[] additionalMoreKeys, String[] expected) { String[] additionalMoreKeys, String[] expected) {
final String[] actual = KeySpecParser.insertAddtionalMoreKeys( final String[] actual = KeySpecParser.insertAdditionalMoreKeys(
moreKeys, additionalMoreKeys); moreKeys, additionalMoreKeys);
if (expected == null && actual == null) { if (expected == null && actual == null) {
return; return;

View File

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