aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java66
-rw-r--r--java/res/xml/keystyle_devanagari_sign_virama.xml2
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java7
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java5
-rw-r--r--java/src/com/android/inputmethod/keyboard/ProximityInfo.java28
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFacilitator.java36
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java96
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java13
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java3
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java41
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/PrivateCommandPerformer.java40
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/FormatSpec.java4
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/WordProperty.java31
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java5
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java119
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java6
-rw-r--r--java/src/com/android/inputmethod/latin/utils/CollectionUtils.java10
-rw-r--r--native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp6
-rw-r--r--native/jni/src/suggest/core/layout/additional_proximity_chars.cpp2
-rw-r--r--native/jni/src/suggest/core/layout/additional_proximity_chars.h27
-rw-r--r--native/jni/src/suggest/core/layout/proximity_info.cpp21
-rw-r--r--native/jni/src/suggest/core/layout/proximity_info.h14
-rw-r--r--native/jni/src/suggest/core/layout/proximity_info_state.cpp4
-rw-r--r--native/jni/src/suggest/core/layout/proximity_info_state.h3
-rw-r--r--native/jni/src/suggest/core/layout/proximity_info_utils.h11
-rw-r--r--native/jni/src/suggest/core/session/dic_traverse_session.cpp8
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Arabic.java20
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java10
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Azerty.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Bengali.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/BengaliAkkhor.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java11
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java10
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Colemak.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java63
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/EastSlavic.java24
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Farsi.java11
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Georgian.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Greek.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java11
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Hindi.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java10
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Kannada.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Khmer.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Lao.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java286
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Marathi.java27
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java12
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java22
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java10
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Nordic.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java32
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Qwerty.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Qwertz.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Sinhala.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/SouthSlavic.java24
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Spanish.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Swiss.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Symbols.java8
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java8
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Tamil.java27
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Telugu.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Thai.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Uzbek.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/BengaliCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/BengaliCustomizer.java)8
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/DanishCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/DanishCustomizer.java)7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/DevanagariCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/DevanagariCustomizer.java)31
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/DutchCustomizer.java89
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/DvorakCustomizer.java78
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/EastSlavicCustomizer.java40
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/EnglishCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/EnglishCustomizer.java)7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/EstonianEECustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/EstonianEECustomizer.java)11
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/EuroCustomizer.java40
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/FinnishCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/FinnishCustomizer.java)7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/FrenchCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/FrenchCustomizer.java)25
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/GermanCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/GermanCustomizer.java)22
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/HindiCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/HindiCustomizer.java)30
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/ItalianCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/ItalianCustomizer.java)5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/LayoutCustomizer.java214
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/NepaliCustomizer.java45
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/NoLanguageCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/NoLanguageCustomizer.java)7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/NorwegianCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/NorwegianCustomizer.java)7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/PcQwertyCustomizer.java50
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/PortugueseCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/PortugueseCustomizer.java)7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/SerbianLatinCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/SerbianLatinCustomizer.java)10
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/SouthSlavicLayoutCustomizer.java43
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/SpanishCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/SpanishCustomizer.java)14
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/SwedishCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/SwedishCustomizer.java)8
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/TamilCustomizer.java45
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/TurkicCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/TurkicCustomizer.java)7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/customizer/UzbekCustomizer.java (renamed from tests/src/com/android/inputmethod/keyboard/layout/tests/UzbekCustomizer.java)10
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java73
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/KeyboardLayoutSetSubtypesCountTests.java (renamed from tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java)4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAfrikaans.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArmenianAMPhonetic.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAzerbaijaniAZ.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBasqueES.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBelarusianBY.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliBD.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliIN.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCatalan.java12
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCroatian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCzech.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanish.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanishQwertz.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutch.java71
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutchBE.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java11
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java17
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java17
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUK.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUS.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEsperanto.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEE.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEEQwerty.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnish.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnishQwerty.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrench.java22
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCA.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCH.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchDvorak.java6
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchQwertz.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGalicianES.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGerman.java20
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanCH.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanDvorak.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanQwerty.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGreek.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHungarian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIcelandic.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIndonesian.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKannadaIN.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKazakh.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKyrgyz.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLatvian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLithuanian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMacedonian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayMY.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMarathiIN.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMyanmarMM.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliRomanized.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliTraditional.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguage.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageColemak.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageDvorak.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguagePcQwerty.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegian.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegianColemak.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPolish.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortugueseBR.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortuguesePT.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java11
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java11
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRomanian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRussian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSinhalaLK.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovak.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovenian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanishUS.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSplitLayoutQwertyEnglishUS.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwahili.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedish.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedishPcQwerty.java7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTagalog.java9
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilIN.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilLK.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilSG.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTeluguIN.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsThai.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTurkish.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbek.java1
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbekQwerty.java5
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java6
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsZulu.java1
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java47
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java58
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java101
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java4
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java9
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java53
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java4
-rw-r--r--tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java47
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java55
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java2
209 files changed, 1952 insertions, 1230 deletions
diff --git a/java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java b/java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java
new file mode 100644
index 000000000..672d6d1a1
--- /dev/null
+++ b/java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.touchinputconsumer;
+
+import android.view.inputmethod.EditorInfo;
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.latin.InputPointers;
+import com.android.inputmethod.latin.SuggestedWords;
+import com.android.inputmethod.latin.inputlogic.PrivateCommandPerformer;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Stub for GestureConsumer.
+ * <br>
+ * The methods of this class should only be called from a single thread, e.g.,
+ * the UI Thread.
+ */
+public class GestureConsumer {
+ public static final GestureConsumer NULL_GESTURE_CONSUMER =
+ new GestureConsumer();
+
+ public static GestureConsumer newInstance(
+ final EditorInfo editorInfo, final PrivateCommandPerformer commandPerformer,
+ final List<Locale> locales, final Keyboard keyboard) {
+ return GestureConsumer.NULL_GESTURE_CONSUMER;
+ }
+
+ private GestureConsumer() {
+ }
+
+ public boolean willConsume() {
+ return false;
+ }
+
+ public void onInit(final List<Locale> locales, final Keyboard keyboard) {
+ }
+
+ public void onGestureStarted(final List<Locale> locales, final Keyboard keyboard) {
+ }
+
+ public void onGestureCanceled() {
+ }
+
+ public void onGestureCompleted(final InputPointers inputPointers) {
+ }
+
+ public void onImeSuggestionsProcessed(final SuggestedWords suggestedWords,
+ final int composingStart, final int composingLength) {
+ }
+}
diff --git a/java/res/xml/keystyle_devanagari_sign_virama.xml b/java/res/xml/keystyle_devanagari_sign_virama.xml
index ff778d94c..7863ca48f 100644
--- a/java/res/xml/keystyle_devanagari_sign_virama.xml
+++ b/java/res/xml/keystyle_devanagari_sign_virama.xml
@@ -35,7 +35,7 @@
U+090D: "ऍ" DEVANAGARI LETTER CANDRA E -->
<key-style
latin:styleName="moreKeysDevanagariSignVirama"
- latin:moreKeys="&#x25CC;&#x0945;,&#x090D;" />
+ latin:moreKeys="&#x25CC;&#x0945;|&#x0945;,&#x090D;" />
</case>
<case latin:keyboardLayoutSet="marathi">
<!-- U+0905: "अ" DEVANAGARI LETTER A -->
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 85dfea4e7..d35c8fae1 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -108,10 +108,9 @@ public class Keyboard {
mAltCodeKeysWhileTyping = Collections.unmodifiableList(params.mAltCodeKeysWhileTyping);
mIconsSet = params.mIconsSet;
- mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(),
- params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight,
- mMostCommonKeyWidth, mMostCommonKeyHeight, mSortedKeys,
- params.mTouchPositionCorrection);
+ mProximityInfo = new ProximityInfo(params.GRID_WIDTH, params.GRID_HEIGHT,
+ mOccupiedWidth, mOccupiedHeight, mMostCommonKeyWidth, mMostCommonKeyHeight,
+ mSortedKeys, params.mTouchPositionCorrection);
mProximityCharsCorrectionEnabled = params.mProximityCharsCorrectionEnabled;
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 246d11bac..7f2957fff 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -254,8 +254,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
}
public void onToggleEmojiKeyboard() {
- if (mKeyboardLayoutSet == null || !isShowingEmojiPalettes()) {
- mLatinIME.startShowingInputView();
+ final boolean needsToLoadKeyboard = (mKeyboardLayoutSet == null);
+ if (needsToLoadKeyboard || !isShowingEmojiPalettes()) {
+ mLatinIME.startShowingInputView(needsToLoadKeyboard);
setEmojiKeyboard();
} else {
mLatinIME.stopShowingInputView();
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index c19cd671a..9c5abcd71 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -52,18 +52,11 @@ public class ProximityInfo {
private final int mMostCommonKeyHeight;
private final List<Key> mSortedKeys;
private final List<Key>[] mGridNeighbors;
- private final String mLocaleStr;
@SuppressWarnings("unchecked")
- ProximityInfo(final String localeStr, final int gridWidth, final int gridHeight,
- final int minWidth, final int height, final int mostCommonKeyWidth,
- final int mostCommonKeyHeight, final List<Key> sortedKeys,
+ ProximityInfo(final int gridWidth, final int gridHeight, final int minWidth, final int height,
+ final int mostCommonKeyWidth, final int mostCommonKeyHeight, final List<Key> sortedKeys,
final TouchPositionCorrection touchPositionCorrection) {
- if (TextUtils.isEmpty(localeStr)) {
- mLocaleStr = "";
- } else {
- mLocaleStr = localeStr;
- }
mGridWidth = gridWidth;
mGridHeight = gridHeight;
mGridSize = mGridWidth * mGridHeight;
@@ -89,11 +82,10 @@ public class ProximityInfo {
}
// TODO: Stop passing proximityCharsArray
- private static native long setProximityInfoNative(String locale,
- int displayWidth, int displayHeight, int gridWidth, int gridHeight,
- int mostCommonKeyWidth, int mostCommonKeyHeight, int[] proximityCharsArray,
- int keyCount, int[] keyXCoordinates, int[] keyYCoordinates, int[] keyWidths,
- int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs,
+ private static native long setProximityInfoNative(int displayWidth, int displayHeight,
+ int gridWidth, int gridHeight, int mostCommonKeyWidth, int mostCommonKeyHeight,
+ int[] proximityCharsArray, int keyCount, int[] keyXCoordinates, int[] keyYCoordinates,
+ int[] keyWidths, int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs,
float[] sweetSpotCenterYs, float[] sweetSpotRadii);
private static native void releaseProximityInfoNative(long nativeProximityInfo);
@@ -221,10 +213,10 @@ public class ProximityInfo {
}
// TODO: Stop passing proximityCharsArray
- return setProximityInfoNative(mLocaleStr, mKeyboardMinWidth, mKeyboardHeight,
- mGridWidth, mGridHeight, mMostCommonKeyWidth, mMostCommonKeyHeight,
- proximityCharsArray, keyCount, keyXCoordinates, keyYCoordinates, keyWidths,
- keyHeights, keyCharCodes, sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
+ return setProximityInfoNative(mKeyboardMinWidth, mKeyboardHeight, mGridWidth, mGridHeight,
+ mMostCommonKeyWidth, mMostCommonKeyHeight, proximityCharsArray, keyCount,
+ keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,
+ sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
}
public long getNativeProximityInfo() {
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
index 6dc1e8273..1f0317288 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
@@ -99,6 +99,30 @@ public class DictionaryFacilitator {
DICT_TYPES_ORDERED_TO_GET_SUGGESTIONS.length);
/**
+ * Returns whether this facilitator is exactly for this list of locales.
+ * @param locales the list of locales to test against
+ * @return true if this facilitator handles exactly this list of locales, false otherwise
+ */
+ public boolean isForLocales(final Locale[] locales) {
+ if (locales.length != mDictionaryGroups.length) {
+ return false;
+ }
+ for (final Locale locale : locales) {
+ boolean found = false;
+ for (final DictionaryGroup group : mDictionaryGroups) {
+ if (locale.equals(group.mLocale)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
* A group of dictionaries that work together for a single language.
*/
private static class DictionaryGroup {
@@ -199,6 +223,18 @@ public class DictionaryFacilitator {
return mDictionaryGroups[0].mLocale;
}
+ /**
+ * Returns the primary locale among all currently active locales. BE CAREFUL using this.
+ *
+ * DO NOT USE THIS just because it's convenient. Use it when it's correct, for example when
+ * choosing what dictionary to put a word in, or when changing the capitalization of a typed
+ * string.
+ * @return the primary active locale
+ */
+ public Locale getPrimaryLocale() {
+ return mDictionaryGroups[0].mLocale;
+ }
+
private static ExpandableBinaryDictionary getSubDict(final String dictType,
final Context context, final Locale locale, final File dictFile,
final String dictNamePrefix) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 099d4850e..be2efb2dc 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -84,12 +84,12 @@ import com.android.inputmethod.latin.settings.SettingsActivity;
import com.android.inputmethod.latin.settings.SettingsValues;
import com.android.inputmethod.latin.suggestions.SuggestionStripView;
import com.android.inputmethod.latin.suggestions.SuggestionStripViewAccessor;
+import com.android.inputmethod.latin.touchinputconsumer.GestureConsumer;
import com.android.inputmethod.latin.utils.ApplicationUtils;
import com.android.inputmethod.latin.utils.CapsModeUtils;
import com.android.inputmethod.latin.utils.CoordinateUtils;
import com.android.inputmethod.latin.utils.CursorAnchorInfoUtils;
import com.android.inputmethod.latin.utils.DialogUtils;
-import com.android.inputmethod.latin.utils.DistracterFilterCheckingExactMatchesAndSuggestions;
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
import com.android.inputmethod.latin.utils.IntentUtils;
import com.android.inputmethod.latin.utils.JniUtils;
@@ -102,6 +102,7 @@ import com.android.inputmethod.latin.utils.ViewLayoutUtils;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
@@ -177,6 +178,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private final boolean mIsHardwareAcceleratedDrawingEnabled;
+ private GestureConsumer mGestureConsumer = GestureConsumer.NULL_GESTURE_CONSUMER;
+
public final UIHandler mHandler = new UIHandler(this);
public static final class UIHandler extends LeakGuardHandlerWrapper<LatinIME> {
@@ -253,12 +256,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// We need to re-evaluate the currently composing word in case the script has
// changed.
postWaitForDictionaryLoad();
- latinIme.resetSuggest();
+ latinIme.resetDictionaryFacilitatorIfNecessary();
break;
case MSG_UPDATE_TAIL_BATCH_INPUT_COMPLETED:
+ final SuggestedWords suggestedWords = (SuggestedWords) msg.obj;
latinIme.mInputLogic.onUpdateTailBatchInputCompleted(
latinIme.mSettings.getCurrent(),
- (SuggestedWords) msg.obj, latinIme.mKeyboardSwitcher);
+ suggestedWords, latinIme.mKeyboardSwitcher);
+ latinIme.onTailBatchInputResultShown(suggestedWords);
break;
case MSG_RESET_CACHES:
final SettingsValues settingsValues = latinIme.mSettings.getCurrent();
@@ -537,9 +542,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler.onCreate();
DEBUG = DebugFlags.DEBUG_ENABLED;
- // TODO: Resolve mutual dependencies of {@link #loadSettings()} and {@link #initSuggest()}.
+ // TODO: Resolve mutual dependencies of {@link #loadSettings()} and
+ // {@link #resetDictionaryFacilitatorIfNecessary()}.
loadSettings();
- resetSuggest();
+ resetDictionaryFacilitatorIfNecessary();
// Register to receive ringer mode change and network state change.
// Also receive installation and removal of a dictionary pack.
@@ -580,7 +586,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// been displayed. Opening dictionaries never affects responsivity as dictionaries are
// asynchronously loaded.
if (!mHandler.hasPendingReopenDictionaries()) {
- resetSuggestForLocale(locale);
+ resetDictionaryFacilitatorForLocale(locale);
}
mDictionaryFacilitator.updateEnabledSubtypes(mRichImm.getMyEnabledInputMethodSubtypeList(
true /* allowsImplicitlySelectedSubtypes */));
@@ -621,8 +627,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- private void resetSuggest() {
+ private void resetDictionaryFacilitatorIfNecessary() {
final Locale switcherSubtypeLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
+ if (mDictionaryFacilitator.isForLocales(new Locale[] { switcherSubtypeLocale })) {
+ return;
+ }
final String switcherLocaleStr = switcherSubtypeLocale.toString();
final Locale subtypeLocale;
if (TextUtils.isEmpty(switcherLocaleStr)) {
@@ -637,15 +646,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} else {
subtypeLocale = switcherSubtypeLocale;
}
- resetSuggestForLocale(subtypeLocale);
+ resetDictionaryFacilitatorForLocale(subtypeLocale);
}
/**
- * Reset suggest by loading dictionaries for the locale and the current settings values.
+ * Reset the facilitator by loading dictionaries for the locale and the current settings values.
*
* @param locale the locale
*/
- private void resetSuggestForLocale(final Locale locale) {
+ // TODO: make sure the current settings always have the right locale, and read from them
+ private void resetDictionaryFacilitatorForLocale(final Locale locale) {
final SettingsValues settingsValues = mSettings.getCurrent();
mDictionaryFacilitator.resetDictionaries(this /* context */, locale,
settingsValues.mUseContactsDict, settingsValues.mUsePersonalizedDicts,
@@ -723,6 +733,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void setInputView(final View view) {
super.setInputView(view);
mInputView = view;
+ updateSoftInputWindowLayoutParameters();
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
if (hasSuggestionStripView()) {
mSuggestionStripView.setListener(this, view);
@@ -795,6 +806,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
StatsUtils.onFinishInputView();
mHandler.onFinishInputView(finishingInput);
mStatsUtilsManager.onFinishInputView();
+ mGestureConsumer = GestureConsumer.NULL_GESTURE_CONSUMER;
}
@Override
@@ -820,6 +832,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@SuppressWarnings("deprecation")
private void onStartInputViewInternal(final EditorInfo editorInfo, final boolean restarting) {
super.onStartInputView(editorInfo, restarting);
+ // Switch to the null consumer to handle cases leading to early exit below, for which we
+ // also wouldn't be consuming gesture data.
+ mGestureConsumer = GestureConsumer.NULL_GESTURE_CONSUMER;
mRichImm.clearSubtypeCaches();
final KeyboardSwitcher switcher = mKeyboardSwitcher;
switcher.updateKeyboardTheme();
@@ -863,6 +878,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return;
}
+ // Update to a gesture consumer with the current editor and IME state.
+ mGestureConsumer = GestureConsumer.newInstance(editorInfo,
+ mInputLogic.getPrivateCommandPerformer(),
+ Collections.singletonList(mSubtypeSwitcher.getCurrentSubtypeLocale()),
+ switcher.getKeyboard());
+
// Forward this event to the accessibility utilities, if enabled.
final AccessibilityUtils accessUtils = AccessibilityUtils.getInstance();
if (accessUtils.isTouchExplorationEnabled()) {
@@ -901,12 +922,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mInputLogic.startInput(mSubtypeSwitcher.getCombiningRulesExtraValueOfCurrentSubtype(),
currentSettingsValues);
- // Note: the following does a round-trip IPC on the main thread: be careful
- final Locale currentLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
- if (null != currentLocale && !currentLocale.equals(suggest.getLocale())) {
- // TODO: Do this automatically.
- resetSuggest();
- }
+ resetDictionaryFacilitatorIfNecessary();
// TODO[IL]: Can the following be moved to InputLogic#startInput?
if (!mInputLogic.mConnection.resetCachesUponCursorMoveAndReturnSuccess(
@@ -1132,6 +1148,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onComputeInsets(final InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
+ // This method may be called before {@link #setInputView(View)}.
+ if (mInputView == null) {
+ return;
+ }
final SettingsValues settingsValues = mSettings.getCurrent();
final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
if (visibleKeyboardView == null || !hasSuggestionStripView()) {
@@ -1166,12 +1186,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
outInsets.visibleTopInsets = visibleTopY;
}
- public void startShowingInputView() {
+ public void startShowingInputView(final boolean needsToLoadKeyboard) {
mIsExecutingStartShowingInputView = true;
// This {@link #showWindow(boolean)} will eventually call back
// {@link #onEvaluateInputViewShown()}.
showWindow(true /* showInput */);
mIsExecutingStartShowingInputView = false;
+ if (needsToLoadKeyboard) {
+ loadKeyboard();
+ }
}
public void stopShowingInputView() {
@@ -1179,6 +1202,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
@Override
+ public boolean onShowInputRequested(final int flags, final boolean configChange) {
+ if (Settings.getInstance().getCurrent().mHasHardwareKeyboard) {
+ return true;
+ }
+ return super.onShowInputRequested(flags, configChange);
+ }
+
+ @Override
public boolean onEvaluateInputViewShown() {
if (mIsExecutingStartShowingInputView) {
return true;
@@ -1208,8 +1239,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void updateFullscreenMode() {
+ super.updateFullscreenMode();
+ mInputLogic.onUpdateFullscreenMode(isFullscreenMode());
+ updateSoftInputWindowLayoutParameters();
+ }
+
+ private void updateSoftInputWindowLayoutParameters() {
// Override layout parameters to expand {@link SoftInputWindow} to the entire screen.
- // See {@link InputMethodService#setinputView(View) and
+ // See {@link InputMethodService#setinputView(View)} and
// {@link SoftInputWindow#updateWidthHeight(WindowManager.LayoutParams)}.
final Window window = getWindow().getWindow();
ViewLayoutUtils.updateLayoutHeightOf(window, LayoutParams.MATCH_PARENT);
@@ -1228,8 +1265,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
ViewLayoutUtils.updateLayoutGravityOf(inputArea, Gravity.BOTTOM);
ViewLayoutUtils.updateLayoutHeightOf(mInputView, layoutHeight);
}
- super.updateFullscreenMode();
- mInputLogic.onUpdateFullscreenMode(isFullscreenMode());
}
private int getCurrentAutoCapsState() {
@@ -1398,6 +1433,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onStartBatchInput() {
mInputLogic.onStartBatchInput(mSettings.getCurrent(), mKeyboardSwitcher, mHandler);
+ mGestureConsumer.onGestureStarted(
+ Collections.singletonList(mSubtypeSwitcher.getCurrentSubtypeLocale()),
+ mKeyboardSwitcher.getKeyboard());
}
@Override
@@ -1408,11 +1446,25 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onEndBatchInput(final InputPointers batchPointers) {
mInputLogic.onEndBatchInput(batchPointers);
+ mGestureConsumer.onGestureCompleted(batchPointers);
}
@Override
public void onCancelBatchInput() {
mInputLogic.onCancelBatchInput(mHandler);
+ mGestureConsumer.onGestureCanceled();
+ }
+
+ /**
+ * To be called after the InputLogic has gotten a chance to act on the on-device decoding
+ * for the full gesture, possibly updating the TextView to reflect the first decoding.
+ * <p>
+ * This method must be run on the UI Thread.
+ * @param suggestedWords On-device decoding for the full gesture.
+ */
+ public void onTailBatchInputResultShown(final SuggestedWords suggestedWords) {
+ mGestureConsumer.onImeSuggestionsProcessed(suggestedWords,
+ mInputLogic.getComposingStart(), mInputLogic.getComposingLength());
}
// This method must run on the UI Thread.
@@ -1554,7 +1606,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
final String wordToShow;
if (CapsModeUtils.isAutoCapsMode(mInputLogic.mLastComposedWord.mCapitalizedMode)) {
- wordToShow = word.toLowerCase(mSubtypeSwitcher.getCurrentSubtypeLocale());
+ wordToShow = word.toLowerCase(mDictionaryFacilitator.getPrimaryLocale());
} else {
wordToShow = word;
}
@@ -1840,7 +1892,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void dumpDictionaryForDebug(final String dictName) {
if (mDictionaryFacilitator.getLocale() == null) {
- resetSuggest();
+ resetDictionaryFacilitatorIfNecessary();
}
mDictionaryFacilitator.dumpDictionaryForDebug(dictName);
}
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index a7ea2a1c8..62a258b20 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -19,6 +19,7 @@ package com.android.inputmethod.latin;
import android.graphics.Color;
import android.inputmethodservice.InputMethodService;
import android.os.Build;
+import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
@@ -33,6 +34,7 @@ import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import com.android.inputmethod.compat.InputConnectionCompatUtils;
+import com.android.inputmethod.latin.inputlogic.PrivateCommandPerformer;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
import com.android.inputmethod.latin.utils.CapsModeUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;
@@ -52,7 +54,7 @@ import java.util.Arrays;
* all the time to find out what text is in the buffer, when we need it to determine caps mode
* for example.
*/
-public final class RichInputConnection {
+public final class RichInputConnection implements PrivateCommandPerformer {
private static final String TAG = RichInputConnection.class.getSimpleName();
private static final boolean DBG = false;
private static final boolean DEBUG_PREVIOUS_TEXT = false;
@@ -896,6 +898,15 @@ public final class RichInputConnection {
}
}
+ @Override
+ public boolean performPrivateCommand(final String action, final Bundle data) {
+ mIC = mParent.getCurrentInputConnection();
+ if (mIC == null) {
+ return false;
+ }
+ return mIC.performPrivateCommand(action, data);
+ }
+
public int getExpectedSelectionStart() {
return mExpectedSelStart;
}
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index f85b34b5e..157bd1565 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -128,8 +128,7 @@ public final class WordComposer {
* Number of keystrokes in the composing word.
* @return the number of keystrokes
*/
- // This may be made public if need be, but right now it's not used anywhere
- /* package for tests */ int size() {
+ public int size() {
return mCodePointSize;
}
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index b4a1c3e65..1b1d5e7e5 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -2263,6 +2263,47 @@ public final class InputLogic {
mConnection.setComposingText(composingTextToBeSet, newCursorPosition);
}
+ /**
+ * Gets an object allowing private IME commands to be sent to the
+ * underlying editor.
+ * @return An object for sending private commands to the underlying editor.
+ */
+ public PrivateCommandPerformer getPrivateCommandPerformer() {
+ return mConnection;
+ }
+
+ /**
+ * Gets the expected index of the first char of the composing span within the editor's text.
+ * Returns a negative value in case there appears to be no valid composing span.
+ *
+ * @see #getComposingLength()
+ * @see RichInputConnection#hasSelection()
+ * @see RichInputConnection#isCursorPositionKnown()
+ * @see RichInputConnection#getExpectedSelectionStart()
+ * @see RichInputConnection#getExpectedSelectionEnd()
+ * @return The expected index in Java chars of the first char of the composing span.
+ */
+ // TODO: try and see if we can get rid of this method. Ideally the users of this class should
+ // never need to know this.
+ public int getComposingStart() {
+ if (!mConnection.isCursorPositionKnown() || mConnection.hasSelection()) {
+ return -1;
+ }
+ return mConnection.getExpectedSelectionStart() - mWordComposer.size();
+ }
+
+ /**
+ * Gets the expected length in Java chars of the composing span.
+ * May be 0 if there is no valid composing span.
+ * @see #getComposingStart()
+ * @return The expected length of the composing span.
+ */
+ // TODO: try and see if we can get rid of this method. Ideally the users of this class should
+ // never need to know this.
+ public int getComposingLength() {
+ return mWordComposer.size();
+ }
+
//////////////////////////////////////////////////////////////////////////////////////////////
// Following methods are tentatively placed in this class for the integration with
// TextDecorator.
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/PrivateCommandPerformer.java b/java/src/com/android/inputmethod/latin/inputlogic/PrivateCommandPerformer.java
new file mode 100644
index 000000000..42eaa9c82
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/inputlogic/PrivateCommandPerformer.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.inputlogic;
+
+import android.os.Bundle;
+
+/**
+ * Provides an interface matching
+ * {@link android.view.inputmethod.InputConnection#performPrivateCommand(String,Bundle)}.
+ */
+public interface PrivateCommandPerformer {
+ /**
+ * API to send private commands from an input method to its connected
+ * editor. This can be used to provide domain-specific features that are
+ * only known between certain input methods and their clients.
+ *
+ * @param action Name of the command to be performed. This must be a scoped
+ * name, i.e. prefixed with a package name you own, so that
+ * different developers will not create conflicting commands.
+ * @param data Any data to include with the command.
+ * @return true if the command was sent (regardless of whether the
+ * associated editor understood it), false if the input connection is no
+ * longer valid.
+ */
+ boolean performPrivateCommand(String action, Bundle data);
+}
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
index 2661d5d48..34edfa0da 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
@@ -163,13 +163,15 @@ public final class FormatSpec {
static final int NOT_A_VERSION_NUMBER = -1;
// These MUST have the same values as the relevant constants in format_utils.h.
- // From version 4 on, we use version * 100 + revision as a version number. That allows
+ // From version 2.01 on, we use version * 100 + revision as a version number. That allows
// us to change the format during development while having testing devices remove
// older files with each upgrade, while still having a readable versioning scheme.
// When we bump up the dictionary format version, we should update
// ExpandableDictionary.needsToMigrateDictionary() and
// ExpandableDictionary.matchesExpectedBinaryDictFormatVersionForThisType().
public static final int VERSION2 = 2;
+ public static final int VERSION201 = 201;
+ public static final int MINIMUM_SUPPORTED_VERSION_OF_CODE_POINT_TABLE = VERSION201;
// Dictionary version used for testing.
public static final int VERSION4_ONLY_FOR_TESTING = 399;
public static final int VERSION401 = 401;
diff --git a/java/src/com/android/inputmethod/latin/makedict/WordProperty.java b/java/src/com/android/inputmethod/latin/makedict/WordProperty.java
index 46705f9db..a180d060e 100644
--- a/java/src/com/android/inputmethod/latin/makedict/WordProperty.java
+++ b/java/src/com/android/inputmethod/latin/makedict/WordProperty.java
@@ -54,11 +54,15 @@ public final class WordProperty implements Comparable<WordProperty> {
mWord = word;
mProbabilityInfo = probabilityInfo;
mShortcutTargets = shortcutTargets;
- mNgrams = new ArrayList<>();
- final NgramContext ngramContext = new NgramContext(new WordInfo(mWord));
- if (bigrams != null) {
- for (final WeightedString bigramTarget : bigrams) {
- mNgrams.add(new NgramProperty(bigramTarget, ngramContext));
+ if (null == bigrams) {
+ mNgrams = null;
+ } else {
+ mNgrams = new ArrayList<>();
+ final NgramContext ngramContext = new NgramContext(new WordInfo(mWord));
+ if (bigrams != null) {
+ for (final WeightedString bigramTarget : bigrams) {
+ mNgrams.add(new NgramProperty(bigramTarget, ngramContext));
+ }
}
}
mIsBeginningOfSentence = false;
@@ -87,7 +91,7 @@ public final class WordProperty implements Comparable<WordProperty> {
mWord = StringUtils.getStringFromNullTerminatedCodePointArray(codePoints);
mProbabilityInfo = createProbabilityInfoFromArray(probabilityInfo);
mShortcutTargets = new ArrayList<>();
- mNgrams = new ArrayList<>();
+ final ArrayList<NgramProperty> ngrams = new ArrayList<>();
mIsBeginningOfSentence = isBeginningOfSentence;
mIsNotAWord = isNotAWord;
mIsBlacklistEntry = isBlacklisted;
@@ -104,8 +108,9 @@ public final class WordProperty implements Comparable<WordProperty> {
final WeightedString ngramTarget = new WeightedString(ngramTargetString,
createProbabilityInfoFromArray(bigramProbabilityInfo.get(i)));
// TODO: Support n-gram.
- mNgrams.add(new NgramProperty(ngramTarget, ngramContext));
+ ngrams.add(new NgramProperty(ngramTarget, ngramContext));
}
+ mNgrams = ngrams.isEmpty() ? null : ngrams;
final int shortcutTargetCount = shortcutTargets.size();
for (int i = 0; i < shortcutTargetCount; i++) {
@@ -118,6 +123,9 @@ public final class WordProperty implements Comparable<WordProperty> {
// TODO: Remove
public ArrayList<WeightedString> getBigrams() {
+ if (null == mNgrams) {
+ return null;
+ }
final ArrayList<WeightedString> bigrams = new ArrayList<>();
for (final NgramProperty ngram : mNgrams) {
if (ngram.mNgramContext.getPrevWordCount() == 1) {
@@ -167,11 +175,18 @@ public final class WordProperty implements Comparable<WordProperty> {
if (!(o instanceof WordProperty)) return false;
WordProperty w = (WordProperty)o;
return mProbabilityInfo.equals(w.mProbabilityInfo) && mWord.equals(w.mWord)
- && mShortcutTargets.equals(w.mShortcutTargets) && mNgrams.equals(w.mNgrams)
+ && mShortcutTargets.equals(w.mShortcutTargets) && equals(mNgrams, w.mNgrams)
&& mIsNotAWord == w.mIsNotAWord && mIsBlacklistEntry == w.mIsBlacklistEntry
&& mHasNgrams == w.mHasNgrams && mHasShortcuts && w.mHasNgrams;
}
+ private <T> boolean equals(final ArrayList<T> a, final ArrayList<T> b) {
+ if (null == a) {
+ return null == b;
+ }
+ return a.equals(b);
+ }
+
@Override
public int hashCode() {
if (mHashCode == 0) {
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java b/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
index 51c4b1ee8..9ddee8629 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
@@ -145,9 +145,8 @@ public class SentenceLevelAdapter {
int wordEnd = wordIterator.getEndOfWord(originalText, wordStart);
while (wordStart <= end && wordEnd != -1 && wordStart != -1) {
if (wordEnd >= start && wordEnd > wordStart) {
- CharSequence subSequence = originalText.subSequence(wordStart, wordEnd).toString();
- final TextInfo ti = TextInfoCompatUtils.newInstance(subSequence, 0,
- subSequence.length(), cookie, subSequence.hashCode());
+ final TextInfo ti = TextInfoCompatUtils.newInstance(originalText, wordStart,
+ wordEnd, cookie, originalText.subSequence(wordStart, wordEnd).hashCode());
wordItems.add(new SentenceWordItem(ti, wordStart, wordEnd));
}
wordStart = wordIterator.getBeginningOfNextWord(originalText, wordEnd);
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
index 839fce051..a651774c6 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
@@ -60,6 +60,9 @@ import com.android.inputmethod.latin.utils.ViewLayoutUtils;
import java.util.ArrayList;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
final class SuggestionStripLayoutHelper {
private static final int DEFAULT_SUGGESTIONS_COUNT_IN_STRIP = 3;
private static final float DEFAULT_CENTER_SUGGESTION_PERCENTILE = 0.40f;
@@ -213,15 +216,14 @@ final class SuggestionStripLayoutHelper {
return word;
}
- final int len = word.length();
final Spannable spannedWord = new SpannableString(word);
final int options = mSuggestionStripOptions;
if ((isAutoCorrection && (options & AUTO_CORRECT_BOLD) != 0)
|| (isTypedWordValid && (options & VALID_TYPED_WORD_BOLD) != 0)) {
- spannedWord.setSpan(BOLD_SPAN, 0, len, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+ addStyleSpan(spannedWord, BOLD_SPAN);
}
if (isAutoCorrection && (options & AUTO_CORRECT_UNDERLINE) != 0) {
- spannedWord.setSpan(UNDERLINE_SPAN, 0, len, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+ addStyleSpan(spannedWord, UNDERLINE_SPAN);
}
return spannedWord;
}
@@ -446,10 +448,11 @@ final class SuggestionStripLayoutHelper {
// {@link StyleSpan} in a content description may cause an issue of TTS/TalkBack.
// Use a simple {@link String} to avoid the issue.
wordView.setContentDescription(TextUtils.isEmpty(word) ? null : word.toString());
- final CharSequence text = getEllipsizedText(word, width, wordView.getPaint());
- final float scaleX = getTextScaleX(word, width, wordView.getPaint());
+ final CharSequence text = getEllipsizedTextWithSettingScaleX(
+ word, width, wordView.getPaint());
+ final float scaleX = wordView.getTextScaleX();
wordView.setText(text); // TextView.setText() resets text scale x to 1.0.
- wordView.setTextScaleX(Math.max(scaleX, MIN_TEXT_XSCALE));
+ wordView.setTextScaleX(scaleX);
// A <code>wordView</code> should be disabled when <code>word</code> is empty in order to
// make it unclickable.
// With accessibility touch exploration on, <code>wordView</code> should be enabled even
@@ -562,7 +565,8 @@ final class SuggestionStripLayoutHelper {
final TextView wordView = (TextView)addToDictionaryStrip.findViewById(R.id.word_to_save);
wordView.setTextColor(mColorTypedWord);
final int wordWidth = (int)(width * mCenterSuggestionWeight);
- final CharSequence wordToSave = getEllipsizedText(word, wordWidth, wordView.getPaint());
+ final CharSequence wordToSave = getEllipsizedTextWithSettingScaleX(
+ word, wordWidth, wordView.getPaint());
final float wordScaleX = wordView.getTextScaleX();
wordView.setText(wordToSave);
wordView.setTextScaleX(wordScaleX);
@@ -596,7 +600,7 @@ final class SuggestionStripLayoutHelper {
}
hintView.setTextColor(mColorAutoCorrect);
final float hintScaleX = getTextScaleX(hintText, hintWidth, hintView.getPaint());
- hintView.setText(hintText);
+ hintView.setText(hintText); // TextView.setText() resets text scale x to 1.0.
hintView.setTextScaleX(hintScaleX);
setLayoutWeight(hintView, hintWeight, ViewGroup.LayoutParams.MATCH_PARENT);
}
@@ -608,8 +612,7 @@ final class SuggestionStripLayoutHelper {
final int width = titleView.getWidth() - titleView.getPaddingLeft()
- titleView.getPaddingRight();
titleView.setTextColor(mColorAutoCorrect);
- titleView.setText(importantNoticeTitle);
- titleView.setTextScaleX(1.0f); // Reset textScaleX.
+ titleView.setText(importantNoticeTitle); // TextView.setText() resets text scale x to 1.0.
final float titleScaleX = getTextScaleX(importantNoticeTitle, width, titleView.getPaint());
titleView.setTextScaleX(titleScaleX);
}
@@ -624,18 +627,19 @@ final class SuggestionStripLayoutHelper {
}
}
- private static float getTextScaleX(final CharSequence text, final int maxWidth,
+ private static float getTextScaleX(@Nullable final CharSequence text, final int maxWidth,
final TextPaint paint) {
paint.setTextScaleX(1.0f);
final int width = getTextWidth(text, paint);
if (width <= maxWidth || maxWidth <= 0) {
return 1.0f;
}
- return maxWidth / (float)width;
+ return maxWidth / (float) width;
}
- private static CharSequence getEllipsizedText(final CharSequence text, final int maxWidth,
- final TextPaint paint) {
+ @Nullable
+ private static CharSequence getEllipsizedTextWithSettingScaleX(
+ @Nullable final CharSequence text, final int maxWidth, @Nonnull final TextPaint paint) {
if (text == null) {
return null;
}
@@ -645,62 +649,63 @@ final class SuggestionStripLayoutHelper {
return text;
}
- // Note that TextUtils.ellipsize() use text-x-scale as 1.0 if ellipsize is needed. To
- // get squeezed and ellipsized text, passes enlarged width (maxWidth / MIN_TEXT_XSCALE).
- final float upscaledWidth = maxWidth / MIN_TEXT_XSCALE;
- CharSequence ellipsized = TextUtils.ellipsize(
- text, paint, upscaledWidth, TextUtils.TruncateAt.MIDDLE);
- // For an unknown reason, ellipsized seems to return a text that does indeed fit inside the
- // passed width according to paint.measureText, but not according to paint.getTextWidths.
- // But when rendered, the text seems to actually take up as many pixels as returned by
- // paint.getTextWidths, hence problem.
- // To save this case, we compare the measured size of the new text, and if it's too much,
- // try it again removing the difference. This may still give a text too long by one or
- // two pixels so we take an additional 2 pixels cushion and call it a day.
- // TODO: figure out why getTextWidths and measureText don't agree with each other, and
- // remove the following code.
- final float ellipsizedTextWidth = getTextWidth(ellipsized, paint);
- if (upscaledWidth <= ellipsizedTextWidth) {
- ellipsized = TextUtils.ellipsize(
- text, paint, upscaledWidth - (ellipsizedTextWidth - upscaledWidth) - 2,
- TextUtils.TruncateAt.MIDDLE);
- }
+ // <code>text</code> must be ellipsized with minimum text scale x.
paint.setTextScaleX(MIN_TEXT_XSCALE);
- return ellipsized;
+ final boolean hasBoldStyle = hasStyleSpan(text, BOLD_SPAN);
+ final boolean hasUnderlineStyle = hasStyleSpan(text, UNDERLINE_SPAN);
+ // TextUtils.ellipsize erases any span object existed after ellipsized point.
+ // We have to restore these spans afterward.
+ final CharSequence ellipsizedText = TextUtils.ellipsize(
+ text, paint, maxWidth, TextUtils.TruncateAt.MIDDLE);
+ if (!hasBoldStyle && !hasUnderlineStyle) {
+ return ellipsizedText;
+ }
+ final Spannable spannableText = (ellipsizedText instanceof Spannable)
+ ? (Spannable)ellipsizedText : new SpannableString(ellipsizedText);
+ if (hasBoldStyle) {
+ addStyleSpan(spannableText, BOLD_SPAN);
+ }
+ if (hasUnderlineStyle) {
+ addStyleSpan(spannableText, UNDERLINE_SPAN);
+ }
+ return spannableText;
+ }
+
+ private static boolean hasStyleSpan(@Nullable final CharSequence text,
+ final CharacterStyle style) {
+ if (text instanceof Spanned) {
+ return ((Spanned)text).getSpanStart(style) >= 0;
+ }
+ return false;
+ }
+
+ private static void addStyleSpan(@Nonnull final Spannable text, final CharacterStyle style) {
+ text.removeSpan(style);
+ text.setSpan(style, 0, text.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
- private static int getTextWidth(final CharSequence text, final TextPaint paint) {
+ private static int getTextWidth(@Nullable final CharSequence text, final TextPaint paint) {
if (TextUtils.isEmpty(text)) {
return 0;
}
+ final int length = text.length();
+ final float[] widths = new float[length];
+ final int count;
final Typeface savedTypeface = paint.getTypeface();
- paint.setTypeface(getTextTypeface(text));
- final int len = text.length();
- final float[] widths = new float[len];
- final int count = paint.getTextWidths(text, 0, len, widths);
+ try {
+ paint.setTypeface(getTextTypeface(text));
+ count = paint.getTextWidths(text, 0, length, widths);
+ } finally {
+ paint.setTypeface(savedTypeface);
+ }
int width = 0;
for (int i = 0; i < count; i++) {
width += Math.round(widths[i] + 0.5f);
}
- paint.setTypeface(savedTypeface);
return width;
}
- private static Typeface getTextTypeface(final CharSequence text) {
- if (!(text instanceof SpannableString)) {
- return Typeface.DEFAULT;
- }
-
- final SpannableString ss = (SpannableString)text;
- final StyleSpan[] styles = ss.getSpans(0, text.length(), StyleSpan.class);
- if (styles.length == 0) {
- return Typeface.DEFAULT;
- }
-
- if (styles[0].getStyle() == Typeface.BOLD) {
- return Typeface.DEFAULT_BOLD;
- }
- // TODO: BOLD_ITALIC, ITALIC case?
- return Typeface.DEFAULT;
+ private static Typeface getTextTypeface(@Nullable final CharSequence text) {
+ return hasStyleSpan(text, BOLD_SPAN) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
}
}
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index b421a7eb5..e40fd8800 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -400,6 +400,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
if (mStripVisibilityGroup.isShowingImportantNoticeStrip()) {
return false;
}
+ // Detecting sliding up finger to show {@link MoreSuggestionsView}.
if (!mMoreSuggestionsView.isShowingInParent()) {
mLastX = (int)me.getX();
mLastY = (int)me.getY();
@@ -439,6 +440,11 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
@Override
public boolean onTouchEvent(final MotionEvent me) {
+ if (!mMoreSuggestionsView.isShowingInParent()) {
+ // Ignore any touch event while more suggestions panel hasn't been shown.
+ // Detecting sliding up is done at {@link #onInterceptTouchEvent}.
+ return true;
+ }
// In the sliding input mode. {@link MotionEvent} should be forwarded to
// {@link MoreSuggestionsView}.
final int index = me.getActionIndex();
diff --git a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
index 61292fc36..fb36b7c50 100644
--- a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.latin.utils;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
@@ -40,4 +41,13 @@ public final class CollectionUtils {
}
return list;
}
+
+ /**
+ * Tests whether c contains no elements, true if c is null or c is empty.
+ * @param c Collection to test.
+ * @return Whether c contains no elements.
+ */
+ public static boolean isNullOrEmpty(final Collection c) {
+ return c == null || c.isEmpty();
+ }
}
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
index f88d37ec9..80419b335 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
@@ -25,13 +25,13 @@
namespace latinime {
-static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jclass clazz, jstring localeJStr,
+static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jclass clazz,
jint displayWidth, jint displayHeight, jint gridWidth, jint gridHeight,
jint mostCommonkeyWidth, jint mostCommonkeyHeight, jintArray proximityChars, jint keyCount,
jintArray keyXCoordinates, jintArray keyYCoordinates, jintArray keyWidths,
jintArray keyHeights, jintArray keyCharCodes, jfloatArray sweetSpotCenterXs,
jfloatArray sweetSpotCenterYs, jfloatArray sweetSpotRadii) {
- ProximityInfo *proximityInfo = new ProximityInfo(env, localeJStr, displayWidth, displayHeight,
+ ProximityInfo *proximityInfo = new ProximityInfo(env, displayWidth, displayHeight,
gridWidth, gridHeight, mostCommonkeyWidth, mostCommonkeyHeight, proximityChars,
keyCount, keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,
sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
@@ -46,7 +46,7 @@ static void latinime_Keyboard_release(JNIEnv *env, jclass clazz, jlong proximity
static const JNINativeMethod sMethods[] = {
{
const_cast<char *>("setProximityInfoNative"),
- const_cast<char *>("(Ljava/lang/String;IIIIII[II[I[I[I[I[I[F[F[F)J"),
+ const_cast<char *>("(IIIIII[II[I[I[I[I[I[F[F[F)J"),
reinterpret_cast<void *>(latinime_Keyboard_setProximityInfo)
},
{
diff --git a/native/jni/src/suggest/core/layout/additional_proximity_chars.cpp b/native/jni/src/suggest/core/layout/additional_proximity_chars.cpp
index 34b8b37b0..8b39f7da5 100644
--- a/native/jni/src/suggest/core/layout/additional_proximity_chars.cpp
+++ b/native/jni/src/suggest/core/layout/additional_proximity_chars.cpp
@@ -19,7 +19,7 @@
namespace latinime {
// TODO: Stop using hardcoded additional proximity characters.
// TODO: Have proximity character informations in each language's binary dictionary.
-const char *AdditionalProximityChars::LOCALE_EN_US = "en";
+const int AdditionalProximityChars::LOCALE_EN_US[LOCALE_EN_US_SIZE] = { 'e', 'n' };
const int AdditionalProximityChars::EN_US_ADDITIONAL_A[EN_US_ADDITIONAL_A_SIZE] = {
'e', 'i', 'o', 'u'
diff --git a/native/jni/src/suggest/core/layout/additional_proximity_chars.h b/native/jni/src/suggest/core/layout/additional_proximity_chars.h
index a88fd6cea..2260be9bd 100644
--- a/native/jni/src/suggest/core/layout/additional_proximity_chars.h
+++ b/native/jni/src/suggest/core/layout/additional_proximity_chars.h
@@ -18,6 +18,7 @@
#define LATINIME_ADDITIONAL_PROXIMITY_CHARS_H
#include <cstring>
+#include <vector>
#include "defines.h"
@@ -26,7 +27,8 @@ namespace latinime {
class AdditionalProximityChars {
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(AdditionalProximityChars);
- static const char *LOCALE_EN_US;
+ static const int LOCALE_EN_US_SIZE = 2;
+ static const int LOCALE_EN_US[LOCALE_EN_US_SIZE];
static const int EN_US_ADDITIONAL_A_SIZE = 4;
static const int EN_US_ADDITIONAL_A[];
static const int EN_US_ADDITIONAL_E_SIZE = 4;
@@ -38,15 +40,22 @@ class AdditionalProximityChars {
static const int EN_US_ADDITIONAL_U_SIZE = 4;
static const int EN_US_ADDITIONAL_U[];
- AK_FORCE_INLINE static bool isEnLocale(const char *localeStr) {
- const size_t LOCALE_EN_US_SIZE = strlen(LOCALE_EN_US);
- return localeStr && strlen(localeStr) >= LOCALE_EN_US_SIZE
- && strncmp(localeStr, LOCALE_EN_US, LOCALE_EN_US_SIZE) == 0;
+ AK_FORCE_INLINE static bool isEnLocale(const std::vector<int> *locale) {
+ const int NCHARS = NELEMS(LOCALE_EN_US);
+ if (locale->size() < NCHARS) {
+ return false;
+ }
+ for (int i = 0; i < NCHARS; ++i) {
+ if ((*locale)[i] != LOCALE_EN_US[i]) {
+ return false;
+ }
+ }
+ return true;
}
public:
- static int getAdditionalCharsSize(const char *const localeStr, const int c) {
- if (!isEnLocale(localeStr)) {
+ static int getAdditionalCharsSize(const std::vector<int> *locale, const int c) {
+ if (!isEnLocale(locale)) {
return 0;
}
switch (c) {
@@ -65,8 +74,8 @@ class AdditionalProximityChars {
}
}
- static const int *getAdditionalChars(const char *const localeStr, const int c) {
- if (!isEnLocale(localeStr)) {
+ static const int *getAdditionalChars(const std::vector<int> *locale, const int c) {
+ if (!isEnLocale(locale)) {
return 0;
}
switch (c) {
diff --git a/native/jni/src/suggest/core/layout/proximity_info.cpp b/native/jni/src/suggest/core/layout/proximity_info.cpp
index 4c75a188e..933a5e145 100644
--- a/native/jni/src/suggest/core/layout/proximity_info.cpp
+++ b/native/jni/src/suggest/core/layout/proximity_info.cpp
@@ -49,13 +49,13 @@ static AK_FORCE_INLINE void safeGetOrFillZeroFloatArrayRegion(JNIEnv *env, jfloa
}
}
-ProximityInfo::ProximityInfo(JNIEnv *env, const jstring localeJStr,
- const int keyboardWidth, const int keyboardHeight, const int gridWidth,
- const int gridHeight, const int mostCommonKeyWidth, const int mostCommonKeyHeight,
- const jintArray proximityChars, const int keyCount, const jintArray keyXCoordinates,
- const jintArray keyYCoordinates, const jintArray keyWidths, const jintArray keyHeights,
- const jintArray keyCharCodes, const jfloatArray sweetSpotCenterXs,
- const jfloatArray sweetSpotCenterYs, const jfloatArray sweetSpotRadii)
+ProximityInfo::ProximityInfo(JNIEnv *env, const int keyboardWidth, const int keyboardHeight,
+ const int gridWidth, const int gridHeight, const int mostCommonKeyWidth,
+ const int mostCommonKeyHeight, const jintArray proximityChars, const int keyCount,
+ const jintArray keyXCoordinates, const jintArray keyYCoordinates,
+ const jintArray keyWidths, const jintArray keyHeights, const jintArray keyCharCodes,
+ const jfloatArray sweetSpotCenterXs, const jfloatArray sweetSpotCenterYs,
+ const jfloatArray sweetSpotRadii)
: GRID_WIDTH(gridWidth), GRID_HEIGHT(gridHeight), MOST_COMMON_KEY_WIDTH(mostCommonKeyWidth),
MOST_COMMON_KEY_WIDTH_SQUARE(mostCommonKeyWidth * mostCommonKeyWidth),
NORMALIZED_SQUARED_MOST_COMMON_KEY_HYPOTENUSE(1.0f +
@@ -82,13 +82,6 @@ ProximityInfo::ProximityInfo(JNIEnv *env, const jstring localeJStr,
if (DEBUG_PROXIMITY_INFO) {
AKLOGI("Create proximity info array %d", proximityCharsLength);
}
- const jsize localeCStrUtf8Length = env->GetStringUTFLength(localeJStr);
- if (localeCStrUtf8Length >= MAX_LOCALE_STRING_LENGTH) {
- AKLOGI("Locale string length too long: length=%d", localeCStrUtf8Length);
- ASSERT(false);
- }
- memset(mLocaleStr, 0, sizeof(mLocaleStr));
- env->GetStringUTFRegion(localeJStr, 0, env->GetStringLength(localeJStr), mLocaleStr);
safeGetOrFillZeroIntArrayRegion(env, proximityChars, proximityCharsLength,
mProximityCharsArray);
safeGetOrFillZeroIntArrayRegion(env, keyXCoordinates, KEY_COUNT, mKeyXCoordinates);
diff --git a/native/jni/src/suggest/core/layout/proximity_info.h b/native/jni/src/suggest/core/layout/proximity_info.h
index d4e453736..f7c907697 100644
--- a/native/jni/src/suggest/core/layout/proximity_info.h
+++ b/native/jni/src/suggest/core/layout/proximity_info.h
@@ -18,6 +18,7 @@
#define LATINIME_PROXIMITY_INFO_H
#include <unordered_map>
+#include <vector>
#include "defines.h"
#include "jni.h"
@@ -27,9 +28,9 @@ namespace latinime {
class ProximityInfo {
public:
- ProximityInfo(JNIEnv *env, const jstring localeJStr,
- const int keyboardWidth, const int keyboardHeight, const int gridWidth,
- const int gridHeight, const int mostCommonKeyWidth, const int mostCommonKeyHeight,
+ ProximityInfo(JNIEnv *env, const int keyboardWidth, const int keyboardHeight,
+ const int gridWidth, const int gridHeight,
+ const int mostCommonKeyWidth, const int mostCommonKeyHeight,
const jintArray proximityChars, const int keyCount, const jintArray keyXCoordinates,
const jintArray keyYCoordinates, const jintArray keyWidths, const jintArray keyHeights,
const jintArray keyCharCodes, const jfloatArray sweetSpotCenterXs,
@@ -71,11 +72,11 @@ class ProximityInfo {
AK_FORCE_INLINE void initializeProximities(const int *const inputCodes,
const int *const inputXCoordinates, const int *const inputYCoordinates,
- const int inputSize, int *allInputCodes) const {
+ const int inputSize, int *allInputCodes, const std::vector<int> *locale) const {
ProximityInfoUtils::initializeProximities(inputCodes, inputXCoordinates, inputYCoordinates,
inputSize, mKeyXCoordinates, mKeyYCoordinates, mKeyWidths, mKeyHeights,
mProximityCharsArray, CELL_HEIGHT, CELL_WIDTH, GRID_WIDTH, MOST_COMMON_KEY_WIDTH,
- KEY_COUNT, mLocaleStr, &mLowerCodePointToKeyMap, allInputCodes);
+ KEY_COUNT, locale, &mLowerCodePointToKeyMap, allInputCodes);
}
AK_FORCE_INLINE int getKeyIndexOf(const int c) const {
@@ -103,9 +104,6 @@ class ProximityInfo {
const int KEYBOARD_HEIGHT;
const float KEYBOARD_HYPOTENUSE;
const bool HAS_TOUCH_POSITION_CORRECTION_DATA;
- // Assuming locale strings such as en_US, sr-Latn etc.
- static const int MAX_LOCALE_STRING_LENGTH = 10;
- char mLocaleStr[MAX_LOCALE_STRING_LENGTH];
int *mProximityCharsArray;
int mKeyXCoordinates[MAX_KEY_COUNT_IN_A_KEYBOARD];
int mKeyYCoordinates[MAX_KEY_COUNT_IN_A_KEYBOARD];
diff --git a/native/jni/src/suggest/core/layout/proximity_info_state.cpp b/native/jni/src/suggest/core/layout/proximity_info_state.cpp
index 91469e26d..d43a0026a 100644
--- a/native/jni/src/suggest/core/layout/proximity_info_state.cpp
+++ b/native/jni/src/suggest/core/layout/proximity_info_state.cpp
@@ -42,7 +42,7 @@ int ProximityInfoState::getPrimaryOriginalCodePointAt(const int index) const {
void ProximityInfoState::initInputParams(const int pointerId, const float maxPointToKeyLength,
const ProximityInfo *proximityInfo, const int *const inputCodes, const int inputSize,
const int *const xCoordinates, const int *const yCoordinates, const int *const times,
- const int *const pointerIds, const bool isGeometric) {
+ const int *const pointerIds, const bool isGeometric, const std::vector<int> *locale) {
ASSERT(isGeometric || (inputSize < MAX_WORD_LENGTH));
mIsContinuousSuggestionPossible = (mHasBeenUpdatedByGeometricInput != isGeometric) ?
false : ProximityInfoStateUtils::checkAndReturnIsContinuousSuggestionPossible(
@@ -66,7 +66,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
if (!isGeometric && pointerId == 0) {
mProximityInfo->initializeProximities(inputCodes, xCoordinates, yCoordinates,
- inputSize, mInputProximities);
+ inputSize, mInputProximities, locale);
}
///////////////////////
diff --git a/native/jni/src/suggest/core/layout/proximity_info_state.h b/native/jni/src/suggest/core/layout/proximity_info_state.h
index e6180fe17..a2d663544 100644
--- a/native/jni/src/suggest/core/layout/proximity_info_state.h
+++ b/native/jni/src/suggest/core/layout/proximity_info_state.h
@@ -37,7 +37,8 @@ class ProximityInfoState {
void initInputParams(const int pointerId, const float maxPointToKeyLength,
const ProximityInfo *proximityInfo, const int *const inputCodes,
const int inputSize, const int *xCoordinates, const int *yCoordinates,
- const int *const times, const int *const pointerIds, const bool isGeometric);
+ const int *const times, const int *const pointerIds, const bool isGeometric,
+ const std::vector<int> *locale);
/////////////////////////////////////////
// Defined here //
diff --git a/native/jni/src/suggest/core/layout/proximity_info_utils.h b/native/jni/src/suggest/core/layout/proximity_info_utils.h
index 178aada2d..79d0615b8 100644
--- a/native/jni/src/suggest/core/layout/proximity_info_utils.h
+++ b/native/jni/src/suggest/core/layout/proximity_info_utils.h
@@ -19,6 +19,7 @@
#include <cmath>
#include <unordered_map>
+#include <vector>
#include "defines.h"
#include "suggest/core/layout/additional_proximity_chars.h"
@@ -51,7 +52,7 @@ class ProximityInfoUtils {
const int *const keyYCoordinates, const int *const keyWidths, const int *keyHeights,
const int *const proximityCharsArray, const int cellHeight, const int cellWidth,
const int gridWidth, const int mostCommonKeyWidth, const int keyCount,
- const char *const localeStr,
+ const std::vector<int> *locale,
const std::unordered_map<int, int> *const codeToKeyMap, int *inputProximities) {
// Initialize
// - mInputCodes
@@ -64,7 +65,7 @@ class ProximityInfoUtils {
int *proximities = &inputProximities[i * MAX_PROXIMITY_CHARS_SIZE];
calculateProximities(keyXCoordinates, keyYCoordinates, keyWidths, keyHeights,
proximityCharsArray, cellHeight, cellWidth, gridWidth, mostCommonKeyWidth,
- keyCount, x, y, primaryKey, localeStr, codeToKeyMap, proximities);
+ keyCount, x, y, primaryKey, locale, codeToKeyMap, proximities);
}
if (DEBUG_PROXIMITY_CHARS) {
@@ -143,7 +144,7 @@ class ProximityInfoUtils {
const int *const keyYCoordinates, const int *const keyWidths, const int *keyHeights,
const int *const proximityCharsArray, const int cellHeight, const int cellWidth,
const int gridWidth, const int mostCommonKeyWidth, const int keyCount,
- const int x, const int y, const int primaryKey, const char *const localeStr,
+ const int x, const int y, const int primaryKey, const std::vector<int> *locale,
const std::unordered_map<int, int> *const codeToKeyMap, int *proximities) {
const int mostCommonKeyWidthSquare = mostCommonKeyWidth * mostCommonKeyWidth;
int insertPos = 0;
@@ -177,7 +178,7 @@ class ProximityInfoUtils {
}
}
const int additionalProximitySize =
- AdditionalProximityChars::getAdditionalCharsSize(localeStr, primaryKey);
+ AdditionalProximityChars::getAdditionalCharsSize(locale, primaryKey);
if (additionalProximitySize > 0) {
proximities[insertPos++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
@@ -188,7 +189,7 @@ class ProximityInfoUtils {
}
const int *additionalProximityChars =
- AdditionalProximityChars::getAdditionalChars(localeStr, primaryKey);
+ AdditionalProximityChars::getAdditionalChars(locale, primaryKey);
for (int j = 0; j < additionalProximitySize; ++j) {
const int ac = additionalProximityChars[j];
int k = 0;
diff --git a/native/jni/src/suggest/core/session/dic_traverse_session.cpp b/native/jni/src/suggest/core/session/dic_traverse_session.cpp
index 4d7505a55..b4d01d0f0 100644
--- a/native/jni/src/suggest/core/session/dic_traverse_session.cpp
+++ b/native/jni/src/suggest/core/session/dic_traverse_session.cpp
@@ -69,8 +69,12 @@ void DicTraverseSession::initializeProximityInfoStates(const int *const inputCod
for (int i = 0; i < maxPointerCount; ++i) {
mProximityInfoStates[i].initInputParams(i, maxSpatialDistance, getProximityInfo(),
inputCodePoints, inputSize, inputXs, inputYs, times, pointerIds,
- maxPointerCount == MAX_POINTER_COUNT_G
- /* TODO: this is a hack. fix proximity info state */);
+ // Right now the line below is trying to figure out whether this is a gesture by
+ // looking at the pointer count and assuming whatever is above the cutoff is
+ // a gesture and whatever is below is type. This is hacky and incorrect, we
+ // should pass the correct information instead.
+ maxPointerCount == MAX_POINTER_COUNT_G,
+ getDictionaryStructurePolicy()->getHeaderStructurePolicy()->getLocale());
mInputSize += mProximityInfoStates[i].size();
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java b/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java
index 3f85e4baa..9c2efe246 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java
@@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.layout.Symbols.RtlSymbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted.RtlSymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -27,17 +28,15 @@ import java.util.Locale;
public final class Arabic extends LayoutBase {
private static final String LAYOUT_NAME = "arabic";
- public Arabic(final LayoutCustomizer customizer) {
- super(customizer, ArabicSymbols.class, ArabicSymbolsShifted.class);
+ public Arabic(final Locale locale) {
+ super(new ArabicCustomizer(locale), ArabicSymbols.class, ArabicSymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class ArabicCustomizer extends LayoutCustomizer {
- public ArabicCustomizer(final Locale locale) {
- super(locale);
- }
+ private static class ArabicCustomizer extends LayoutCustomizer {
+ ArabicCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return ARABIC_ALPHABET_KEY; }
@@ -141,12 +140,11 @@ public final class Arabic extends LayoutBase {
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) {
if (isPhone) {
return ALPHABET_COMMON;
- } else {
- final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON);
- // U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
- builder.insertKeysAtRow(3, 2, "\u0626");
- return builder.build();
}
+ final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON);
+ // U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
+ builder.insertKeysAtRow(3, 2, "\u0626");
+ return builder.build();
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java b/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
index 2cecedceb..261618f44 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -28,15 +29,16 @@ import java.util.Locale;
public final class ArmenianPhonetic extends LayoutBase {
private static final String LAYOUT_NAME = "armenian_phonetic";
- public ArmenianPhonetic(final LayoutCustomizer customizer) {
- super(customizer, ArmenianSymbols.class, ArmenianSymbolsShifted.class);
+ public ArmenianPhonetic(final Locale locale) {
+ super(new ArmenianPhoneticCustomizer(locale), ArmenianSymbols.class,
+ ArmenianSymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class ArmenianPhoneticCustomizer extends LayoutCustomizer {
- public ArmenianPhoneticCustomizer(final Locale locale) { super(locale); }
+ private static class ArmenianPhoneticCustomizer extends LayoutCustomizer {
+ ArmenianPhoneticCustomizer(final Locale locale) { super(locale); }
@Override
public int getNumberOfRows() { return 5; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Azerty.java b/tests/src/com/android/inputmethod/keyboard/layout/Azerty.java
index a0949637b..f3176d09d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Azerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Azerty.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Bengali.java b/tests/src/com/android/inputmethod/keyboard/layout/Bengali.java
index 24852a0dc..339cab444 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Bengali.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Bengali.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/BengaliAkkhor.java b/tests/src/com/android/inputmethod/keyboard/layout/BengaliAkkhor.java
index 4dc16cffe..bb1dc10fb 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/BengaliAkkhor.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/BengaliAkkhor.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java b/tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java
index 3282e44ae..bbe038414 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java
@@ -16,7 +16,8 @@
package com.android.inputmethod.keyboard.layout;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -25,17 +26,17 @@ import java.util.Locale;
public final class Bulgarian extends LayoutBase {
private static final String LAYOUT_NAME = "bulgarian";
- public Bulgarian(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Bulgarian(final Locale locale) {
+ super(new BulgarianCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class BulgarianCustomizer extends LayoutCustomizer {
+ private static class BulgarianCustomizer extends LayoutCustomizer {
private final EastSlavicCustomizer mEastSlavicCustomizer;
- public BulgarianCustomizer(final Locale locale) {
+ BulgarianCustomizer(final Locale locale) {
super(locale);
mEastSlavicCustomizer = new EastSlavicCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java b/tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java
index 20a5f7dac..74372b9bc 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java
@@ -16,7 +16,7 @@
package com.android.inputmethod.keyboard.layout;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -25,15 +25,15 @@ import java.util.Locale;
public final class BulgarianBds extends LayoutBase {
private static final String LAYOUT_NAME = "bulgarian_bds";
- public BulgarianBds(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public BulgarianBds(final Locale locale) {
+ super(new BulgarianBdsCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class BulgarianBdsCustomizer extends EastSlavicCustomizer {
- public BulgarianBdsCustomizer(final Locale locale) { super(locale); }
+ private static class BulgarianBdsCustomizer extends EastSlavicCustomizer {
+ BulgarianBdsCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Colemak.java b/tests/src/com/android/inputmethod/keyboard/layout/Colemak.java
index a4a9701cd..3f8ce28eb 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Colemak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Colemak.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java b/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java
index 66fce014b..7cb3b92a7 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java
@@ -17,12 +17,10 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
-import com.android.inputmethod.keyboard.layout.expected.ExpectedKey.ExpectedAdditionalMoreKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import java.util.Locale;
-
/**
* The Dvorak alphabet keyboard.
*/
@@ -36,52 +34,17 @@ public class Dvorak extends LayoutBase {
@Override
public String getName() { return LAYOUT_NAME; }
- public static class DvorakCustomizer extends LayoutCustomizer {
- public DvorakCustomizer(final Locale locale) { super(locale); }
-
- @Override
- public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
- return isPhone ? joinKeys(SHIFT_KEY): joinKeys(SHIFT_KEY, key("q"));
- }
-
- @Override
- public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : joinKeys(key("z"), SHIFT_KEY);
- }
-
- @Override
- public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
- // U+00A1: "¡" INVERTED EXCLAMATION MARK
- return isPhone ? joinKeys(key("q", SETTINGS_KEY))
- : joinKeys(key("!", joinMoreKeys("\u00A1", SETTINGS_KEY)));
- }
-
- @Override
- public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
- final ExpectedAdditionalMoreKey[] punctuationMoreKeys =
- convertToAdditionalMoreKeys(getPunctuationMoreKeys(isPhone));
- // U+00BF: "¿" INVERTED QUESTION MARK
- return isPhone
- ? joinKeys(key("z", punctuationMoreKeys))
- : joinKeys(key("?", joinMoreKeys(punctuationMoreKeys, "\u00BF")));
- }
-
- private static ExpectedAdditionalMoreKey[] convertToAdditionalMoreKeys(
- final ExpectedKey ... moreKeys) {
- final ExpectedAdditionalMoreKey[] additionalMoreKeys =
- new ExpectedAdditionalMoreKey[moreKeys.length];
- for (int index = 0; index < moreKeys.length; index++) {
- additionalMoreKeys[index] = ExpectedAdditionalMoreKey.newInstance(moreKeys[index]);
- }
- return additionalMoreKeys;
- }
- }
-
@Override
public ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) {
return ALPHABET_COMMON;
}
+ /**
+ * Get the left most key of the first row.
+ * @param isPhone true if requesting phone's keys.
+ * @param elementId the element id of the requesting shifted mode.
+ * @return the left most key of the first row.
+ */
protected ExpectedKey getRow1_1Key(final boolean isPhone, final int elementId) {
if (elementId == KeyboardId.ELEMENT_ALPHABET
|| elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
@@ -90,6 +53,12 @@ public class Dvorak extends LayoutBase {
return key("\"", additionalMoreKey("1"));
}
+ /**
+ * Get the 2nd left key of the first row.
+ * @param isPhone true if requesting phone's keys.
+ * @param elementId the element id of the requesting shifted mode.
+ * @return the 2nd left key of the first row.
+ */
protected ExpectedKey getRow1_2Key(final boolean isPhone, final int elementId) {
if (elementId == KeyboardId.ELEMENT_ALPHABET
|| elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
@@ -98,6 +67,12 @@ public class Dvorak extends LayoutBase {
return key("<", additionalMoreKey("2"));
}
+ /**
+ * Get the 3rd left key of the first row.
+ * @param isPhone true if requesting phone's keys.
+ * @param elementId the element id of the requesting shifted mode.
+ * @return the 3rd left key of the first row.
+ */
protected ExpectedKey getRow1_3Key(final boolean isPhone, final int elementId) {
if (elementId == KeyboardId.ELEMENT_ALPHABET
|| elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/EastSlavic.java b/tests/src/com/android/inputmethod/keyboard/layout/EastSlavic.java
index 7fcc974c2..f95d2d20e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/EastSlavic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/EastSlavic.java
@@ -16,11 +16,9 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.latin.Constants;
-
-import java.util.Locale;
public final class EastSlavic extends LayoutBase {
private static final String LAYOUT_NAME = "east_slavic";
@@ -32,26 +30,6 @@ public final class EastSlavic extends LayoutBase {
@Override
public String getName() { return LAYOUT_NAME; }
- public static class EastSlavicCustomizer extends LayoutCustomizer {
- public EastSlavicCustomizer(final Locale locale) {
- super(locale);
- }
-
- @Override
- public final ExpectedKey getAlphabetKey() { return EAST_SLAVIC_ALPHABET_KEY; }
-
- @Override
- public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
- }
-
- // U+0410: "А" CYRILLIC CAPITAL LETTER A
- // U+0411: "Б" CYRILLIC CAPITAL LETTER BE
- // U+0412: "В" CYRILLIC CAPITAL LETTER VE
- private static final ExpectedKey EAST_SLAVIC_ALPHABET_KEY = key(
- "\u0410\u0411\u0412", Constants.CODE_SWITCH_ALPHA_SYMBOL);
- }
-
@Override
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java b/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java
index 7390457d0..7c75a3ee9 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java
@@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.layout.Symbols.RtlSymbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted.RtlSymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -27,17 +28,15 @@ import java.util.Locale;
public final class Farsi extends LayoutBase {
private static final String LAYOUT_NAME = "farsi";
- public Farsi(final LayoutCustomizer customizer) {
- super(customizer, FarsiSymbols.class, FarsiSymbolsShifted.class);
+ public Farsi(final Locale locale) {
+ super(new FarsiCustomizer(locale), FarsiSymbols.class, FarsiSymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class FarsiCustomizer extends LayoutCustomizer {
- public FarsiCustomizer(final Locale locale) {
- super(locale);
- }
+ private static class FarsiCustomizer extends LayoutCustomizer {
+ FarsiCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return FARSI_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Georgian.java b/tests/src/com/android/inputmethod/keyboard/layout/Georgian.java
index 6f20dfcd1..c26cb9673 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Georgian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Georgian.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -29,15 +30,15 @@ import java.util.Locale;
public final class Georgian extends LayoutBase {
private static final String LAYOUT_NAME = "georgian";
- public Georgian(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Georgian(final Locale locale) {
+ super(new GeorgianCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class GeorgianCustomizer extends LayoutCustomizer {
- public GeorgianCustomizer(final Locale locale) { super(locale); }
+ private static class GeorgianCustomizer extends LayoutCustomizer {
+ GeorgianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return GEORGIAN_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Greek.java b/tests/src/com/android/inputmethod/keyboard/layout/Greek.java
index 475052c75..a8eb3d942 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Greek.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Greek.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -29,15 +30,15 @@ import java.util.Locale;
public final class Greek extends LayoutBase {
private static final String LAYOUT_NAME = "greek";
- public Greek(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Greek(final Locale locale) {
+ super(new GreekCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class GreekCustomizer extends EuroCustomizer {
- public GreekCustomizer(final Locale locale) { super(locale); }
+ private static class GreekCustomizer extends EuroCustomizer {
+ GreekCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return GREEK_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java b/tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java
index 552f0d3d5..69b43588f 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java
@@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.layout.Symbols.RtlSymbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted.RtlSymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -27,17 +28,15 @@ import java.util.Locale;
public final class Hebrew extends LayoutBase {
private static final String LAYOUT_NAME = "hebrew";
- public Hebrew(final LayoutCustomizer customizer) {
- super(customizer, HebrewSymbols.class, RtlSymbolsShifted.class);
+ public Hebrew(final Locale locale) {
+ super(new HebrewCustomizer(locale), HebrewSymbols.class, RtlSymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class HebrewCustomizer extends LayoutCustomizer {
- public HebrewCustomizer(final Locale locale) {
- super(locale);
- }
+ private static class HebrewCustomizer extends LayoutCustomizer {
+ HebrewCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return HEBREW_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java
index a080cac30..82f67aca2 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java
@@ -19,6 +19,7 @@ package com.android.inputmethod.keyboard.layout;
import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
index 457851b0c..a2e339919 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout;
import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*;
import com.android.inputmethod.keyboard.layout.Hindi.HindiSymbols;
+import com.android.inputmethod.keyboard.layout.customizer.HindiCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.keyboard.layout.tests.HindiCustomizer;
import java.util.Locale;
@@ -31,15 +31,15 @@ import java.util.Locale;
public final class HindiCompact extends LayoutBase {
private static final String LAYOUT_NAME = "hindi_compact";
- public HindiCompact(final LayoutCustomizer customizer) {
- super(customizer, HindiSymbols.class, SymbolsShifted.class);
+ public HindiCompact(final Locale locale) {
+ super(new HindiCompactCustomizer(locale), HindiSymbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class HindiCompactCustomizer extends HindiCustomizer {
- public HindiCompactCustomizer(final Locale locale) { super(locale); }
+ private static class HindiCompactCustomizer extends HindiCustomizer {
+ HindiCompactCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Kannada.java b/tests/src/com/android/inputmethod/keyboard/layout/Kannada.java
index 8bee1f83b..4fff577d3 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Kannada.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Kannada.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -28,15 +29,15 @@ import java.util.Locale;
public final class Kannada extends LayoutBase {
private static final String LAYOUT_NAME = "kannada";
- public Kannada(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Kannada(final Locale locale) {
+ super(new KannadaCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class KannadaCustomizer extends LayoutCustomizer {
- public KannadaCustomizer(final Locale locale) { super(locale); }
+ private static class KannadaCustomizer extends LayoutCustomizer {
+ KannadaCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return KANNADA_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java b/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java
index 7e4f159ab..20c4d0386 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -29,15 +30,15 @@ import java.util.Locale;
public final class Khmer extends LayoutBase {
private static final String LAYOUT_NAME = "khmer";
- public Khmer(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Khmer(final Locale locale) {
+ super(new KhmerCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class KhmerCustomizer extends LayoutCustomizer {
- public KhmerCustomizer(final Locale locale) { super(locale); }
+ private static class KhmerCustomizer extends LayoutCustomizer {
+ KhmerCustomizer(final Locale locale) { super(locale); }
@Override
public int getNumberOfRows() { return 5; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Lao.java b/tests/src/com/android/inputmethod/keyboard/layout/Lao.java
index aaa1c8a8a..091c3a611 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Lao.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Lao.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -29,15 +30,15 @@ import java.util.Locale;
public final class Lao extends LayoutBase {
private static final String LAYOUT_NAME = "lao";
- public Lao(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Lao(final Locale locale) {
+ super(new LaoCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class LaoCustomizer extends LayoutCustomizer {
- public LaoCustomizer(final Locale locale) { super(locale); }
+ private static class LaoCustomizer extends LayoutCustomizer {
+ LaoCustomizer(final Locale locale) { super(locale); }
@Override
public int getNumberOfRows() { return 5; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
index b714ec794..285a50ce9 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
@@ -17,11 +17,10 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
-import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.AbstractLayoutBase;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.latin.Constants;
import java.util.Locale;
@@ -29,218 +28,6 @@ import java.util.Locale;
* The base class of keyboard layout.
*/
public abstract class LayoutBase extends AbstractLayoutBase {
- /**
- * This class is used to customize common keyboard layout to language specific layout.
- */
- public static class LayoutCustomizer {
- private final Locale mLocale;
-
- // Empty keys definition to remove keys by adding this.
- protected static final ExpectedKey[] EMPTY_KEYS = joinKeys();
-
- public LayoutCustomizer(final Locale locale) {
- mLocale = locale;
- }
-
- public final Locale getLocale() {
- return mLocale;
- }
-
- public int getNumberOfRows() {
- return 4;
- }
-
- /**
- * Set accented letters to a specific keyboard element.
- * @param builder the {@link ExpectedKeyboardBuilder} object that contains common keyboard
- * layout.
- * @param elementId the element id of keyboard
- * @return the {@link ExpectedKeyboardBuilder} object that contains accented letters as
- * "more keys".
- */
- public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder,
- final int elementId) {
- // This method can be overridden by an extended class to provide customized expected
- // accented letters depending on the shift state of keyboard.
- // This is a default behavior to call a shift-state-independent
- // {@link #setAccentedLetters(ExpectedKeyboardBuilder)} implementation, so that
- // <code>elementId</code> is ignored here.
- return setAccentedLetters(builder);
- }
-
- /**
- * Set accented letters to common layout.
- * @param builder the {@link ExpectedKeyboardBuilder} object that contains common keyboard
- * layout.
- * @return the {@link ExpectedKeyboardBuilder} object that contains accented letters as
- * "more keys".
- */
- public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
- return builder;
- }
-
- /**
- * Get the function key to switch to alphabet layout.
- * @return the {@link ExpectedKey} of the alphabet key.
- */
- public ExpectedKey getAlphabetKey() { return ALPHABET_KEY; }
-
- /**
- * Get the function key to switch to symbols layout.
- * @return the {@link ExpectedKey} of the symbols key.
- */
- public ExpectedKey getSymbolsKey() { return SYMBOLS_KEY; }
-
- /**
- * Get the function key to switch to symbols shift layout.
- * @param isPhone true if requesting phone's key.
- * @return the {@link ExpectedKey} of the symbols shift key.
- */
- public ExpectedKey getSymbolsShiftKey(boolean isPhone) {
- return isPhone ? SYMBOLS_SHIFT_KEY : TABLET_SYMBOLS_SHIFT_KEY;
- }
-
- /**
- * Get the function key to switch from symbols shift to symbols layout.
- * @return the {@link ExpectedKey} of the back to symbols key.
- */
- public ExpectedKey getBackToSymbolsKey() { return BACK_TO_SYMBOLS_KEY; }
-
- /**
- * Get the currency key.
- * @return the {@link ExpectedKey} of the currency key.
- */
- public ExpectedKey getCurrencyKey() { return Symbols.CURRENCY_DOLLAR; }
-
- /**
- * Get other currencies keys.
- * @return the array of {@link ExpectedKey} that represents other currency keys.
- */
- public ExpectedKey[] getOtherCurrencyKeys() {
- return SymbolsShifted.CURRENCIES_OTHER_THAN_DOLLAR;
- }
-
- /**
- * Get "more keys" of double quotation mark.
- * @return the array of {@link ExpectedKey} of more double quotation marks in natural order.
- */
- public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_9LR; }
-
- /**
- * Get "more keys" of single quotation mark.
- * @return the array of {@link ExpectedKey} of more single quotation marks in natural order.
- */
- public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_9LR; }
-
- /**
- * Get double angle quotation marks in natural order.
- * @return the array of {@link ExpectedKey} of double angle quotation marks in natural
- * order.
- */
- public ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_LR; }
-
- /**
- * Get single angle quotation marks in natural order.
- * @return the array of {@link ExpectedKey} of single angle quotation marks in natural
- * order.
- */
- public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_LR; }
-
- /**
- * Get the left shift keys.
- * @param isPhone true if requesting phone's keys.
- * @return the array of {@link ExpectedKey} that should be placed at left edge of the
- * keyboard.
- */
- public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
- return joinKeys(SHIFT_KEY);
- }
-
- /**
- * Get the right shift keys.
- * @param isPhone true if requesting phone's keys.
- * @return the array of {@link ExpectedKey} that should be placed at right edge of the
- * keyboard.
- */
- public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : joinKeys(EXCLAMATION_AND_QUESTION_MARKS, SHIFT_KEY);
- }
-
- /**
- * Get the enter key.
- * @param isPhone true if requesting phone's key.
- * @return the array of {@link ExpectedKey} that should be placed as an enter key.
- */
- public ExpectedKey getEnterKey(final boolean isPhone) {
- return isPhone ? key(ENTER_KEY, EMOJI_ACTION_KEY) : ENTER_KEY;
- }
-
- /**
- * Get the emoji key.
- * @param isPhone true if requesting phone's key.
- * @return the array of {@link ExpectedKey} that should be placed as an emoji key.
- */
- public ExpectedKey getEmojiKey(final boolean isPhone) {
- return EMOJI_NORMAL_KEY;
- }
-
- /**
- * Get the space keys.
- * @param isPhone true if requesting phone's keys.
- * @return the array of {@link ExpectedKey} that should be placed at the center of the
- * keyboard.
- */
- public ExpectedKey[] getSpaceKeys(final boolean isPhone) {
- return joinKeys(LANGUAGE_SWITCH_KEY, SPACE_KEY);
- }
-
- /**
- * Get the keys left to the spacebar.
- * @param isPhone true if requesting phone's keys.
- * @return the array of {@link ExpectedKey} that should be placed at left of the spacebar.
- */
- public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
- // U+002C: "," COMMA
- return joinKeys(key("\u002C", SETTINGS_KEY));
- }
-
- /**
- * Get the keys right to the spacebar.
- * @param isPhone true if requesting phone's keys.
- * @return the array of {@link ExpectedKey} that should be placed at right of the spacebar.
- */
- public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
- final ExpectedKey periodKey = key(".", getPunctuationMoreKeys(isPhone));
- return joinKeys(periodKey);
- }
-
- /**
- * Get "more keys" for the punctuation key (usually the period key).
- * @param isPhone true if requesting phone's keys.
- * @return the array of {@link ExpectedKey} that are "more keys" of the punctuation key.
- */
- public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) {
- return isPhone ? PHONE_PUNCTUATION_MORE_KEYS : TABLET_PUNCTUATION_MORE_KEYS;
- }
- }
-
- /**
- * The layout customize class for countries that use Euro.
- */
- public static class EuroCustomizer extends LayoutCustomizer {
- public EuroCustomizer(final Locale locale) {
- super(locale);
- }
-
- @Override
- public final ExpectedKey getCurrencyKey() { return Symbols.CURRENCY_EURO; }
-
- @Override
- public final ExpectedKey[] getOtherCurrencyKeys() {
- return SymbolsShifted.CURRENCIES_OTHER_THAN_EURO;
- }
- }
-
private final LayoutCustomizer mCustomizer;
private final Symbols mSymbols;
private final SymbolsShifted mSymbolsShifted;
@@ -276,77 +63,6 @@ public abstract class LayoutBase extends AbstractLayoutBase {
*/
public final LayoutCustomizer getCustomizer() { return mCustomizer; }
- // Icon ids.
- private static final int ICON_DELETE = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_DELETE_KEY);
- private static final int ICON_SPACE = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SPACE_KEY);
- private static final int ICON_TAB = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_TAB_KEY);
- private static final int ICON_SHORTCUT = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SHORTCUT_KEY);
- private static final int ICON_SETTINGS = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SETTINGS_KEY);
- private static final int ICON_LANGUAGE_SWITCH = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_LANGUAGE_SWITCH_KEY);
- private static final int ICON_ENTER = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_ENTER_KEY);
- private static final int ICON_EMOJI_ACTION = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_EMOJI_ACTION_KEY);
- private static final int ICON_EMOJI_NORMAL = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_EMOJI_NORMAL_KEY);
- private static final int ICON_SHIFT = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SHIFT_KEY);
- private static final int ICON_SHIFTED_SHIFT = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SHIFT_KEY_SHIFTED);
- private static final int ICON_ZWNJ = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_ZWNJ_KEY);
- private static final int ICON_ZWJ = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_ZWJ_KEY);
-
- // Functional keys.
- public static final ExpectedKey DELETE_KEY = key(ICON_DELETE, Constants.CODE_DELETE);
- public static final ExpectedKey TAB_KEY = key(ICON_TAB, Constants.CODE_TAB);
- public static final ExpectedKey SHORTCUT_KEY = key(ICON_SHORTCUT, Constants.CODE_SHORTCUT);
- public static final ExpectedKey SETTINGS_KEY = key(ICON_SETTINGS, Constants.CODE_SETTINGS);
- public static final ExpectedKey LANGUAGE_SWITCH_KEY = key(
- ICON_LANGUAGE_SWITCH, Constants.CODE_LANGUAGE_SWITCH);
- public static final ExpectedKey ENTER_KEY = key(ICON_ENTER, Constants.CODE_ENTER);
- public static final ExpectedKey EMOJI_ACTION_KEY = key(ICON_EMOJI_ACTION, Constants.CODE_EMOJI);
- public static final ExpectedKey EMOJI_NORMAL_KEY = key(ICON_EMOJI_NORMAL, Constants.CODE_EMOJI);
- public static final ExpectedKey SPACE_KEY = key(ICON_SPACE, Constants.CODE_SPACE);
- static final ExpectedKey CAPSLOCK_MORE_KEY = key(" ", Constants.CODE_CAPSLOCK);
- public static final ExpectedKey SHIFT_KEY = key(ICON_SHIFT,
- Constants.CODE_SHIFT, CAPSLOCK_MORE_KEY);
- public static final ExpectedKey SHIFTED_SHIFT_KEY = key(ICON_SHIFTED_SHIFT,
- Constants.CODE_SHIFT, CAPSLOCK_MORE_KEY);
- static final ExpectedKey ALPHABET_KEY = key("ABC", Constants.CODE_SWITCH_ALPHA_SYMBOL);
- static final ExpectedKey SYMBOLS_KEY = key("?123", Constants.CODE_SWITCH_ALPHA_SYMBOL);
- static final ExpectedKey BACK_TO_SYMBOLS_KEY = key("?123", Constants.CODE_SHIFT);
- static final ExpectedKey SYMBOLS_SHIFT_KEY = key("= \\ <", Constants.CODE_SHIFT);
- static final ExpectedKey TABLET_SYMBOLS_SHIFT_KEY = key("~ [ <", Constants.CODE_SHIFT);
-
- // U+00A1: "¡" INVERTED EXCLAMATION MARK
- // U+00BF: "¿" INVERTED QUESTION MARK
- public static final ExpectedKey[] EXCLAMATION_AND_QUESTION_MARKS = joinKeys(
- key("!", moreKey("\u00A1")), key("?", moreKey("\u00BF")));
- // U+200C: ZERO WIDTH NON-JOINER
- // U+200D: ZERO WIDTH JOINER
- static final ExpectedKey ZWNJ_KEY = key(ICON_ZWNJ, "\u200C");
- static final ExpectedKey ZWJ_KEY = key(ICON_ZWJ, "\u200D");
- // Domain key
- public static final ExpectedKey DOMAIN_KEY =
- key(".com", joinMoreKeys(".net", ".org", ".gov", ".edu")).preserveCase();
-
- // Punctuation more keys for phone form factor.
- public static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
- ",", "?", "!", "#", ")", "(", "/", ";",
- "'", "@", ":", "-", "\"", "+", "%", "&");
- // Punctuation more keys for tablet form factor.
- public static final ExpectedKey[] TABLET_PUNCTUATION_MORE_KEYS = joinKeys(
- ",", "'", "#", ")", "(", "/", ";",
- "@", ":", "-", "\"", "+", "%", "&");
-
/**
* Helper method to create alphabet layout adding special function keys.
* @param builder the {@link ExpectedKeyboardBuilder} object that contains common keyboard
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java b/tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java
index b44b888e1..55c2e8b98 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -28,15 +29,15 @@ import java.util.Locale;
public final class Malayalam extends LayoutBase {
private static final String LAYOUT_NAME = "malayalam";
- public Malayalam(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Malayalam(final Locale locale) {
+ super(new MalayalamCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class MalayalamCustomizer extends LayoutCustomizer {
- public MalayalamCustomizer(final Locale locale) { super(locale); }
+ private static class MalayalamCustomizer extends LayoutCustomizer {
+ MalayalamCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return MALAYALAM_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java b/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java
index 615ec89bf..af26ec555 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout;
import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*;
import com.android.inputmethod.keyboard.layout.Hindi.HindiSymbols;
+import com.android.inputmethod.keyboard.layout.customizer.DevanagariCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.keyboard.layout.tests.DevanagariCustomizer;
import java.util.Locale;
@@ -31,20 +31,37 @@ import java.util.Locale;
public final class Marathi extends LayoutBase {
private static final String LAYOUT_NAME = "marathi";
- public Marathi(final LayoutCustomizer customizer) {
- super(customizer, HindiSymbols.class, SymbolsShifted.class);
+ public Marathi(final Locale locale) {
+ super(new MarathiCustomizer(locale), HindiSymbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class MarathiCustomizer extends DevanagariCustomizer {
- public MarathiCustomizer(final Locale locale) { super(locale); }
+ private static class MarathiCustomizer extends DevanagariCustomizer {
+ MarathiCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
+
+ @Override
+ public ExpectedKey[] getOtherCurrencyKeys() {
+ return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
+ }
@Override
public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
return EMPTY_KEYS;
}
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
+ }
+
+ // U+20B9: "₹" INDIAN RUPEE SIGN
+ private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9",
+ Symbols.CURRENCY_GENERIC_MORE_KEYS);
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java b/tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java
index 3c6c05841..288a17e10 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java
@@ -16,7 +16,7 @@
package com.android.inputmethod.keyboard.layout;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -25,17 +25,15 @@ import java.util.Locale;
public final class Mongolian extends LayoutBase {
private static final String LAYOUT_NAME = "mongolian";
- public Mongolian(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Mongolian(final Locale locale) {
+ super(new MongolianCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class MongolianMNCustomizer extends EastSlavicCustomizer {
- public MongolianMNCustomizer(final Locale locale) {
- super(locale);
- }
+ private static class MongolianCustomizer extends EastSlavicCustomizer {
+ MongolianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_TUGRIK; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java b/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
index 3c70d3266..f7b3590f3 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -29,15 +30,15 @@ import java.util.Locale;
public final class Myanmar extends LayoutBase {
private static final String LAYOUT_NAME = "myanmar";
- public Myanmar(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Myanmar(final Locale locale) {
+ super(new MyanmarCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class MyanmarCustomizer extends LayoutCustomizer {
- public MyanmarCustomizer(final Locale locale) { super(locale); }
+ private static class MyanmarCustomizer extends LayoutCustomizer {
+ MyanmarCustomizer(final Locale locale) { super(locale); }
@Override
public int getNumberOfRows() { return 5; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java
index fec226109..640b63dd6 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java
@@ -20,9 +20,9 @@ import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.layout.Hindi.HindiSymbols;
+import com.android.inputmethod.keyboard.layout.customizer.NepaliCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.keyboard.layout.tests.DevanagariCustomizer;
import java.util.Locale;
@@ -32,28 +32,20 @@ import java.util.Locale;
public final class NepaliRomanized extends LayoutBase {
private static final String LAYOUT_NAME = "nepali_romanized";
- public NepaliRomanized(final LayoutCustomizer customizer) {
- super(customizer, HindiSymbols.class, SymbolsShifted.class);
+ public NepaliRomanized(final Locale locale) {
+ super(new NepaliRomanizedCustomizer(locale), HindiSymbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class NepaliRomanizedCustomizer extends DevanagariCustomizer {
- public NepaliRomanizedCustomizer(final Locale locale) { super(locale); }
+ private static class NepaliRomanizedCustomizer extends NepaliCustomizer {
+ NepaliRomanizedCustomizer(final Locale locale) { super(locale); }
@Override
- public ExpectedKey getCurrencyKey() { return CURRENCY_NEPALI; }
-
- @Override
- public ExpectedKey[] getSpaceKeys(final boolean isPhone) {
- return joinKeys(LANGUAGE_SWITCH_KEY, SPACE_KEY, key(ZWNJ_KEY, ZWJ_KEY));
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
}
-
- // U+0930/U+0941/U+002E "रु." NEPALESE RUPEE SIGN
- private static final ExpectedKey CURRENCY_NEPALI = key("\u0930\u0941\u002E",
- Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN,
- Symbols.YEN_SIGN, Symbols.PESO_SIGN);
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java b/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java
index 4d6cdedbf..17e226f77 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java
@@ -20,7 +20,7 @@ import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.layout.Hindi.HindiSymbols;
-import com.android.inputmethod.keyboard.layout.NepaliRomanized.NepaliRomanizedCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.NepaliCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -32,15 +32,15 @@ import java.util.Locale;
public final class NepaliTraditional extends LayoutBase {
private static final String LAYOUT_NAME = "nepali_traditional";
- public NepaliTraditional(final LayoutCustomizer customizer) {
- super(customizer, HindiSymbols.class, SymbolsShifted.class);
+ public NepaliTraditional(final Locale locale) {
+ super(new NepaliTraditionalCustomizer(locale), HindiSymbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class NepaliTraditionalCustomizer extends NepaliRomanizedCustomizer {
- public NepaliTraditionalCustomizer(final Locale locale) { super(locale); }
+ private static class NepaliTraditionalCustomizer extends NepaliCustomizer {
+ NepaliTraditionalCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { return EMPTY_KEYS; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Nordic.java b/tests/src/com/android/inputmethod/keyboard/layout/Nordic.java
index c791c404d..4f718e64f 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Nordic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Nordic.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java
index 3f7340fd0..0085ac6a8 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java
@@ -17,11 +17,10 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import java.util.Locale;
-
/**
* The PC QWERTY alphabet keyboard.
*/
@@ -35,35 +34,6 @@ public final class PcQwerty extends LayoutBase {
@Override
public String getName() { return LAYOUT_NAME; }
- public static class PcQwertyCustomizer extends LayoutCustomizer {
- public PcQwertyCustomizer(final Locale locale) { super(locale); }
-
- @Override
- public int getNumberOfRows() { return 5; }
-
- @Override
- public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
- return joinKeys(SHIFT_KEY);
- }
-
- @Override
- public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return joinKeys(SHIFT_KEY);
- }
-
- @Override
- public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
- return joinKeys(SETTINGS_KEY);
- }
-
- @Override
- public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
- return isPhone
- ? joinKeys(key(ENTER_KEY, EMOJI_ACTION_KEY))
- : joinKeys(EMOJI_NORMAL_KEY);
- }
- }
-
@Override
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) {
final LayoutCustomizer customizer = getCustomizer();
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Qwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/Qwerty.java
index d790a1e53..508df0c17 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Qwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Qwerty.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Qwertz.java b/tests/src/com/android/inputmethod/keyboard/layout/Qwertz.java
index 26ba6cffb..cc41fbf20 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Qwertz.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Qwertz.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java b/tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java
index b23fe768e..a4936288a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Sinhala.java b/tests/src/com/android/inputmethod/keyboard/layout/Sinhala.java
index 354141d5a..cdd9ea7ae 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Sinhala.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Sinhala.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -29,15 +30,15 @@ import java.util.Locale;
public final class Sinhala extends LayoutBase {
private static final String LAYOUT_NAME = "sinhala";
- public Sinhala(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Sinhala(final Locale locale) {
+ super(new SinhalaCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class SinhalaCustomizer extends LayoutCustomizer {
- public SinhalaCustomizer(final Locale locale) { super(locale); }
+ private static class SinhalaCustomizer extends LayoutCustomizer {
+ SinhalaCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return SINHALA_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/SouthSlavic.java b/tests/src/com/android/inputmethod/keyboard/layout/SouthSlavic.java
index be8b435d4..ad8278754 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/SouthSlavic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/SouthSlavic.java
@@ -16,11 +16,9 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.latin.Constants;
-
-import java.util.Locale;
public final class SouthSlavic extends LayoutBase {
private static final String LAYOUT_NAME = "south_slavic";
@@ -32,26 +30,6 @@ public final class SouthSlavic extends LayoutBase {
@Override
public String getName() { return LAYOUT_NAME; }
- public static class SouthSlavicLayoutCustomizer extends LayoutCustomizer {
- public SouthSlavicLayoutCustomizer(final Locale locale) {
- super(locale);
- }
-
- @Override
- public final ExpectedKey getAlphabetKey() { return SOUTH_SLAVIC_ALPHABET_KEY; }
-
- @Override
- public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
- }
-
- // U+0410: "А" CYRILLIC CAPITAL LETTER A
- // U+0411: "Б" CYRILLIC CAPITAL LETTER BE
- // U+0412: "В" CYRILLIC CAPITAL LETTER VE
- private static final ExpectedKey SOUTH_SLAVIC_ALPHABET_KEY = key(
- "\u0410\u0411\u0412", Constants.CODE_SWITCH_ALPHA_SYMBOL);
- }
-
@Override
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Spanish.java b/tests/src/com/android/inputmethod/keyboard/layout/Spanish.java
index 225b9f604..fc6f1ea95 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Spanish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Spanish.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Swiss.java b/tests/src/com/android/inputmethod/keyboard/layout/Swiss.java
index 01a602054..57e3725a5 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Swiss.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Swiss.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
index 803089721..7ad7b5442 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
@@ -16,7 +16,7 @@
package com.android.inputmethod.keyboard.layout;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.AbstractLayoutBase;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -41,13 +41,13 @@ public class Symbols extends AbstractLayoutBase {
customizer.getSingleQuoteMoreKeys(), customizer.getSingleAngleQuoteKeys())));
if (isPhone) {
builder.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
- .addKeysOnTheRightOfRow(3, LayoutBase.DELETE_KEY)
+ .addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, customizer.getEnterKey(isPhone));
} else {
// Tablet symbols keyboard has extra two keys at the left edge of the 3rd row.
builder.addKeysOnTheLeftOfRow(3, (Object[])joinKeys("\\", "="));
- builder.addKeysOnTheRightOfRow(1, LayoutBase.DELETE_KEY)
+ builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
.addKeysOnTheRightOfRow(2, customizer.getEnterKey(isPhone))
.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheRightOfRow(3, customizer.getSymbolsShiftKey(isPhone))
@@ -167,7 +167,7 @@ public class Symbols extends AbstractLayoutBase {
// U+00BF: "¿" INVERTED QUESTION MARK
key("?", moreKey("\u00BF")))
.setKeysOfRow(4,
- key(","), key("_"), LayoutBase.SPACE_KEY, key("/"),
+ key(","), key("_"), SPACE_KEY, key("/"),
// U+2026: "…" HORIZONTAL ELLIPSIS
key(".", moreKey("\u2026")))
.build();
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java b/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
index 19cb6075a..64262167d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
@@ -16,7 +16,7 @@
package com.android.inputmethod.keyboard.layout;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.keyboard.layout.expected.AbstractLayoutBase;
@@ -37,7 +37,7 @@ public class SymbolsShifted extends AbstractLayoutBase {
builder.replaceKeyOfLabel(OTHER_CURRENCIES, (Object[])customizer.getOtherCurrencyKeys());
if (isPhone) {
builder.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
- .addKeysOnTheRightOfRow(3, LayoutBase.DELETE_KEY)
+ .addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, customizer.getEnterKey(isPhone));
} else {
@@ -45,7 +45,7 @@ public class SymbolsShifted extends AbstractLayoutBase {
// U+00BF: "¿" INVERTED QUESTION MARK
// U+00A1: "¡" INVERTED EXCLAMATION MARK
builder.addKeysOnTheRightOfRow(3, (Object[])joinKeys("\u00A1", "\u00BF"));
- builder.addKeysOnTheRightOfRow(1, LayoutBase.DELETE_KEY)
+ builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
.addKeysOnTheRightOfRow(2, customizer.getEnterKey(isPhone))
.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, customizer.getBackToSymbolsKey())
@@ -122,7 +122,7 @@ public class SymbolsShifted extends AbstractLayoutBase {
// U+2264: "≤" LESS-THAN OR EQUAL TO
// U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
key("<", joinMoreKeys("\u2039", "\u2264", "\u00AB")),
- LayoutBase.SPACE_KEY,
+ SPACE_KEY,
// U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
// U+2265: "≥" GREATER-THAN EQUAL TO
// U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Tamil.java b/tests/src/com/android/inputmethod/keyboard/layout/Tamil.java
index 597b6fa55..1413e366a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Tamil.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Tamil.java
@@ -16,11 +16,9 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.latin.Constants;
-
-import java.util.Locale;
/**
* The Tamil keyboard.
@@ -35,29 +33,6 @@ public final class Tamil extends LayoutBase {
@Override
public String getName() { return LAYOUT_NAME; }
- public static class TamilCustomizer extends LayoutCustomizer {
- public TamilCustomizer(final Locale locale) { super(locale); }
-
- @Override
- public ExpectedKey getAlphabetKey() { return TAMIL_ALPHABET_KEY; }
-
- @Override
- public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
- return EMPTY_KEYS;
- }
-
- @Override
- public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
- }
-
- // U+0BA4: "த" TAMIL LETTER TA
- // U+0BAE/U+0BBF: "மி" TAMIL LETTER MA/TAMIL VOWEL SIGN I
- // U+0BB4/U+0BCD: "ழ்" TAMIL LETTER LLLA/TAMIL SIGN VIRAMA
- private static final ExpectedKey TAMIL_ALPHABET_KEY = key(
- "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD", Constants.CODE_SWITCH_ALPHA_SYMBOL);
- }
-
@Override
ExpectedKey[][] getCommonAlphabetLayout(boolean isPhone) { return ALPHABET_COMMON; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Telugu.java b/tests/src/com/android/inputmethod/keyboard/layout/Telugu.java
index cc8224c54..84c5df622 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Telugu.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Telugu.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -28,15 +29,15 @@ import java.util.Locale;
public final class Telugu extends LayoutBase {
private static final String LAYOUT_NAME = "telugu";
- public Telugu(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Telugu(final Locale locale) {
+ super(new TeluguCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class TeluguCustomizer extends LayoutCustomizer {
- public TeluguCustomizer(final Locale locale) { super(locale); }
+ private static class TeluguCustomizer extends LayoutCustomizer {
+ TeluguCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return TELUGU_ALPHABET_KEY; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Thai.java b/tests/src/com/android/inputmethod/keyboard/layout/Thai.java
index cfda2947c..1463336c4 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Thai.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Thai.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.latin.Constants;
@@ -29,15 +30,15 @@ import java.util.Locale;
public final class Thai extends LayoutBase {
private static final String LAYOUT_NAME = "thai";
- public Thai(final LayoutCustomizer customizer) {
- super(customizer, Symbols.class, SymbolsShifted.class);
+ public Thai(final Locale locale) {
+ super(new ThaiCustomizer(locale), Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
- public static class ThaiCustomizer extends LayoutCustomizer {
- public ThaiCustomizer(final Locale locale) { super(locale); }
+ private static class ThaiCustomizer extends LayoutCustomizer {
+ ThaiCustomizer(final Locale locale) { super(locale); }
@Override
public int getNumberOfRows() { return 5; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Uzbek.java b/tests/src/com/android/inputmethod/keyboard/layout/Uzbek.java
index df391a54a..f37fd2241 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Uzbek.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Uzbek.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard.layout;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/BengaliCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/BengaliCustomizer.java
index 7964b64ee..d255516b6 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/BengaliCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/BengaliCustomizer.java
@@ -14,10 +14,8 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.latin.Constants;
@@ -37,12 +35,12 @@ public class BengaliCustomizer extends LayoutCustomizer {
@Override
public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : LayoutBase.EXCLAMATION_AND_QUESTION_MARKS;
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
}
// U+0995: "क" BENGALI LETTER KA
// U+0996: "ख" BENGALI LETTER KHA
// U+0997: "ग" BENGALI LETTER GA
- private static final ExpectedKey BENGALI_ALPHABET_KEY = LayoutBase.key(
+ private static final ExpectedKey BENGALI_ALPHABET_KEY = key(
"\u0995\u0996\u0997", Constants.CODE_SWITCH_ALPHA_SYMBOL);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/DanishCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DanishCustomizer.java
index 2c5df6045..3d91194f2 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/DanishCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DanishCustomizer.java
@@ -14,17 +14,16 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class DanishCustomizer extends EuroCustomizer {
+public class DanishCustomizer extends EuroCustomizer {
public DanishCustomizer(final Locale locale) { super(locale); }
@Override
@@ -110,4 +109,4 @@ class DanishCustomizer extends EuroCustomizer {
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
.setMoreKeysOf("n", "\u00F1", "\u0144");
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/DevanagariCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DevanagariCustomizer.java
index a31591d32..d4e5e5885 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/DevanagariCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DevanagariCustomizer.java
@@ -14,12 +14,8 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.Hindi;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
-import com.android.inputmethod.keyboard.layout.Symbols;
-import com.android.inputmethod.keyboard.layout.SymbolsShifted;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.latin.Constants;
@@ -37,34 +33,17 @@ public class DevanagariCustomizer extends LayoutCustomizer {
@Override
public ExpectedKey getBackToSymbolsKey() { return HINDI_BACK_TO_SYMBOLS_KEY; }
- @Override
- public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
-
- @Override
- public ExpectedKey[] getOtherCurrencyKeys() {
- return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
- }
-
- @Override
- public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : Hindi.EXCLAMATION_AND_QUESTION_MARKS;
- }
-
// U+0915: "क" DEVANAGARI LETTER KA
// U+0916: "ख" DEVANAGARI LETTER KHA
// U+0917: "ग" DEVANAGARI LETTER GA
- private static final ExpectedKey HINDI_ALPHABET_KEY = Hindi.key(
+ private static final ExpectedKey HINDI_ALPHABET_KEY = key(
"\u0915\u0916\u0917", Constants.CODE_SWITCH_ALPHA_SYMBOL);
// U+0967: "१" DEVANAGARI DIGIT ONE
// U+0968: "२" DEVANAGARI DIGIT TWO
// U+0969: "३" DEVANAGARI DIGIT THREE
private static final String HINDI_SYMBOLS_LABEL = "?\u0967\u0968\u0969";
- private static final ExpectedKey HINDI_SYMBOLS_KEY = Hindi.key(HINDI_SYMBOLS_LABEL,
+ private static final ExpectedKey HINDI_SYMBOLS_KEY = key(HINDI_SYMBOLS_LABEL,
Constants.CODE_SWITCH_ALPHA_SYMBOL);
- private static final ExpectedKey HINDI_BACK_TO_SYMBOLS_KEY = Hindi.key(HINDI_SYMBOLS_LABEL,
+ private static final ExpectedKey HINDI_BACK_TO_SYMBOLS_KEY = key(HINDI_SYMBOLS_LABEL,
Constants.CODE_SHIFT);
-
- // U+20B9: "₹" INDIAN RUPEE SIGN
- private static final ExpectedKey CURRENCY_RUPEE = Hindi.key("\u20B9",
- Symbols.CURRENCY_GENERIC_MORE_KEYS);
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/DutchCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DutchCustomizer.java
new file mode 100644
index 000000000..825afb64b
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DutchCustomizer.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+
+import java.util.Locale;
+
+public class DutchCustomizer extends EuroCustomizer {
+ public DutchCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
+
+ @Override
+ public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_L9R; }
+
+ @Override
+ public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
+ return builder
+ // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ // U+00E6: "æ" LATIN SMALL LETTER AE
+ // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+ // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
+ .setMoreKeysOf("a",
+ "\u00E1", "\u00E4", "\u00E2", "\u00E0", "\u00E6", "\u00E3", "\u00E5",
+ "\u0101")
+ // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+ // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+ // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ // U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
+ // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
+ // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
+ .setMoreKeysOf("e",
+ "\u00E9", "\u00EB", "\u00EA", "\u00E8", "\u0119", "\u0117", "\u0113")
+ // U+0133: "ij" LATIN SMALL LIGATURE IJ
+ .setMoreKeysOf("y", "\u0133")
+ // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
+ .setMoreKeysOf("u", "\u00FA", "\u00FC", "\u00FB", "\u00F9", "\u016B")
+ // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
+ // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+ // U+0133: "ij" LATIN SMALL LIGATURE IJ
+ .setMoreKeysOf("i",
+ "\u00ED", "\u00EF", "\u00EC", "\u00EE", "\u012F", "\u012B", "\u0133")
+ // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
+ // U+0153: "œ" LATIN SMALL LIGATURE OE
+ // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+ // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+ .setMoreKeysOf("o",
+ "\u00F3", "\u00F6", "\u00F4", "\u00F2", "\u00F5", "\u0153", "\u00F8",
+ "\u014D")
+ // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+ // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
+ .setMoreKeysOf("n", "\u00F1", "\u0144");
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/DvorakCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DvorakCustomizer.java
new file mode 100644
index 000000000..b7b018793
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/DvorakCustomizer.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey.ExpectedAdditionalMoreKey;
+
+import java.util.Locale;
+
+public class DvorakCustomizer extends LayoutCustomizer {
+ public DvorakCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
+ return isPhone ? joinKeys(SHIFT_KEY): joinKeys(SHIFT_KEY, key("q"));
+ }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : joinKeys(key("z"), SHIFT_KEY);
+ }
+
+ @Override
+ public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
+ // U+00A1: "¡" INVERTED EXCLAMATION MARK
+ return isPhone ? joinKeys(key("q", SETTINGS_KEY))
+ : joinKeys(key("!", joinMoreKeys("\u00A1", SETTINGS_KEY)));
+ }
+
+ @Override
+ public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
+ final ExpectedAdditionalMoreKey[] punctuationMoreKeys =
+ convertToAdditionalMoreKeys(getPunctuationMoreKeys(isPhone));
+ // U+00BF: "¿" INVERTED QUESTION MARK
+ return isPhone
+ ? joinKeys(key("z", punctuationMoreKeys))
+ : joinKeys(key("?", joinMoreKeys(punctuationMoreKeys, "\u00BF")));
+ }
+
+ private static ExpectedAdditionalMoreKey[] convertToAdditionalMoreKeys(
+ final ExpectedKey ... moreKeys) {
+ final ExpectedAdditionalMoreKey[] additionalMoreKeys =
+ new ExpectedAdditionalMoreKey[moreKeys.length];
+ for (int index = 0; index < moreKeys.length; index++) {
+ additionalMoreKeys[index] = ExpectedAdditionalMoreKey.newInstance(moreKeys[index]);
+ }
+ return additionalMoreKeys;
+ }
+
+ public static class EnglishDvorakCustomizer extends DvorakCustomizer {
+ private final EnglishCustomizer mEnglishCustomizer;
+
+ public EnglishDvorakCustomizer(final Locale locale) {
+ super(locale);
+ mEnglishCustomizer = new EnglishCustomizer(locale);
+ }
+
+ @Override
+ public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
+ return mEnglishCustomizer.setAccentedLetters(builder);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/EastSlavicCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EastSlavicCustomizer.java
new file mode 100644
index 000000000..03fc973f0
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EastSlavicCustomizer.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.latin.Constants;
+
+import java.util.Locale;
+
+public class EastSlavicCustomizer extends LayoutCustomizer {
+ public EastSlavicCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public final ExpectedKey getAlphabetKey() { return EAST_SLAVIC_ALPHABET_KEY; }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
+ }
+
+ // U+0410: "А" CYRILLIC CAPITAL LETTER A
+ // U+0411: "Б" CYRILLIC CAPITAL LETTER BE
+ // U+0412: "В" CYRILLIC CAPITAL LETTER VE
+ private static final ExpectedKey EAST_SLAVIC_ALPHABET_KEY = key(
+ "\u0410\u0411\u0412", Constants.CODE_SWITCH_ALPHA_SYMBOL);
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/EnglishCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EnglishCustomizer.java
index 3e82f65bf..9a9c6bb2f 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/EnglishCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EnglishCustomizer.java
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class EnglishCustomizer extends LayoutCustomizer {
- EnglishCustomizer(final Locale locale) { super(locale); }
+public class EnglishCustomizer extends LayoutCustomizer {
+ public EnglishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/EstonianEECustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EstonianEECustomizer.java
index d0b87726f..a7d611a3e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/EstonianEECustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EstonianEECustomizer.java
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
import com.android.inputmethod.keyboard.KeyboardId;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
@@ -25,10 +24,8 @@ import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class EstonianEECustomizer extends EuroCustomizer {
- public EstonianEECustomizer(final Locale locale) {
- super(locale);
- }
+public class EstonianEECustomizer extends EuroCustomizer {
+ public EstonianEECustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
@@ -167,4 +164,4 @@ class EstonianEECustomizer extends EuroCustomizer {
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
.setMoreKeysOf("n", "\u0146", "\u00F1", "\u0144");
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/EuroCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EuroCustomizer.java
new file mode 100644
index 000000000..ee0236d88
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/EuroCustomizer.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+
+import java.util.Locale;
+
+/**
+ * The layout customize class for countries that use Euro.
+ */
+public class EuroCustomizer extends LayoutCustomizer {
+ public EuroCustomizer(final Locale locale) {
+ super(locale);
+ }
+
+ @Override
+ public final ExpectedKey getCurrencyKey() { return Symbols.CURRENCY_EURO; }
+
+ @Override
+ public final ExpectedKey[] getOtherCurrencyKeys() {
+ return SymbolsShifted.CURRENCIES_OTHER_THAN_EURO;
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/FinnishCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/FinnishCustomizer.java
index 912aec4a0..a792f9143 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/FinnishCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/FinnishCustomizer.java
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
import com.android.inputmethod.keyboard.layout.Nordic;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class FinnishCustomizer extends EuroCustomizer {
+public class FinnishCustomizer extends EuroCustomizer {
public FinnishCustomizer(final Locale locale) { super(locale); }
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
@@ -80,4 +79,4 @@ class FinnishCustomizer extends EuroCustomizer {
// U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
.setMoreKeysOf("z", "\u017E", "\u017A", "\u017C");
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/FrenchCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/FrenchCustomizer.java
index ab90267d0..d7798cc56 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/FrenchCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/FrenchCustomizer.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class FrenchCustomizer extends LayoutCustomizer {
- FrenchCustomizer(final Locale locale) { super(locale); }
+public class FrenchCustomizer extends LayoutCustomizer {
+ public FrenchCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
@@ -86,4 +86,21 @@ class FrenchCustomizer extends LayoutCustomizer {
.setMoreKeysOf("c", "\u00E7", "\u0107", "\u010D")
.setAdditionalMoreKeysPositionOf("c", 2);
}
+
+ public static final class FrenchEuroCustomizer extends FrenchCustomizer {
+ private final EuroCustomizer mEuroCustomizer;
+
+ public FrenchEuroCustomizer(final Locale locale) {
+ super(locale);
+ mEuroCustomizer = new EuroCustomizer(locale);
+ }
+
+ @Override
+ public final ExpectedKey getCurrencyKey() { return mEuroCustomizer.getCurrencyKey(); }
+
+ @Override
+ public final ExpectedKey[] getOtherCurrencyKeys() {
+ return mEuroCustomizer.getOtherCurrencyKeys();
+ }
+ }
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/GermanCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/GermanCustomizer.java
index 6d38937aa..e0e4c78b1 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/GermanCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/GermanCustomizer.java
@@ -14,16 +14,15 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
import com.android.inputmethod.keyboard.layout.Symbols;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class GermanCustomizer extends LayoutCustomizer {
+public class GermanCustomizer extends LayoutCustomizer {
public GermanCustomizer(final Locale locale) { super(locale); }
@Override
@@ -86,4 +85,21 @@ class GermanCustomizer extends LayoutCustomizer {
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
.setMoreKeysOf("n", "\u00F1", "\u0144");
}
+
+ public static class GermanEuroCustomizer extends GermanCustomizer {
+ private final EuroCustomizer mEuroCustomizer;
+
+ public GermanEuroCustomizer(final Locale locale) {
+ super(locale);
+ mEuroCustomizer = new EuroCustomizer(locale);
+ }
+
+ @Override
+ public ExpectedKey getCurrencyKey() { return mEuroCustomizer.getCurrencyKey(); }
+
+ @Override
+ public ExpectedKey[] getOtherCurrencyKeys() {
+ return mEuroCustomizer.getOtherCurrencyKeys();
+ }
+ }
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/HindiCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/HindiCustomizer.java
index cb53bdc24..c7fe9dbd5 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/HindiCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/HindiCustomizer.java
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.SymbolsShifted;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -25,10 +26,23 @@ public class HindiCustomizer extends DevanagariCustomizer {
public HindiCustomizer(final Locale locale) { super(locale); }
@Override
+ public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
+
+ @Override
+ public ExpectedKey[] getOtherCurrencyKeys() {
+ return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
+ }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
+ }
+
+ @Override
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
// U+0964: "।" DEVANAGARI DANDA
- final ExpectedKey periodKey = LayoutBase.key("\u0964", getPunctuationMoreKeys(isPhone));
- return LayoutBase.joinKeys(periodKey);
+ final ExpectedKey periodKey = key("\u0964", getPunctuationMoreKeys(isPhone));
+ return joinKeys(periodKey);
}
@Override
@@ -36,12 +50,16 @@ public class HindiCustomizer extends DevanagariCustomizer {
return isPhone ? HINDI_PHONE_PUNCTUATION_MORE_KEYS : HINDI_TABLET_PUNCTUATION_MORE_KEYS;
}
+ // U+20B9: "₹" INDIAN RUPEE SIGN
+ private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9",
+ Symbols.CURRENCY_GENERIC_MORE_KEYS);
+
// Punctuation more keys for phone form factor.
- private static final ExpectedKey[] HINDI_PHONE_PUNCTUATION_MORE_KEYS = LayoutBase.joinKeys(
+ private static final ExpectedKey[] HINDI_PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
",", ".", "?", "!", "#", ")", "(", "/", ";",
"'", "@", ":", "-", "\"", "+", "%", "&");
// Punctuation more keys for tablet form factor.
- private static final ExpectedKey[] HINDI_TABLET_PUNCTUATION_MORE_KEYS = LayoutBase.joinKeys(
+ private static final ExpectedKey[] HINDI_TABLET_PUNCTUATION_MORE_KEYS = joinKeys(
",", ".", "'", "#", ")", "(", "/", ";",
"@", ":", "-", "\"", "+", "%", "&");
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/ItalianCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/ItalianCustomizer.java
index 735070946..3b547fdc4 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/ItalianCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/ItalianCustomizer.java
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class ItalianCustomizer extends LayoutCustomizer {
+public class ItalianCustomizer extends LayoutCustomizer {
public ItalianCustomizer(final Locale locale) { super(locale); }
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/LayoutCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/LayoutCustomizer.java
new file mode 100644
index 000000000..27f55342e
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/LayoutCustomizer.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.expected.AbstractLayoutBase;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+
+import java.util.Locale;
+
+/**
+ * This class is used to customize common keyboard layout to language specific layout.
+ */
+public class LayoutCustomizer extends AbstractLayoutBase {
+ private final Locale mLocale;
+
+ // Empty keys definition to remove keys by adding this.
+ protected static final ExpectedKey[] EMPTY_KEYS = joinKeys();
+
+ public LayoutCustomizer(final Locale locale) { mLocale = locale; }
+
+ public final Locale getLocale() { return mLocale; }
+
+ public int getNumberOfRows() { return 4; }
+
+ /**
+ * Set accented letters to a specific keyboard element.
+ * @param builder the {@link ExpectedKeyboardBuilder} object that contains common keyboard
+ * layout.
+ * @param elementId the element id of keyboard
+ * @return the {@link ExpectedKeyboardBuilder} object that contains accented letters as
+ * "more keys".
+ */
+ public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder,
+ final int elementId) {
+ // This method can be overridden by an extended class to provide customized expected
+ // accented letters depending on the shift state of keyboard.
+ // This is a default behavior to call a shift-state-independent
+ // {@link #setAccentedLetters(ExpectedKeyboardBuilder)} implementation, so that
+ // <code>elementId</code> is ignored here.
+ return setAccentedLetters(builder);
+ }
+
+ /**
+ * Set accented letters to common layout.
+ * @param builder the {@link ExpectedKeyboardBuilder} object that contains common keyboard
+ * layout.
+ * @return the {@link ExpectedKeyboardBuilder} object that contains accented letters as
+ * "more keys".
+ */
+ public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
+ return builder;
+ }
+
+ /**
+ * Get the function key to switch to alphabet layout.
+ * @return the {@link ExpectedKey} of the alphabet key.
+ */
+ public ExpectedKey getAlphabetKey() { return ALPHABET_KEY; }
+
+ /**
+ * Get the function key to switch to symbols layout.
+ * @return the {@link ExpectedKey} of the symbols key.
+ */
+ public ExpectedKey getSymbolsKey() { return SYMBOLS_KEY; }
+
+ /**
+ * Get the function key to switch to symbols shift layout.
+ * @param isPhone true if requesting phone's key.
+ * @return the {@link ExpectedKey} of the symbols shift key.
+ */
+ public ExpectedKey getSymbolsShiftKey(boolean isPhone) {
+ return isPhone ? SYMBOLS_SHIFT_KEY : TABLET_SYMBOLS_SHIFT_KEY;
+ }
+
+ /**
+ * Get the function key to switch from symbols shift to symbols layout.
+ * @return the {@link ExpectedKey} of the back to symbols key.
+ */
+ public ExpectedKey getBackToSymbolsKey() { return BACK_TO_SYMBOLS_KEY; }
+
+ /**
+ * Get the currency key.
+ * @return the {@link ExpectedKey} of the currency key.
+ */
+ public ExpectedKey getCurrencyKey() { return Symbols.CURRENCY_DOLLAR; }
+
+ /**
+ * Get other currencies keys.
+ * @return the array of {@link ExpectedKey} that represents other currency keys.
+ */
+ public ExpectedKey[] getOtherCurrencyKeys() {
+ return SymbolsShifted.CURRENCIES_OTHER_THAN_DOLLAR;
+ }
+
+ /**
+ * Get "more keys" of double quotation mark.
+ * @return the array of {@link ExpectedKey} of more double quotation marks in natural order.
+ */
+ public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_9LR; }
+
+ /**
+ * Get "more keys" of single quotation mark.
+ * @return the array of {@link ExpectedKey} of more single quotation marks in natural order.
+ */
+ public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_9LR; }
+
+ /**
+ * Get double angle quotation marks in natural order.
+ * @return the array of {@link ExpectedKey} of double angle quotation marks in natural
+ * order.
+ */
+ public ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_LR; }
+
+ /**
+ * Get single angle quotation marks in natural order.
+ * @return the array of {@link ExpectedKey} of single angle quotation marks in natural
+ * order.
+ */
+ public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_LR; }
+
+ /**
+ * Get the left shift keys.
+ * @param isPhone true if requesting phone's keys.
+ * @return the array of {@link ExpectedKey} that should be placed at left edge of the
+ * keyboard.
+ */
+ public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
+ return joinKeys(SHIFT_KEY);
+ }
+
+ /**
+ * Get the right shift keys.
+ * @param isPhone true if requesting phone's keys.
+ * @return the array of {@link ExpectedKey} that should be placed at right edge of the
+ * keyboard.
+ */
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : joinKeys(EXCLAMATION_AND_QUESTION_MARKS, SHIFT_KEY);
+ }
+
+ /**
+ * Get the enter key.
+ * @param isPhone true if requesting phone's key.
+ * @return the array of {@link ExpectedKey} that should be placed as an enter key.
+ */
+ public ExpectedKey getEnterKey(final boolean isPhone) {
+ return isPhone ? key(ENTER_KEY, EMOJI_ACTION_KEY) : ENTER_KEY;
+ }
+
+ /**
+ * Get the emoji key.
+ * @param isPhone true if requesting phone's key.
+ * @return the array of {@link ExpectedKey} that should be placed as an emoji key.
+ */
+ public ExpectedKey getEmojiKey(final boolean isPhone) {
+ return EMOJI_NORMAL_KEY;
+ }
+
+ /**
+ * Get the space keys.
+ * @param isPhone true if requesting phone's keys.
+ * @return the array of {@link ExpectedKey} that should be placed at the center of the
+ * keyboard.
+ */
+ public ExpectedKey[] getSpaceKeys(final boolean isPhone) {
+ return joinKeys(LANGUAGE_SWITCH_KEY, SPACE_KEY);
+ }
+
+ /**
+ * Get the keys left to the spacebar.
+ * @param isPhone true if requesting phone's keys.
+ * @return the array of {@link ExpectedKey} that should be placed at left of the spacebar.
+ */
+ public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
+ // U+002C: "," COMMA
+ return joinKeys(key("\u002C", SETTINGS_KEY));
+ }
+
+ /**
+ * Get the keys right to the spacebar.
+ * @param isPhone true if requesting phone's keys.
+ * @return the array of {@link ExpectedKey} that should be placed at right of the spacebar.
+ */
+ public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
+ final ExpectedKey periodKey = key(".", getPunctuationMoreKeys(isPhone));
+ return joinKeys(periodKey);
+ }
+
+ /**
+ * Get "more keys" for the punctuation key (usually the period key).
+ * @param isPhone true if requesting phone's keys.
+ * @return the array of {@link ExpectedKey} that are "more keys" of the punctuation key.
+ */
+ public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) {
+ return isPhone ? PHONE_PUNCTUATION_MORE_KEYS : TABLET_PUNCTUATION_MORE_KEYS;
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/NepaliCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/NepaliCustomizer.java
new file mode 100644
index 000000000..7a00d80a0
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/NepaliCustomizer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+
+import java.util.Locale;
+
+public class NepaliCustomizer extends DevanagariCustomizer {
+ public NepaliCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey getCurrencyKey() { return CURRENCY_NEPALI; }
+
+ @Override
+ public ExpectedKey[] getOtherCurrencyKeys() {
+ return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
+ }
+
+ @Override
+ public ExpectedKey[] getSpaceKeys(final boolean isPhone) {
+ return joinKeys(LANGUAGE_SWITCH_KEY, SPACE_KEY, key(ZWNJ_KEY, ZWJ_KEY));
+ }
+
+ // U+0930/U+0941/U+002E "रु." NEPALESE RUPEE SIGN
+ private static final ExpectedKey CURRENCY_NEPALI = key("\u0930\u0941\u002E",
+ Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN,
+ Symbols.YEN_SIGN, Symbols.PESO_SIGN);
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/NoLanguageCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/NoLanguageCustomizer.java
index 9edbcab69..b6bf5bfeb 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/NoLanguageCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/NoLanguageCustomizer.java
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class NoLanguageCustomizer extends LayoutCustomizer {
- NoLanguageCustomizer(final Locale locale) { super(locale); }
+public class NoLanguageCustomizer extends LayoutCustomizer {
+ public NoLanguageCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/NorwegianCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/NorwegianCustomizer.java
index 4be7a57c5..6cc44e578 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/NorwegianCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/NorwegianCustomizer.java
@@ -14,17 +14,16 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class NorwegianCustomizer extends LayoutCustomizer {
+public class NorwegianCustomizer extends LayoutCustomizer {
public NorwegianCustomizer(final Locale locale) { super(locale); }
@Override
@@ -93,4 +92,4 @@ class NorwegianCustomizer extends LayoutCustomizer {
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FC", "\u00FB", "\u00F9", "\u00FA", "\u016B");
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/PcQwertyCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/PcQwertyCustomizer.java
new file mode 100644
index 000000000..9a0f764ae
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/PcQwertyCustomizer.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+
+import java.util.Locale;
+
+public class PcQwertyCustomizer extends LayoutCustomizer {
+ public PcQwertyCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public int getNumberOfRows() { return 5; }
+
+ @Override
+ public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
+ return joinKeys(SHIFT_KEY);
+ }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return joinKeys(SHIFT_KEY);
+ }
+
+ @Override
+ public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
+ return joinKeys(SETTINGS_KEY);
+ }
+
+ @Override
+ public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
+ return isPhone
+ ? joinKeys(key(ENTER_KEY, EMOJI_ACTION_KEY))
+ : joinKeys(EMOJI_NORMAL_KEY);
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/PortugueseCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/PortugueseCustomizer.java
index 629e8cb8b..4fc64cc62 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/PortugueseCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/PortugueseCustomizer.java
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class PortugueseCustomizer extends LayoutCustomizer {
- PortugueseCustomizer(final Locale locale) { super(locale); }
+public class PortugueseCustomizer extends LayoutCustomizer {
+ public PortugueseCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/SerbianLatinCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SerbianLatinCustomizer.java
index 3660ce4b7..4d03c8ba6 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/SerbianLatinCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SerbianLatinCustomizer.java
@@ -14,22 +14,20 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.SerbianQwertz;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class SerbianLatinCustomizer extends LayoutCustomizer {
+public class SerbianLatinCustomizer extends LayoutCustomizer {
public SerbianLatinCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : LayoutBase.EXCLAMATION_AND_QUESTION_MARKS;
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
}
protected void setSerbianKeys(final ExpectedKeyboardBuilder builder) {
@@ -79,4 +77,4 @@ class SerbianLatinCustomizer extends LayoutCustomizer {
// U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
.setMoreKeysOf("i", "\u00EC");
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/SouthSlavicLayoutCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SouthSlavicLayoutCustomizer.java
new file mode 100644
index 000000000..cc41d37ca
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SouthSlavicLayoutCustomizer.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.latin.Constants;
+
+import java.util.Locale;
+
+public class SouthSlavicLayoutCustomizer extends LayoutCustomizer {
+ public SouthSlavicLayoutCustomizer(final Locale locale) {
+ super(locale);
+ }
+
+ @Override
+ public final ExpectedKey getAlphabetKey() { return SOUTH_SLAVIC_ALPHABET_KEY; }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
+ }
+
+ // U+0410: "А" CYRILLIC CAPITAL LETTER A
+ // U+0411: "Б" CYRILLIC CAPITAL LETTER BE
+ // U+0412: "В" CYRILLIC CAPITAL LETTER VE
+ private static final ExpectedKey SOUTH_SLAVIC_ALPHABET_KEY = key(
+ "\u0410\u0411\u0412", Constants.CODE_SWITCH_ALPHA_SYMBOL);
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/SpanishCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SpanishCustomizer.java
index 8974ad6ec..1284f054e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/SpanishCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SpanishCustomizer.java
@@ -14,28 +14,24 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Spanish;
-import com.android.inputmethod.keyboard.layout.expected.AbstractLayoutBase;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class SpanishCustomizer extends LayoutCustomizer {
- SpanishCustomizer(final Locale locale) { super(locale); }
+public class SpanishCustomizer extends LayoutCustomizer {
+ public SpanishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) {
- return isPhone ? PHONE_PUNCTUATION_MORE_KEYS
- : LayoutBase.TABLET_PUNCTUATION_MORE_KEYS;
+ return isPhone ? SPANISH_PHONE_PUNCTUATION_MORE_KEYS : TABLET_PUNCTUATION_MORE_KEYS;
}
// Punctuation more keys for phone form factor.
- private static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = AbstractLayoutBase.joinKeys(
+ private static final ExpectedKey[] SPANISH_PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
// U+00A1: "¡" INVERTED EXCLAMATION MARK
// U+00BF: "¿" INVERTED QUESTION MARK
",", "?", "!", "#", ")", "(", "/", ";", "\u00A1",
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/SwedishCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SwedishCustomizer.java
index af4a971bd..f4ff59458 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/SwedishCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/SwedishCustomizer.java
@@ -14,10 +14,8 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
@@ -25,7 +23,7 @@ import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class SwedishCustomizer extends LayoutCustomizer {
+public class SwedishCustomizer extends LayoutCustomizer {
private final LayoutCustomizer mEuroCustomizer;
public SwedishCustomizer(final Locale locale) {
@@ -142,4 +140,4 @@ class SwedishCustomizer extends LayoutCustomizer {
// U+0148: "ň" LATIN SMALL LETTER N WITH CARON
.setMoreKeysOf("n", "\u0144", "\u00F1", "\u0148");
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/customizer/TamilCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/TamilCustomizer.java
new file mode 100644
index 000000000..91fd21ef5
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/TamilCustomizer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.layout.customizer;
+
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.latin.Constants;
+
+import java.util.Locale;
+
+public class TamilCustomizer extends LayoutCustomizer {
+ public TamilCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey getAlphabetKey() { return TAMIL_ALPHABET_KEY; }
+
+ @Override
+ public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
+ return EMPTY_KEYS;
+ }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
+ }
+
+ // U+0BA4: "த" TAMIL LETTER TA
+ // U+0BAE/U+0BBF: "மி" TAMIL LETTER MA/TAMIL VOWEL SIGN I
+ // U+0BB4/U+0BCD: "ழ்" TAMIL LETTER LLLA/TAMIL SIGN VIRAMA
+ private static final ExpectedKey TAMIL_ALPHABET_KEY = key(
+ "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD", Constants.CODE_SWITCH_ALPHA_SYMBOL);
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TurkicCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/TurkicCustomizer.java
index 1a98f6ccf..3fd3aa219 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TurkicCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/TurkicCustomizer.java
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -24,7 +23,7 @@ import java.util.Locale;
/**
* Turkic languages layout customizer.
*/
-class TurkicCustomizer extends LayoutCustomizer {
+public class TurkicCustomizer extends LayoutCustomizer {
public TurkicCustomizer(final Locale locale) { super(locale); }
@Override
@@ -82,4 +81,4 @@ class TurkicCustomizer extends LayoutCustomizer {
// U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
.setMoreKeysOf("n", "\u0148", "\u00F1");
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/UzbekCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/customizer/UzbekCustomizer.java
index 6da0b0e45..99486163e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/UzbekCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/customizer/UzbekCustomizer.java
@@ -14,17 +14,15 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard.layout.tests;
+package com.android.inputmethod.keyboard.layout.customizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
-class UzbekCustomizer extends TurkicCustomizer {
- public UzbekCustomizer(final Locale locale) {
- super(locale);
- }
+public class UzbekCustomizer extends TurkicCustomizer {
+ public UzbekCustomizer(final Locale locale) { super(locale); }
protected void setUzbekKeys(final ExpectedKeyboardBuilder builder) {
builder
@@ -41,4 +39,4 @@ class UzbekCustomizer extends TurkicCustomizer {
setUzbekKeys(builder);
return super.setAccentedLetters(builder);
}
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
index 3556cb4bf..b15ef5d26 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
@@ -16,7 +16,9 @@
package com.android.inputmethod.keyboard.layout.expected;
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey.ExpectedAdditionalMoreKey;
+import com.android.inputmethod.latin.Constants;
/**
* Base class to create an expected keyboard for unit test.
@@ -102,4 +104,75 @@ public abstract class AbstractLayoutBase {
public static ExpectedKey[] joinKeys(final Object ... keys) {
return ExpectedKeyboardBuilder.joinKeys(keys);
}
+
+ // Icon ids.
+ private static final int ICON_DELETE = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_DELETE_KEY);
+ private static final int ICON_SPACE = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SPACE_KEY);
+ private static final int ICON_TAB = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_TAB_KEY);
+ private static final int ICON_SHORTCUT = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SHORTCUT_KEY);
+ private static final int ICON_SETTINGS = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SETTINGS_KEY);
+ private static final int ICON_LANGUAGE_SWITCH = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_LANGUAGE_SWITCH_KEY);
+ private static final int ICON_ENTER = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_ENTER_KEY);
+ private static final int ICON_EMOJI_ACTION = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_EMOJI_ACTION_KEY);
+ private static final int ICON_EMOJI_NORMAL = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_EMOJI_NORMAL_KEY);
+ private static final int ICON_SHIFT = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SHIFT_KEY);
+ private static final int ICON_SHIFTED_SHIFT = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SHIFT_KEY_SHIFTED);
+ private static final int ICON_ZWNJ = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_ZWNJ_KEY);
+ private static final int ICON_ZWJ = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_ZWJ_KEY);
+
+ // Functional keys.
+ protected static final ExpectedKey DELETE_KEY = key(ICON_DELETE, Constants.CODE_DELETE);
+ protected static final ExpectedKey TAB_KEY = key(ICON_TAB, Constants.CODE_TAB);
+ protected static final ExpectedKey SHORTCUT_KEY = key(ICON_SHORTCUT, Constants.CODE_SHORTCUT);
+ protected static final ExpectedKey SETTINGS_KEY = key(ICON_SETTINGS, Constants.CODE_SETTINGS);
+ protected static final ExpectedKey LANGUAGE_SWITCH_KEY = key(
+ ICON_LANGUAGE_SWITCH, Constants.CODE_LANGUAGE_SWITCH);
+ protected static final ExpectedKey ENTER_KEY = key(ICON_ENTER, Constants.CODE_ENTER);
+ protected static final ExpectedKey EMOJI_ACTION_KEY = key(ICON_EMOJI_ACTION, Constants.CODE_EMOJI);
+ protected static final ExpectedKey EMOJI_NORMAL_KEY = key(ICON_EMOJI_NORMAL, Constants.CODE_EMOJI);
+ protected static final ExpectedKey SPACE_KEY = key(ICON_SPACE, Constants.CODE_SPACE);
+ protected static final ExpectedKey CAPSLOCK_MORE_KEY = key(" ", Constants.CODE_CAPSLOCK);
+ protected static final ExpectedKey SHIFT_KEY = key(ICON_SHIFT,
+ Constants.CODE_SHIFT, CAPSLOCK_MORE_KEY);
+ protected static final ExpectedKey SHIFTED_SHIFT_KEY = key(ICON_SHIFTED_SHIFT,
+ Constants.CODE_SHIFT, CAPSLOCK_MORE_KEY);
+ protected static final ExpectedKey ALPHABET_KEY = key("ABC", Constants.CODE_SWITCH_ALPHA_SYMBOL);
+ protected static final ExpectedKey SYMBOLS_KEY = key("?123", Constants.CODE_SWITCH_ALPHA_SYMBOL);
+ protected static final ExpectedKey BACK_TO_SYMBOLS_KEY = key("?123", Constants.CODE_SHIFT);
+ protected static final ExpectedKey SYMBOLS_SHIFT_KEY = key("= \\ <", Constants.CODE_SHIFT);
+ protected static final ExpectedKey TABLET_SYMBOLS_SHIFT_KEY = key("~ [ <", Constants.CODE_SHIFT);
+
+ // U+00A1: "¡" INVERTED EXCLAMATION MARK
+ // U+00BF: "¿" INVERTED QUESTION MARK
+ protected static final ExpectedKey[] EXCLAMATION_AND_QUESTION_MARKS = joinKeys(
+ key("!", moreKey("\u00A1")), key("?", moreKey("\u00BF")));
+ // U+200C: ZERO WIDTH NON-JOINER
+ // U+200D: ZERO WIDTH JOINER
+ protected static final ExpectedKey ZWNJ_KEY = key(ICON_ZWNJ, "\u200C");
+ protected static final ExpectedKey ZWJ_KEY = key(ICON_ZWJ, "\u200D");
+ // Domain key
+ protected static final ExpectedKey DOMAIN_KEY =
+ key(".com", joinMoreKeys(".net", ".org", ".gov", ".edu")).preserveCase();
+
+ // Punctuation more keys for phone form factor.
+ protected static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
+ ",", "?", "!", "#", ")", "(", "/", ";",
+ "'", "@", ":", "-", "\"", "+", "%", "&");
+ // Punctuation more keys for tablet form factor.
+ protected static final ExpectedKey[] TABLET_PUNCTUATION_MORE_KEYS = joinKeys(
+ ",", "'", "#", ")", "(", "/", ";",
+ "@", ":", "-", "\"", "+", "%", "&");
}
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/KeyboardLayoutSetSubtypesCountTests.java
index dc9531517..6f747b377 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/KeyboardLayoutSetSubtypesCountTests.java
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard;
+package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.inputmethod.keyboard.KeyboardLayoutSetTestsBase;
+import com.android.inputmethod.keyboard.KeyboardTheme;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
import java.util.ArrayList;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAfrikaans.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAfrikaans.java
index cd2259888..f534cd6fc 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAfrikaans.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAfrikaans.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java
index fd7670827..a9be163d1 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Arabic;
-import com.android.inputmethod.keyboard.layout.Arabic.ArabicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public class TestsArabic extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ar");
- private static final LayoutBase LAYOUT = new Arabic(new ArabicCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Arabic(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArmenianAMPhonetic.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArmenianAMPhonetic.java
index 327e9438f..8ef97d21e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArmenianAMPhonetic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArmenianAMPhonetic.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.ArmenianPhonetic;
-import com.android.inputmethod.keyboard.layout.ArmenianPhonetic.ArmenianPhoneticCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,8 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsArmenianAMPhonetic extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("hy", "AM");
- private static final LayoutBase LAYOUT = new ArmenianPhonetic(
- new ArmenianPhoneticCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new ArmenianPhonetic(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAzerbaijaniAZ.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAzerbaijaniAZ.java
index 8e0e2bbbd..a10023c69 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAzerbaijaniAZ.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsAzerbaijaniAZ.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.TurkicCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBasqueES.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBasqueES.java
index bef18c5d5..103fac168 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBasqueES.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBasqueES.java
@@ -19,8 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.SpanishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -39,7 +40,7 @@ public class TestsBasqueES extends LayoutTestsBase {
private static class BasqueESCustomizer extends EuroCustomizer {
private final SpanishCustomizer mSpanishCustomizer;
- public BasqueESCustomizer(final Locale locale) {
+ BasqueESCustomizer(final Locale locale) {
super(locale);
mSpanishCustomizer = new SpanishCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBelarusianBY.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBelarusianBY.java
index c5238d54f..0b2393363 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBelarusianBY.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBelarusianBY.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.EastSlavic;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsBelarusianBY extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class BelarusianBYCustomizer extends EastSlavicCustomizer {
- public BelarusianBYCustomizer(final Locale locale) { super(locale); }
+ BelarusianBYCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliBD.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliBD.java
index 0334d5d23..62625890e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliBD.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliBD.java
@@ -21,6 +21,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.BengaliAkkhor;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.BengaliCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -37,11 +38,11 @@ public final class TestsBengaliBD extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class BengaliBDCustomzier extends BengaliCustomizer {
- public BengaliBDCustomzier(final Locale locale) { super(locale); }
+ BengaliBDCustomzier(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
- return isPhone ? EMPTY_KEYS : LayoutBase.EXCLAMATION_AND_QUESTION_MARKS;
+ return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliIN.java
index 91a976c7c..022b0850d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliIN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBengaliIN.java
@@ -21,6 +21,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Bengali;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.BengaliCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -37,7 +38,7 @@ public final class TestsBengaliIN extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class BengaliINCustomzier extends BengaliCustomizer {
- public BengaliINCustomzier(final Locale locale) { super(locale); }
+ BengaliINCustomzier(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) { return EMPTY_KEYS; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java
index ded8d7243..15308271c 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Bulgarian;
-import com.android.inputmethod.keyboard.layout.Bulgarian.BulgarianCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsBulgarian extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("bg");
- private static final LayoutBase LAYOUT = new Bulgarian(new BulgarianCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Bulgarian(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java
index 22b2011ee..558b1d44a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.BulgarianBds;
-import com.android.inputmethod.keyboard.layout.BulgarianBds.BulgarianBdsCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsBulgarianBds extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("bg");
- private static final LayoutBase LAYOUT = new BulgarianBds(new BulgarianBdsCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new BulgarianBds(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCatalan.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCatalan.java
index 151a0a627..a323ffda4 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCatalan.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCatalan.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -38,20 +38,20 @@ public class TestsCatalan extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class CatalanCustomizer extends EuroCustomizer {
- public CatalanCustomizer(final Locale locale) { super(locale); }
+ CatalanCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) {
- return isPhone ? PHONE_PUNCTUATION_MORE_KEYS
- : TABLET_PUNCTUATION_MORE_KEYS;
+ return isPhone ? CATALAN_PHONE_PUNCTUATION_MORE_KEYS
+ : CATALAN_TABLET_PUNCTUATION_MORE_KEYS;
}
// U+00B7: "·" MIDDLE DOT
- private static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
+ private static final ExpectedKey[] CATALAN_PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
",", "?", "!", "\u00B7", "#", ")", "(", "/", ";",
"'", "@", ":", "-", "\"", "+", "%", "&");
- private static final ExpectedKey[] TABLET_PUNCTUATION_MORE_KEYS = joinKeys(
+ private static final ExpectedKey[] CATALAN_TABLET_PUNCTUATION_MORE_KEYS = joinKeys(
",", "'", "\u00B7", "#", ")", "(", "/", ";",
"@", ":", "-", "\"", "+", "%", "&");
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCroatian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCroatian.java
index 8575ef219..d8af75bca 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCroatian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCroatian.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwertz;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsCroatian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class CroatianCustomizer extends LayoutCustomizer {
- public CroatianCustomizer(final Locale locale) { super(locale); }
+ CroatianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCzech.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCzech.java
index f4794707f..f05b8ebf2 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCzech.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsCzech.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwertz;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsCzech extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class CzechCustomizer extends LayoutCustomizer {
- public CzechCustomizer(final Locale locale) { super(locale); }
+ CzechCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanish.java
index bf43e5296..fb7338d1b 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanish.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Nordic;
+import com.android.inputmethod.keyboard.layout.customizer.DanishCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanishQwertz.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanishQwertz.java
index 886b3de7e..718bf8aec 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanishQwertz.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDanishQwertz.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwertz;
+import com.android.inputmethod.keyboard.layout.customizer.DanishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,9 +37,7 @@ public final class TestsDanishQwertz extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class DanishQwertyCustomizer extends DanishCustomizer {
- public DanishQwertyCustomizer(final Locale locale) {
- super(locale);
- }
+ DanishQwertyCustomizer(final Locale locale) { super(locale); }
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutch.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutch.java
index 1730f66be..12bd1b176 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutch.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutch.java
@@ -19,11 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
-import com.android.inputmethod.keyboard.layout.Symbols;
-import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
-import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+import com.android.inputmethod.keyboard.layout.customizer.DutchCustomizer;
import java.util.Locale;
@@ -37,70 +34,4 @@ public final class TestsDutch extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
-
- static class DutchCustomizer extends EuroCustomizer {
- public DutchCustomizer(final Locale locale) { super(locale); }
-
- @Override
- public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
-
- @Override
- public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_L9R; }
-
- @Override
- public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
- return builder
- // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
- // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
- // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
- // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
- // U+00E6: "æ" LATIN SMALL LETTER AE
- // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
- // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
- // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
- .setMoreKeysOf("a",
- "\u00E1", "\u00E4", "\u00E2", "\u00E0", "\u00E6", "\u00E3", "\u00E5",
- "\u0101")
- // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
- // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
- // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
- // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
- // U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
- // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
- // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
- .setMoreKeysOf("e",
- "\u00E9", "\u00EB", "\u00EA", "\u00E8", "\u0119", "\u0117", "\u0113")
- // U+0133: "ij" LATIN SMALL LIGATURE IJ
- .setMoreKeysOf("y", "\u0133")
- // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
- // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
- // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
- // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
- // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
- .setMoreKeysOf("u", "\u00FA", "\u00FC", "\u00FB", "\u00F9", "\u016B")
- // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
- // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
- // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
- // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
- // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
- // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
- // U+0133: "ij" LATIN SMALL LIGATURE IJ
- .setMoreKeysOf("i",
- "\u00ED", "\u00EF", "\u00EC", "\u00EE", "\u012F", "\u012B", "\u0133")
- // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
- // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
- // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
- // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
- // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
- // U+0153: "œ" LATIN SMALL LIGATURE OE
- // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
- // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
- .setMoreKeysOf("o",
- "\u00F3", "\u00F6", "\u00F4", "\u00F2", "\u00F5", "\u0153", "\u00F8",
- "\u014D")
- // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
- // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
- .setMoreKeysOf("n", "\u00F1", "\u0144");
- }
- }
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutchBE.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutchBE.java
index 31adf7a8d..146411858 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutchBE.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDutchBE.java
@@ -20,7 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Azerty;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.tests.TestsDutch.DutchCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.DutchCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java
index b25b84674..3966ebc06 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java
@@ -25,8 +25,9 @@ import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.KeyboardLayoutSet;
import com.android.inputmethod.keyboard.layout.Dvorak;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.DvorakCustomizer.EnglishDvorakCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
-import com.android.inputmethod.keyboard.layout.tests.TestsEnglishDvorak.EnglishDvorakCustomizer;
import java.util.Locale;
@@ -60,23 +61,23 @@ public class TestsDvorakEmail extends LayoutTestsBase {
@Override
public ExpectedKey getEnterKey(final boolean isPhone) {
- return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ return isPhone ? ENTER_KEY : super.getEnterKey(isPhone);
}
@Override
public ExpectedKey getEmojiKey(final boolean isPhone) {
- return LayoutBase.DOMAIN_KEY;
+ return DOMAIN_KEY;
}
@Override
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
return isPhone ? super.getKeysLeftToSpacebar(isPhone)
- : joinKeys(key("@", LayoutBase.SETTINGS_KEY));
+ : joinKeys(key("@", SETTINGS_KEY));
}
}
private static class DvorakEmail extends Dvorak {
- public DvorakEmail(final LayoutCustomizer customizer) {
+ DvorakEmail(final LayoutCustomizer customizer) {
super(customizer);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java
index ba22f375d..67e0d91af 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java
@@ -25,8 +25,9 @@ import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.KeyboardLayoutSet;
import com.android.inputmethod.keyboard.layout.Dvorak;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.DvorakCustomizer.EnglishDvorakCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
-import com.android.inputmethod.keyboard.layout.tests.TestsEnglishDvorak.EnglishDvorakCustomizer;
import java.util.Locale;
@@ -54,31 +55,27 @@ public class TestsDvorakUrl extends LayoutTestsBase {
}
private static class DvorakUrlCustomizer extends EnglishDvorakCustomizer {
- DvorakUrlCustomizer(final Locale locale) {
- super(locale);
- }
+ DvorakUrlCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getEnterKey(final boolean isPhone) {
- return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ return isPhone ? ENTER_KEY : super.getEnterKey(isPhone);
}
@Override
public ExpectedKey getEmojiKey(final boolean isPhone) {
- return LayoutBase.DOMAIN_KEY;
+ return DOMAIN_KEY;
}
@Override
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
return isPhone ? super.getKeysLeftToSpacebar(isPhone)
- : joinKeys(key("/", LayoutBase.SETTINGS_KEY));
+ : joinKeys(key("/", SETTINGS_KEY));
}
}
private static class DvorakEmail extends Dvorak {
- public DvorakEmail(final LayoutCustomizer customizer) {
- super(customizer);
- }
+ DvorakEmail(final LayoutCustomizer customizer) { super(customizer); }
@Override
protected ExpectedKey getRow1_1Key(final boolean isPhone, final int elementId) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java
index e647f8aea..2b25f813c 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java
@@ -19,9 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Dvorak;
-import com.android.inputmethod.keyboard.layout.Dvorak.DvorakCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+import com.android.inputmethod.keyboard.layout.customizer.DvorakCustomizer.EnglishDvorakCustomizer;
import java.util.Locale;
@@ -35,18 +34,4 @@ public class TestsEnglishDvorak extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
-
- public static class EnglishDvorakCustomizer extends DvorakCustomizer {
- private final EnglishCustomizer mEnglishCustomizer;
-
- EnglishDvorakCustomizer(final Locale locale) {
- super(locale);
- mEnglishCustomizer = new EnglishCustomizer(locale);
- }
-
- @Override
- public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
- return mEnglishCustomizer.setAccentedLetters(builder);
- }
- }
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java
index c80b25024..54759cef1 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java
@@ -22,6 +22,7 @@ import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -38,7 +39,7 @@ public final class TestsEnglishIN extends TestsEnglishUS {
LayoutBase getLayout() { return LAYOUT; }
private static class EnglishINCustomizer extends EnglishCustomizer {
- public EnglishINCustomizer(final Locale locale) { super(locale); }
+ EnglishINCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUK.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUK.java
index c0dcbdc06..714a6001a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUK.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUK.java
@@ -21,6 +21,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -37,7 +38,7 @@ public final class TestsEnglishUK extends TestsEnglishUS {
LayoutBase getLayout() { return LAYOUT; }
private static class EnglishUKCustomizer extends EnglishCustomizer {
- public EnglishUKCustomizer(final Locale locale) { super(locale); }
+ EnglishUKCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_POUND; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUS.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUS.java
index 6ea8f6000..570ee9d0b 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUS.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishUS.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEsperanto.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEsperanto.java
index 6a44187c9..a6792e28e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEsperanto.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEsperanto.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -37,7 +37,7 @@ public class TestsEsperanto extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class EsperantoCustomizer extends LayoutCustomizer {
- public EsperantoCustomizer(final Locale locale) { super(locale); }
+ EsperantoCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEE.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEE.java
index 28c2eb301..8cb67e223 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEE.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEE.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Nordic;
+import com.android.inputmethod.keyboard.layout.customizer.EstonianEECustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEEQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEEQwerty.java
index ab8960b66..fb7c24371 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEEQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEstonianEEQwerty.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EstonianEECustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,9 +37,7 @@ public final class TestsEstonianEEQwerty extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class EstonianEEQwertyCustomizer extends EstonianEECustomizer {
- public EstonianEEQwertyCustomizer(final Locale locale) {
- super(locale);
- }
+ EstonianEEQwertyCustomizer(final Locale locale) { super(locale); }
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnish.java
index 05def96be..3d42f30fd 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnish.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Nordic;
+import com.android.inputmethod.keyboard.layout.customizer.FinnishCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnishQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnishQwerty.java
index c3df9d115..c81b2a2bc 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnishQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFinnishQwerty.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.FinnishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,9 +37,7 @@ public final class TestsFinnishQwerty extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class FinnishQwertyCustomizer extends FinnishCustomizer {
- public FinnishQwertyCustomizer(final Locale locale) {
- super(locale);
- }
+ FinnishQwertyCustomizer(final Locale locale) { super(locale); }
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrench.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrench.java
index 7ced1fb7b..ca663f4f6 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrench.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrench.java
@@ -20,8 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Azerty;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
-import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.customizer.FrenchCustomizer.FrenchEuroCustomizer;
import java.util.Locale;
@@ -35,21 +34,4 @@ public final class TestsFrench extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
-
- static final class FrenchEuroCustomizer extends FrenchCustomizer {
- private final EuroCustomizer mEuroCustomizer;
-
- public FrenchEuroCustomizer(final Locale locale) {
- super(locale);
- mEuroCustomizer = new EuroCustomizer(locale);
- }
-
- @Override
- public final ExpectedKey getCurrencyKey() { return mEuroCustomizer.getCurrencyKey(); }
-
- @Override
- public final ExpectedKey[] getOtherCurrencyKeys() {
- return mEuroCustomizer.getOtherCurrencyKeys();
- }
- }
-} \ No newline at end of file
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCA.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCA.java
index 9b3cd1ee2..12c94b141 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCA.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCA.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.FrenchCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCH.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCH.java
index 2598aa3bf..2461157e6 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCH.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchCH.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Swiss;
+import com.android.inputmethod.keyboard.layout.customizer.FrenchCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,7 +37,7 @@ public final class TestsFrenchCH extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class FrenchCHCustomizer extends FrenchCustomizer {
- public FrenchCHCustomizer(final Locale locale) { super(locale); }
+ FrenchCHCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchDvorak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchDvorak.java
index 33d1445a4..40530638b 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchDvorak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchDvorak.java
@@ -19,11 +19,11 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Dvorak;
-import com.android.inputmethod.keyboard.layout.Dvorak.DvorakCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.DvorakCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.FrenchCustomizer.FrenchEuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
-import com.android.inputmethod.keyboard.layout.tests.TestsFrench.FrenchEuroCustomizer;
import java.util.Locale;
@@ -41,7 +41,7 @@ public final class TestsFrenchDvorak extends LayoutTestsBase {
private static class FrenchDvorakCustomizer extends DvorakCustomizer {
private final FrenchEuroCustomizer mFrenchEuroCustomizer;
- public FrenchDvorakCustomizer(final Locale locale) {
+ FrenchDvorakCustomizer(final Locale locale) {
super(locale);
mFrenchEuroCustomizer = new FrenchEuroCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchQwertz.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchQwertz.java
index 6ab28704a..67edacea7 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchQwertz.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsFrenchQwertz.java
@@ -20,7 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwertz;
-import com.android.inputmethod.keyboard.layout.tests.TestsFrench.FrenchEuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.FrenchCustomizer.FrenchEuroCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGalicianES.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGalicianES.java
index 1472828a4..c37fff254 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGalicianES.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGalicianES.java
@@ -19,8 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.SpanishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -39,7 +40,7 @@ public class TestsGalicianES extends LayoutTestsBase {
private static class GalicianESCustomizer extends EuroCustomizer {
private final SpanishCustomizer mSpanishCustomizer;
- public GalicianESCustomizer(final Locale locale) {
+ GalicianESCustomizer(final Locale locale) {
super(locale);
mSpanishCustomizer = new SpanishCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java
index f25942fb5..f6e3080c7 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Georgian;
-import com.android.inputmethod.keyboard.layout.Georgian.GeorgianCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsGeorgianGE extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ka", "GE");
- private static final LayoutBase LAYOUT = new Georgian(new GeorgianCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Georgian(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGerman.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGerman.java
index 6f7571197..52c5a0688 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGerman.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGerman.java
@@ -19,9 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Qwertz;
-import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.customizer.GermanCustomizer.GermanEuroCustomizer;
import java.util.Locale;
@@ -35,21 +34,4 @@ public final class TestsGerman extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
-
- static class GermanEuroCustomizer extends GermanCustomizer {
- final EuroCustomizer mEuroCustomizer;
-
- public GermanEuroCustomizer(final Locale locale) {
- super(locale);
- mEuroCustomizer = new EuroCustomizer(locale);
- }
-
- @Override
- public ExpectedKey getCurrencyKey() { return mEuroCustomizer.getCurrencyKey(); }
-
- @Override
- public ExpectedKey[] getOtherCurrencyKeys() {
- return mEuroCustomizer.getOtherCurrencyKeys();
- }
- }
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanCH.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanCH.java
index 7deb00bb4..10981d920 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanCH.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanCH.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Swiss;
+import com.android.inputmethod.keyboard.layout.customizer.GermanCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,7 +37,7 @@ public final class TestsGermanCH extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class GermanCHCustomizer extends GermanCustomizer {
- public GermanCHCustomizer(final Locale locale) { super(locale); }
+ GermanCHCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanDvorak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanDvorak.java
index b28d5cfcf..36d1cb8c4 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanDvorak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanDvorak.java
@@ -19,10 +19,11 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Dvorak;
-import com.android.inputmethod.keyboard.layout.Dvorak.DvorakCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.DvorakCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.GermanCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,10 +40,10 @@ public final class TestsGermanDvorak extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
- static class GermanDvorakCustomizer extends DvorakCustomizer {
- final GermanCustomizer mGermanCustomizer;
+ private static class GermanDvorakCustomizer extends DvorakCustomizer {
+ private final GermanCustomizer mGermanCustomizer;
- public GermanDvorakCustomizer(final Locale locale) {
+ GermanDvorakCustomizer(final Locale locale) {
super(locale);
mGermanCustomizer = new GermanCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanQwerty.java
index 19ae5a3f5..6db942f2a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGermanQwerty.java
@@ -20,7 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
-import com.android.inputmethod.keyboard.layout.tests.TestsGerman.GermanEuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.GermanCustomizer.GermanEuroCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGreek.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGreek.java
index 4acb119ac..fd21d522c 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGreek.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGreek.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Greek;
-import com.android.inputmethod.keyboard.layout.Greek.GreekCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public class TestsGreek extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("el");
- private static final LayoutBase LAYOUT = new Greek(new GreekCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Greek(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java
index c0243a870..cc6304881 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Hebrew;
-import com.android.inputmethod.keyboard.layout.Hebrew.HebrewCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public class TestsHebrew extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("iw");
- private static final LayoutBase LAYOUT = new Hebrew(new HebrewCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Hebrew(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java
index abea51a8d..53652fce0 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Hindi;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.HindiCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java
index 2e676df26..cfe3e9ea5 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.HindiCompact;
-import com.android.inputmethod.keyboard.layout.HindiCompact.HindiCompactCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsHindiCompact extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("hi");
- private static final LayoutBase LAYOUT = new HindiCompact(new HindiCompactCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new HindiCompact(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java
index 2a6e46f96..613b3bbc2 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java
@@ -19,10 +19,10 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -39,7 +39,7 @@ public final class TestsHinglish extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class HinglishCustomizer extends LayoutCustomizer {
- public HinglishCustomizer(final Locale locale) { super(locale); }
+ HinglishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHungarian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHungarian.java
index efc95dcf9..a32e2b551 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHungarian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHungarian.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwertz;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsHungarian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class HungarianCustomizer extends LayoutCustomizer {
- public HungarianCustomizer(final Locale locale) { super(locale); }
+ HungarianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIcelandic.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIcelandic.java
index 62b111e6a..8eabf1815 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIcelandic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIcelandic.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsIcelandic extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class IcelandicCustomizer extends LayoutCustomizer {
- public IcelandicCustomizer(final Locale locale) { super(locale); }
+ IcelandicCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIndonesian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIndonesian.java
index 9b23bfe2b..83711714d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIndonesian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsIndonesian.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java
index f3c610c8b..2acc9679b 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java
@@ -19,8 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.ItalianCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -39,7 +40,7 @@ public final class TestsItalian extends LayoutTestsBase {
private static class ItalianITCustomizer extends EuroCustomizer {
private final ItalianCustomizer mItalianCustomizer;
- public ItalianITCustomizer(final Locale locale) {
+ ItalianITCustomizer(final Locale locale) {
super(locale);
mItalianCustomizer = new ItalianCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java
index d32f9e957..f98545a50 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Swiss;
+import com.android.inputmethod.keyboard.layout.customizer.ItalianCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,7 +37,7 @@ public final class TestsItalianCH extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class ItalianCHCustomizer extends ItalianCustomizer {
- public ItalianCHCustomizer(final Locale locale) { super(locale); }
+ ItalianCHCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKannadaIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKannadaIN.java
index d1866e803..a0ff1d0ac 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKannadaIN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKannadaIN.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Kannada;
-import com.android.inputmethod.keyboard.layout.Kannada.KannadaCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsKannadaIN extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("kn", "IN");
- private static final LayoutBase LAYOUT = new Kannada(new KannadaCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Kannada(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKazakh.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKazakh.java
index d255a0fa9..66ece29ee 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKazakh.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKazakh.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.EastSlavic;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -37,7 +37,7 @@ public final class TestsKazakh extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class KazakhCustomizer extends EastSlavicCustomizer {
- public KazakhCustomizer(final Locale locale) { super(locale); }
+ KazakhCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java
index df2f40d86..dde9b87f6 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Khmer;
-import com.android.inputmethod.keyboard.layout.Khmer.KhmerCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsKhmerKH extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("km", "KH");
- private static final LayoutBase LAYOUT = new Khmer(new KhmerCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Khmer(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKyrgyz.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKyrgyz.java
index 9797b4ba9..3faf2f6be 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKyrgyz.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKyrgyz.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.EastSlavic;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -37,7 +37,7 @@ public final class TestsKyrgyz extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class KyrgyzCustomizer extends EastSlavicCustomizer {
- public KyrgyzCustomizer(final Locale locale) { super(locale); }
+ KyrgyzCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java
index 34ad1fb7f..ffa337285 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Lao;
-import com.android.inputmethod.keyboard.layout.Lao.LaoCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsLaoLA extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("lo", "LA");
- private static final LayoutBase LAYOUT = new Lao(new LaoCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Lao(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLatvian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLatvian.java
index dc1736c6d..dbab16a12 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLatvian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLatvian.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsLatvian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class LatvianCustomizer extends LayoutCustomizer {
- public LatvianCustomizer(final Locale locale) { super(locale); }
+ LatvianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLithuanian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLithuanian.java
index 55ac37a37..248014a0d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLithuanian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLithuanian.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsLithuanian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class LithuanianCustomizer extends LayoutCustomizer {
- public LithuanianCustomizer(final Locale locale) { super(locale); }
+ LithuanianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMacedonian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMacedonian.java
index 1d7d85650..46b1c39d5 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMacedonian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMacedonian.java
@@ -20,8 +20,8 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.SouthSlavic;
-import com.android.inputmethod.keyboard.layout.SouthSlavic.SouthSlavicLayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.SouthSlavicLayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsMacedonian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class MacedonianCustomizer extends SouthSlavicLayoutCustomizer {
- public MacedonianCustomizer(final Locale locale) { super(locale); }
+ MacedonianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayMY.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayMY.java
index 9792af9d0..a6e6cd50c 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayMY.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayMY.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java
index b494ad37b..e3fcb5332 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Malayalam;
-import com.android.inputmethod.keyboard.layout.Malayalam.MalayalamCustomizer;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsMalayalamIN extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ml", "IN");
- private static final LayoutBase LAYOUT = new Malayalam(new MalayalamCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Malayalam(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMarathiIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMarathiIN.java
index b937629b0..3e54f6e3d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMarathiIN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMarathiIN.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Marathi;
-import com.android.inputmethod.keyboard.layout.Marathi.MarathiCustomizer;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsMarathiIN extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("mr", "IN");
- private static final LayoutBase LAYOUT = new Marathi(new MarathiCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Marathi(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java
index e28e962f9..6dafe7789 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Mongolian;
-import com.android.inputmethod.keyboard.layout.Mongolian.MongolianMNCustomizer;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsMongolianMN extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("mn", "MN");
- private static final LayoutBase LAYOUT = new Mongolian(new MongolianMNCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Mongolian(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMyanmarMM.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMyanmarMM.java
index e6d3b3b92..b581e4a12 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMyanmarMM.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMyanmarMM.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Myanmar;
-import com.android.inputmethod.keyboard.layout.Myanmar.MyanmarCustomizer;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsMyanmarMM extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("my", "MM");
- private static final LayoutBase LAYOUT = new Myanmar(new MyanmarCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Myanmar(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliRomanized.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliRomanized.java
index 971976aec..f646db379 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliRomanized.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliRomanized.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.NepaliRomanized;
-import com.android.inputmethod.keyboard.layout.NepaliRomanized.NepaliRomanizedCustomizer;
import java.util.Locale;
@@ -30,8 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsNepaliRomanized extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ne", "NP");
- private static final LayoutBase LAYOUT = new NepaliRomanized(
- new NepaliRomanizedCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new NepaliRomanized(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliTraditional.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliTraditional.java
index 724c4304f..99d87b143 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliTraditional.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNepaliTraditional.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.NepaliTraditional;
-import com.android.inputmethod.keyboard.layout.NepaliTraditional.NepaliTraditionalCustomizer;
import java.util.Locale;
@@ -30,8 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsNepaliTraditional extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ne", "NP");
- private static final LayoutBase LAYOUT = new NepaliTraditional(
- new NepaliTraditionalCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new NepaliTraditional(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguage.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguage.java
index 3ed63153a..149d520c7 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguage.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguage.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.NoLanguageCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageColemak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageColemak.java
index 8d627e3b4..979947f2f 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageColemak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageColemak.java
@@ -20,7 +20,8 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Colemak;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.NoLanguageCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -39,7 +40,7 @@ public final class TestsNoLanguageColemak extends LayoutTestsBase {
private static class NoLanguageColemakCustomizer extends LayoutCustomizer {
private final NoLanguageCustomizer mNoLanguageCustomizer;
- public NoLanguageColemakCustomizer(final Locale locale) {
+ NoLanguageColemakCustomizer(final Locale locale) {
super(locale);
mNoLanguageCustomizer = new NoLanguageCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageDvorak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageDvorak.java
index 9bf47ed42..542319394 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageDvorak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguageDvorak.java
@@ -19,8 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Dvorak;
-import com.android.inputmethod.keyboard.layout.Dvorak.DvorakCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.DvorakCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.NoLanguageCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -39,7 +40,7 @@ public final class TestsNoLanguageDvorak extends LayoutTestsBase {
private static class NoLanguageDvorakCustomizer extends DvorakCustomizer {
private final NoLanguageCustomizer mNoLanguageCustomizer;
- public NoLanguageDvorakCustomizer(final Locale locale) {
+ NoLanguageDvorakCustomizer(final Locale locale) {
super(locale);
mNoLanguageCustomizer = new NoLanguageCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguagePcQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguagePcQwerty.java
index cd8d43ca8..20b587b73 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguagePcQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNoLanguagePcQwerty.java
@@ -20,7 +20,8 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.PcQwerty;
-import com.android.inputmethod.keyboard.layout.PcQwerty.PcQwertyCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.NoLanguageCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.PcQwertyCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -39,7 +40,7 @@ public final class TestsNoLanguagePcQwerty extends LayoutTestsBase {
private static class NoLanguagePcQwertyCustomizer extends PcQwertyCustomizer {
private final NoLanguageCustomizer mNoLanguageCustomizer;
- public NoLanguagePcQwertyCustomizer(final Locale locale) {
+ NoLanguagePcQwertyCustomizer(final Locale locale) {
super(locale);
mNoLanguageCustomizer = new NoLanguageCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegian.java
index 6c1921ab4..910512c98 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegian.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Nordic;
+import com.android.inputmethod.keyboard.layout.customizer.NorwegianCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegianColemak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegianColemak.java
index a481796ed..689c38e17 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegianColemak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsNorwegianColemak.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Colemak;
import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.customizer.NorwegianCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,9 +37,7 @@ public final class TestsNorwegianColemak extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class NorwegianColemakCustomizer extends NorwegianCustomizer {
- public NorwegianColemakCustomizer(final Locale locale) {
- super(locale);
- }
+ NorwegianColemakCustomizer(final Locale locale) { super(locale); }
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java
index b7d75c9f0..8ea8075c4 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Farsi;
-import com.android.inputmethod.keyboard.layout.Farsi.FarsiCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public class TestsPersian extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("fa");
- private static final LayoutBase LAYOUT = new Farsi(new FarsiCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Farsi(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPolish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPolish.java
index 04f88c3fc..4f1170afe 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPolish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPolish.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsPolish extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class PolishCustomizer extends LayoutCustomizer {
- public PolishCustomizer(final Locale locale) { super(locale); }
+ PolishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortugueseBR.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortugueseBR.java
index 8a984a765..7fadaac7e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortugueseBR.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortugueseBR.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.PortugueseCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortuguesePT.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortuguesePT.java
index e15e811db..5936e8dce 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortuguesePT.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPortuguesePT.java
@@ -19,8 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.PortugueseCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -39,7 +40,7 @@ public final class TestsPortuguesePT extends TestsPortugueseBR {
private static class PortuguesePTCustomizer extends PortugueseCustomizer {
private final EuroCustomizer mEuroCustomizer;
- public PortuguesePTCustomizer(final Locale locale) {
+ PortuguesePTCustomizer(final Locale locale) {
super(locale);
mEuroCustomizer = new EuroCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java
index f89863279..cc204def8 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java
@@ -24,6 +24,7 @@ import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.keyboard.KeyboardLayoutSet;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -52,23 +53,21 @@ public class TestsQwertyEmail extends LayoutTestsBase {
}
private static class EnglishEmailCustomizer extends EnglishCustomizer {
- EnglishEmailCustomizer(final Locale locale) {
- super(locale);
- }
+ EnglishEmailCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getEnterKey(final boolean isPhone) {
- return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ return isPhone ? ENTER_KEY : super.getEnterKey(isPhone);
}
@Override
public ExpectedKey getEmojiKey(final boolean isPhone) {
- return LayoutBase.DOMAIN_KEY;
+ return DOMAIN_KEY;
}
@Override
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
- return joinKeys(key("@", LayoutBase.SETTINGS_KEY));
+ return joinKeys(key("@", SETTINGS_KEY));
}
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java
index 0b69c7bc2..acd09d25a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java
@@ -24,6 +24,7 @@ import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.keyboard.KeyboardLayoutSet;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -52,23 +53,21 @@ public class TestsQwertyUrl extends LayoutTestsBase {
}
private static class EnglishUrlCustomizer extends EnglishCustomizer {
- EnglishUrlCustomizer(final Locale locale) {
- super(locale);
- }
+ EnglishUrlCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getEnterKey(final boolean isPhone) {
- return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ return isPhone ? ENTER_KEY : super.getEnterKey(isPhone);
}
@Override
public ExpectedKey getEmojiKey(final boolean isPhone) {
- return LayoutBase.DOMAIN_KEY;
+ return DOMAIN_KEY;
}
@Override
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
- return joinKeys(key("/", LayoutBase.SETTINGS_KEY));
+ return joinKeys(key("/", SETTINGS_KEY));
}
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRomanian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRomanian.java
index d7b858ea5..af4fbca84 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRomanian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRomanian.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsRomanian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class RomanianCustomizer extends LayoutCustomizer {
- public RomanianCustomizer(final Locale locale) { super(locale); }
+ RomanianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRussian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRussian.java
index 9919207ed..75ef48154 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRussian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsRussian.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.EastSlavic;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsRussian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class RussianCustomizer extends EastSlavicCustomizer {
- public RussianCustomizer(final Locale locale) { super(locale); }
+ RussianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbian.java
index 41f1690f3..9495706b2 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbian.java
@@ -20,8 +20,8 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.SouthSlavic;
-import com.android.inputmethod.keyboard.layout.SouthSlavic.SouthSlavicLayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.SouthSlavicLayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsSerbian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class SerbianCustomizer extends SouthSlavicLayoutCustomizer {
- public SerbianCustomizer(final Locale locale) { super(locale); }
+ SerbianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java
index 70f4bcefd..7490d30ab 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.SerbianQwertz;
+import com.android.inputmethod.keyboard.layout.customizer.SerbianLatinCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java
index d8ef51b45..6d9351c9d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.SerbianLatinCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -37,14 +38,12 @@ public final class TestsSerbianLatinQwerty extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class SerbianLatinQwertyCustomizer extends SerbianLatinCustomizer {
- public SerbianLatinQwertyCustomizer(final Locale locale) {
- super(locale);
- }
+ SerbianLatinQwertyCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
return isPhone ? EMPTY_KEYS
- : joinKeys(LayoutBase.EXCLAMATION_AND_QUESTION_MARKS, LayoutBase.SHIFT_KEY);
+ : joinKeys(EXCLAMATION_AND_QUESTION_MARKS, SHIFT_KEY);
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSinhalaLK.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSinhalaLK.java
index 8b861359b..c55c17c53 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSinhalaLK.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSinhalaLK.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.Suppress;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Sinhala;
-import com.android.inputmethod.keyboard.layout.Sinhala.SinhalaCustomizer;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@Suppress
public final class TestsSinhalaLK extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("si", "LK");
- private static final LayoutBase LAYOUT = new Sinhala(new SinhalaCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Sinhala(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovak.java
index bdaf0cad1..c94471644 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovak.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsSlovak extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class SlovakCustomizer extends EuroCustomizer {
- public SlovakCustomizer(final Locale locale) { super(locale); }
+ SlovakCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovenian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovenian.java
index cdb1beeba..e49a27b94 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovenian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSlovenian.java
@@ -19,9 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -39,7 +39,7 @@ public final class TestsSlovenian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class SlovenianCustomizer extends EuroCustomizer {
- public SlovenianCustomizer(final Locale locale) { super(locale); }
+ SlovenianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish.java
index 12e8676ae..6c8693199 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish.java
@@ -19,8 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.SpanishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -39,7 +40,7 @@ public class TestsSpanish extends LayoutTestsBase {
private static class SpanishESCustomizer extends SpanishCustomizer {
private final EuroCustomizer mEuroCustomizer;
- public SpanishESCustomizer(final Locale locale) {
+ SpanishESCustomizer(final Locale locale) {
super(locale);
mEuroCustomizer = new EuroCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java
index 75aad136f..828f4c4bc 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.SpanishCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanishUS.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanishUS.java
index c3ac0a0c0..b5bfbe47f 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanishUS.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanishUS.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.SpanishCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSplitLayoutQwertyEnglishUS.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSplitLayoutQwertyEnglishUS.java
index b3340aace..c401d3d36 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSplitLayoutQwertyEnglishUS.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSplitLayoutQwertyEnglishUS.java
@@ -23,6 +23,7 @@ import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.keyboard.KeyboardLayoutSet;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -47,18 +48,14 @@ public class TestsSplitLayoutQwertyEnglishUS extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class EnglishSplitCustomizer extends EnglishCustomizer {
- EnglishSplitCustomizer(Locale locale) {
- super(locale);
- }
+ EnglishSplitCustomizer(Locale locale) { super(locale); }
@Override
public ExpectedKey[] getSpaceKeys(final boolean isPhone) {
if (isPhone) {
return super.getSpaceKeys(isPhone);
- } else {
- return LayoutBase.joinKeys(
- LayoutBase.LANGUAGE_SWITCH_KEY, LayoutBase.SPACE_KEY, LayoutBase.SPACE_KEY);
}
+ return joinKeys(LANGUAGE_SWITCH_KEY, SPACE_KEY, SPACE_KEY);
}
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwahili.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwahili.java
index 13b974194..a8ab966ac 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwahili.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwahili.java
@@ -19,8 +19,8 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -37,7 +37,7 @@ public final class TestsSwahili extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class SwahiliCustomizer extends LayoutCustomizer {
- public SwahiliCustomizer(final Locale locale) { super(locale); }
+ SwahiliCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedish.java
index 79cb3dcc7..061001d49 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedish.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Nordic;
+import com.android.inputmethod.keyboard.layout.customizer.SwedishCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedishPcQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedishPcQwerty.java
index ed74d6d74..dc3d83134 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedishPcQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSwedishPcQwerty.java
@@ -19,9 +19,10 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.PcQwerty;
-import com.android.inputmethod.keyboard.layout.PcQwerty.PcQwertyCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.PcQwertyCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.SwedishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -41,7 +42,7 @@ public final class TestsSwedishPcQwerty extends LayoutTestsBase {
private static class SwedishPcQwertyCustomizer extends SwedishCustomizer {
private final LayoutCustomizer mPcQwertyCustomizer;
- public SwedishPcQwertyCustomizer(final Locale locale) {
+ SwedishPcQwertyCustomizer(final Locale locale) {
super(locale);
mPcQwertyCustomizer = new PcQwertyCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTagalog.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTagalog.java
index 38d5364e5..ecef2d79e 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTagalog.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTagalog.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Spanish;
+import com.android.inputmethod.keyboard.layout.customizer.SpanishCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -36,15 +37,11 @@ public class TestsTagalog extends TestsSpanish {
LayoutBase getLayout() { return LAYOUT; }
private static class TagalogCustomizer extends SpanishCustomizer {
-
- public TagalogCustomizer(final Locale locale) {
- super(locale);
- }
+ TagalogCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) {
- return isPhone ? LayoutBase.PHONE_PUNCTUATION_MORE_KEYS
- : LayoutBase.TABLET_PUNCTUATION_MORE_KEYS;
+ return isPhone ? PHONE_PUNCTUATION_MORE_KEYS : TABLET_PUNCTUATION_MORE_KEYS;
}
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilIN.java
index 31df53c0b..3297d399f 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilIN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilIN.java
@@ -22,7 +22,7 @@ import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
import com.android.inputmethod.keyboard.layout.Tamil;
-import com.android.inputmethod.keyboard.layout.Tamil.TamilCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.TamilCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -39,7 +39,7 @@ public final class TestsTamilIN extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class TamilINCustomizer extends TamilCustomizer {
- public TamilINCustomizer(final Locale locale) { super(locale); }
+ TamilINCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilLK.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilLK.java
index 65ec0b036..72872ba66 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilLK.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilLK.java
@@ -22,7 +22,7 @@ import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
import com.android.inputmethod.keyboard.layout.Tamil;
-import com.android.inputmethod.keyboard.layout.Tamil.TamilCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.TamilCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import java.util.Locale;
@@ -39,7 +39,7 @@ public final class TestsTamilLK extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class TamilLKCustomizer extends TamilCustomizer {
- public TamilLKCustomizer(final Locale locale) { super(locale); }
+ TamilLKCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilSG.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilSG.java
index ade7abaf9..a7a041b61 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilSG.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTamilSG.java
@@ -20,7 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Tamil;
-import com.android.inputmethod.keyboard.layout.Tamil.TamilCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.TamilCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTeluguIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTeluguIN.java
index 04996d9aa..2b202a91d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTeluguIN.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTeluguIN.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Telugu;
-import com.android.inputmethod.keyboard.layout.Telugu.TeluguCustomizer;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsTeluguIN extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("te", "IN");
- private static final LayoutBase LAYOUT = new Telugu(new TeluguCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Telugu(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsThai.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsThai.java
index 3c8727290..2c1a29efc 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsThai.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsThai.java
@@ -20,7 +20,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Thai;
-import com.android.inputmethod.keyboard.layout.Thai.ThaiCustomizer;
import java.util.Locale;
@@ -30,7 +29,7 @@ import java.util.Locale;
@SmallTest
public final class TestsThai extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("th");
- private static final LayoutBase LAYOUT = new Thai(new ThaiCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Thai(LOCALE);
@Override
LayoutBase getLayout() { return LAYOUT; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTurkish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTurkish.java
index bf427cdb0..95f86e461 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTurkish.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsTurkish.java
@@ -19,8 +19,9 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EuroCustomizer;
+import com.android.inputmethod.keyboard.layout.customizer.TurkicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -39,7 +40,7 @@ public final class TestsTurkish extends LayoutTestsBase {
private static class TurkishCustomizer extends EuroCustomizer {
private final TurkicCustomizer mTurkicCustomizer;
- public TurkishCustomizer(final Locale locale) {
+ TurkishCustomizer(final Locale locale) {
super(locale);
mTurkicCustomizer = new TurkicCustomizer(locale);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java
index a6bcacc9e..da93d6c3b 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java
@@ -19,10 +19,10 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.EastSlavic;
-import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -40,7 +40,7 @@ public final class TestsUkrainian extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class UkrainianCustomizer extends EastSlavicCustomizer {
- public UkrainianCustomizer(final Locale locale) { super(locale); }
+ UkrainianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_HRYVNIA; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbek.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbek.java
index e8801dd58..fd12a6a82 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbek.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbek.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Uzbek;
+import com.android.inputmethod.keyboard.layout.customizer.UzbekCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbekQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbekQwerty.java
index dec587f85..4c33a8cc1 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbekQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUzbekQwerty.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.UzbekCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@@ -36,9 +37,7 @@ public final class TestsUzbekQwerty extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class UzbekQwertyCustomizer extends UzbekCustomizer {
- public UzbekQwertyCustomizer(final Locale locale) {
- super(locale);
- }
+ UzbekQwertyCustomizer(final Locale locale) { super(locale); }
@Override
protected void setUzbekKeys(final ExpectedKeyboardBuilder builder) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java
index 83d86ac4d..356b04296 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java
@@ -19,10 +19,10 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
-import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -40,9 +40,7 @@ public final class TestsVietnamese extends LayoutTestsBase {
LayoutBase getLayout() { return LAYOUT; }
private static class VietnameseCustomizer extends LayoutCustomizer {
- public VietnameseCustomizer(final Locale locale) {
- super(locale);
- }
+ VietnameseCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_DONG; }
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsZulu.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsZulu.java
index e048e92c2..abf3cad9c 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsZulu.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsZulu.java
@@ -20,6 +20,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer;
import java.util.Locale;
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
index f8b68e0ce..201b8bb77 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
@@ -304,6 +304,39 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
"unigram with various code points"));
}
+ public void testCharacterTableIsPresent() throws IOException, UnsupportedFormatException {
+ final String[] wordSource = {"words", "used", "for", "testing", "a", "code point", "table"};
+ final List<String> words = Arrays.asList(wordSource);
+ final String correctCodePointTable = "eotdsanirfg bclwup";
+ final String dictName = "codePointTableTest";
+ final String dictVersion = Long.toString(System.currentTimeMillis());
+ final String codePointTableAttribute = DictionaryHeader.CODE_POINT_TABLE_KEY;
+ final File file = new File(dictName);
+
+ // Write a test dictionary
+ final DictEncoder dictEncoder = new Ver2DictEncoder(file,
+ Ver2DictEncoder.CODE_POINT_TABLE_ON);
+ final FormatSpec.FormatOptions formatOptions =
+ new FormatSpec.FormatOptions(
+ FormatSpec.MINIMUM_SUPPORTED_VERSION_OF_CODE_POINT_TABLE);
+ final FusionDictionary sourcedict = new FusionDictionary(new PtNodeArray(),
+ BinaryDictUtils.makeDictionaryOptions(dictName, dictVersion, formatOptions));
+ addUnigrams(words.size(), sourcedict, words, null /* shortcutMap */);
+ dictEncoder.writeDictionary(sourcedict, formatOptions);
+
+ // Read the dictionary
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
+ DictDecoder.USE_BYTEARRAY);
+ final DictionaryHeader fileHeader = dictDecoder.readHeader();
+ // Check if codePointTable is present
+ assertTrue("codePointTable is not present",
+ fileHeader.mDictionaryOptions.mAttributes.containsKey(codePointTableAttribute));
+ final String codePointTable =
+ fileHeader.mDictionaryOptions.mAttributes.get(codePointTableAttribute);
+ // Check if codePointTable is correct
+ assertEquals("codePointTable is incorrect", codePointTable, correctCodePointTable);
+ }
+
// Unit test for CharEncoding.readString and CharEncoding.writeString.
public void testCharEncoding() {
// the max length of a word in sWords is less than 50.
@@ -312,7 +345,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
final DictBuffer dictBuffer = new ByteArrayDictBuffer(buffer);
for (final String word : sWords) {
Arrays.fill(buffer, (byte) 0);
- CharEncoding.writeString(buffer, 0, word);
+ CharEncoding.writeString(buffer, 0, word, null);
dictBuffer.position(0);
final String str = CharEncoding.readString(dictBuffer);
assertEquals(word, str);
@@ -682,11 +715,13 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
}
assertTrue(shortcutList.isEmpty());
}
- for (final WeightedString bigramTarget : wordProperty.getBigrams()) {
- final String word1 = bigramTarget.mWord;
- final Pair<String, String> bigram = new Pair<>(word0, word1);
- assertTrue(bigramSet.contains(bigram));
- bigramSet.remove(bigram);
+ if (wordProperty.mHasNgrams) {
+ for (final WeightedString bigramTarget : wordProperty.getBigrams()) {
+ final String word1 = bigramTarget.mWord;
+ final Pair<String, String> bigram = new Pair<>(word0, word1);
+ assertTrue(bigramSet.contains(bigram));
+ bigramSet.remove(bigram);
+ }
}
token = result.mNextToken;
} while (token != 0);
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
index 96604a197..1f3ee19af 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
@@ -17,11 +17,11 @@
package com.android.inputmethod.latin.makedict;
import com.android.inputmethod.annotations.UsedForTesting;
-
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
+import java.util.HashMap;
/**
* Decodes binary files for a FusionDictionary.
@@ -109,15 +109,19 @@ public final class BinaryDictDecoderUtils {
* A class grouping utility function for our specific character encoding.
*/
static final class CharEncoding {
- private static final int MINIMAL_ONE_BYTE_CHARACTER_VALUE = 0x20;
- private static final int MAXIMAL_ONE_BYTE_CHARACTER_VALUE = 0xFF;
/**
* Helper method to find out whether this code fits on one byte
*/
- private static boolean fitsOnOneByte(final int character) {
- return character >= MINIMAL_ONE_BYTE_CHARACTER_VALUE
- && character <= MAXIMAL_ONE_BYTE_CHARACTER_VALUE;
+ private static boolean fitsOnOneByte(int character,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ if (codePointToOneByteCodeMap != null) {
+ if (codePointToOneByteCodeMap.containsKey(character)) {
+ character = codePointToOneByteCodeMap.get(character);
+ }
+ }
+ return character >= FormatSpec.MINIMAL_ONE_BYTE_CHARACTER_VALUE
+ && character <= FormatSpec.MAXIMAL_ONE_BYTE_CHARACTER_VALUE;
}
/**
@@ -137,9 +141,10 @@ public final class BinaryDictDecoderUtils {
* @param character the character code.
* @return the size in binary encoded-form, either 1 or 3 bytes.
*/
- static int getCharSize(final int character) {
+ static int getCharSize(final int character,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
// See char encoding in FusionDictionary.java
- if (fitsOnOneByte(character)) return 1;
+ if (fitsOnOneByte(character, codePointToOneByteCodeMap)) return 1;
if (FormatSpec.INVALID_CHARACTER == character) return 1;
return 3;
}
@@ -147,9 +152,10 @@ public final class BinaryDictDecoderUtils {
/**
* Compute the byte size of a character array.
*/
- static int getCharArraySize(final int[] chars) {
+ static int getCharArraySize(final int[] chars,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
int size = 0;
- for (int character : chars) size += getCharSize(character);
+ for (int character : chars) size += getCharSize(character, codePointToOneByteCodeMap);
return size;
}
@@ -159,11 +165,19 @@ public final class BinaryDictDecoderUtils {
* @param codePoints the code point array to write.
* @param buffer the byte buffer to write to.
* @param index the index in buffer to write the character array to.
+ * @param codePointToOneByteCodeMap the map to convert the code point.
* @return the index after the last character.
*/
- static int writeCharArray(final int[] codePoints, final byte[] buffer, int index) {
+ static int writeCharArray(final int[] codePoints, final byte[] buffer, int index,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
for (int codePoint : codePoints) {
- if (1 == getCharSize(codePoint)) {
+ if (codePointToOneByteCodeMap != null) {
+ if (codePointToOneByteCodeMap.containsKey(codePoint)) {
+ // Convert code points
+ codePoint = codePointToOneByteCodeMap.get(codePoint);
+ }
+ }
+ if (1 == getCharSize(codePoint, codePointToOneByteCodeMap)) {
buffer[index++] = (byte)codePoint;
} else {
buffer[index++] = (byte)(0xFF & (codePoint >> 16));
@@ -184,12 +198,19 @@ public final class BinaryDictDecoderUtils {
* @param word the string to write.
* @return the size written, in bytes.
*/
- static int writeString(final byte[] buffer, final int origin, final String word) {
+ static int writeString(final byte[] buffer, final int origin, final String word,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
final int length = word.length();
int index = origin;
for (int i = 0; i < length; i = word.offsetByCodePoints(i, 1)) {
- final int codePoint = word.codePointAt(i);
- if (1 == getCharSize(codePoint)) {
+ int codePoint = word.codePointAt(i);
+ if (codePointToOneByteCodeMap != null) {
+ if (codePointToOneByteCodeMap.containsKey(codePoint)) {
+ // Convert code points
+ codePoint = codePointToOneByteCodeMap.get(codePoint);
+ }
+ }
+ if (1 == getCharSize(codePoint, codePointToOneByteCodeMap)) {
buffer[index++] = (byte)codePoint;
} else {
buffer[index++] = (byte)(0xFF & (codePoint >> 16));
@@ -210,12 +231,13 @@ public final class BinaryDictDecoderUtils {
* @param word the string to write.
* @return the size written, in bytes.
*/
- static int writeString(final OutputStream stream, final String word) throws IOException {
+ static int writeString(final OutputStream stream, final String word,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) throws IOException {
final int length = word.length();
int written = 0;
for (int i = 0; i < length; i = word.offsetByCodePoints(i, 1)) {
final int codePoint = word.codePointAt(i);
- final int charSize = getCharSize(codePoint);
+ final int charSize = getCharSize(codePoint, codePointToOneByteCodeMap);
if (1 == charSize) {
stream.write((byte) codePoint);
} else {
@@ -253,7 +275,7 @@ public final class BinaryDictDecoderUtils {
*/
static int readChar(final DictBuffer dictBuffer) {
int character = dictBuffer.readUnsignedByte();
- if (!fitsOnOneByte(character)) {
+ if (!fitsOnOneByte(character, null)) {
if (FormatSpec.PTNODE_CHARACTERS_TERMINATOR == character) {
return FormatSpec.INVALID_CHARACTER;
}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
index 12290e6aa..2d536d822 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
@@ -61,8 +61,9 @@ public class BinaryDictEncoderUtils {
* @param characters the character array
* @return the size of the char array, including the terminator if any
*/
- static int getPtNodeCharactersSize(final int[] characters) {
- int size = CharEncoding.getCharArraySize(characters);
+ static int getPtNodeCharactersSize(final int[] characters,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ int size = CharEncoding.getCharArraySize(characters, codePointToOneByteCodeMap);
if (characters.length > 1) size += FormatSpec.PTNODE_TERMINATOR_SIZE;
return size;
}
@@ -76,8 +77,9 @@ public class BinaryDictEncoderUtils {
* @param ptNode the PtNode
* @return the size of the char array, including the terminator if any
*/
- private static int getPtNodeCharactersSize(final PtNode ptNode) {
- return getPtNodeCharactersSize(ptNode.mChars);
+ private static int getPtNodeCharactersSize(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ return getPtNodeCharactersSize(ptNode.mChars, codePointToOneByteCodeMap);
}
/**
@@ -92,13 +94,14 @@ public class BinaryDictEncoderUtils {
/**
* Compute the size of a shortcut in bytes.
*/
- private static int getShortcutSize(final WeightedString shortcut) {
+ private static int getShortcutSize(final WeightedString shortcut,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
int size = FormatSpec.PTNODE_ATTRIBUTE_FLAGS_SIZE;
final String word = shortcut.mWord;
final int length = word.length();
for (int i = 0; i < length; i = word.offsetByCodePoints(i, 1)) {
final int codePoint = word.codePointAt(i);
- size += CharEncoding.getCharSize(codePoint);
+ size += CharEncoding.getCharSize(codePoint, codePointToOneByteCodeMap);
}
size += FormatSpec.PTNODE_TERMINATOR_SIZE;
return size;
@@ -110,11 +113,12 @@ public class BinaryDictEncoderUtils {
* This is known in advance and does not change according to position in the file
* like address lists do.
*/
- static int getShortcutListSize(final ArrayList<WeightedString> shortcutList) {
+ static int getShortcutListSize(final ArrayList<WeightedString> shortcutList,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
if (null == shortcutList || shortcutList.isEmpty()) return 0;
int size = FormatSpec.PTNODE_SHORTCUT_LIST_SIZE_SIZE;
for (final WeightedString shortcut : shortcutList) {
- size += getShortcutSize(shortcut);
+ size += getShortcutSize(shortcut, codePointToOneByteCodeMap);
}
return size;
}
@@ -125,14 +129,16 @@ public class BinaryDictEncoderUtils {
* @param ptNode the PtNode to compute the size of.
* @return the maximum size of the PtNode.
*/
- private static int getPtNodeMaximumSize(final PtNode ptNode) {
- int size = getNodeHeaderSize(ptNode);
+ private static int getPtNodeMaximumSize(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ int size = getNodeHeaderSize(ptNode, codePointToOneByteCodeMap);
if (ptNode.isTerminal()) {
// If terminal, one byte for the frequency.
size += FormatSpec.PTNODE_FREQUENCY_SIZE;
}
size += FormatSpec.PTNODE_MAX_ADDRESS_SIZE; // For children address
- size += getShortcutListSize(ptNode.mShortcutTargets);
+ // TODO: Use codePointToOneByteCodeMap for shortcuts.
+ size += getShortcutListSize(ptNode.mShortcutTargets, null /* codePointToOneByteCodeMap */);
if (null != ptNode.mBigrams) {
size += (FormatSpec.PTNODE_ATTRIBUTE_FLAGS_SIZE
+ FormatSpec.PTNODE_ATTRIBUTE_MAX_ADDRESS_SIZE)
@@ -148,10 +154,11 @@ public class BinaryDictEncoderUtils {
*
* @param ptNodeArray the node array to compute the maximum size of.
*/
- private static void calculatePtNodeArrayMaximumSize(final PtNodeArray ptNodeArray) {
+ private static void calculatePtNodeArrayMaximumSize(final PtNodeArray ptNodeArray,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
int size = getPtNodeCountSize(ptNodeArray);
for (PtNode node : ptNodeArray.mData) {
- final int nodeSize = getPtNodeMaximumSize(node);
+ final int nodeSize = getPtNodeMaximumSize(node, codePointToOneByteCodeMap);
node.mCachedSize = nodeSize;
size += nodeSize;
}
@@ -163,8 +170,10 @@ public class BinaryDictEncoderUtils {
*
* @param ptNode the PtNode of which to compute the size of the header
*/
- private static int getNodeHeaderSize(final PtNode ptNode) {
- return FormatSpec.PTNODE_FLAGS_SIZE + getPtNodeCharactersSize(ptNode);
+ private static int getNodeHeaderSize(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ return FormatSpec.PTNODE_FLAGS_SIZE + getPtNodeCharactersSize(ptNode,
+ codePointToOneByteCodeMap);
}
/**
@@ -367,7 +376,8 @@ public class BinaryDictEncoderUtils {
* @return false if none of the cached addresses inside the node array changed, true otherwise.
*/
private static boolean computeActualPtNodeArraySize(final PtNodeArray ptNodeArray,
- final FusionDictionary dict) {
+ final FusionDictionary dict,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
boolean changed = false;
int size = getPtNodeCountSize(ptNodeArray);
for (PtNode ptNode : ptNodeArray.mData) {
@@ -375,7 +385,7 @@ public class BinaryDictEncoderUtils {
if (ptNode.mCachedAddressAfterUpdate != ptNode.mCachedAddressBeforeUpdate) {
changed = true;
}
- int nodeSize = getNodeHeaderSize(ptNode);
+ int nodeSize = getNodeHeaderSize(ptNode, codePointToOneByteCodeMap);
if (ptNode.isTerminal()) {
nodeSize += FormatSpec.PTNODE_FREQUENCY_SIZE;
}
@@ -383,7 +393,9 @@ public class BinaryDictEncoderUtils {
nodeSize += getByteSize(getOffsetToTargetNodeArrayDuringUpdate(ptNodeArray,
nodeSize + size, ptNode.mChildren));
}
- nodeSize += getShortcutListSize(ptNode.mShortcutTargets);
+ // TODO: Use codePointToOneByteCodeMap for shortcuts.
+ nodeSize += getShortcutListSize(ptNode.mShortcutTargets,
+ null /* codePointToOneByteCodeMap */);
if (null != ptNode.mBigrams) {
for (WeightedString bigram : ptNode.mBigrams) {
final int offset = getOffsetToTargetPtNodeDuringUpdate(ptNodeArray,
@@ -454,10 +466,11 @@ public class BinaryDictEncoderUtils {
* @return the same array it was passed. The nodes have been updated for address and size.
*/
/* package */ static ArrayList<PtNodeArray> computeAddresses(final FusionDictionary dict,
- final ArrayList<PtNodeArray> flatNodes) {
+ final ArrayList<PtNodeArray> flatNodes,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
// First get the worst possible sizes and offsets
for (final PtNodeArray n : flatNodes) {
- calculatePtNodeArrayMaximumSize(n);
+ calculatePtNodeArrayMaximumSize(n, codePointToOneByteCodeMap);
}
final int offset = initializePtNodeArraysCachedAddresses(flatNodes);
@@ -472,7 +485,8 @@ public class BinaryDictEncoderUtils {
for (final PtNodeArray ptNodeArray : flatNodes) {
ptNodeArray.mCachedAddressAfterUpdate = ptNodeArrayStartOffset;
final int oldNodeArraySize = ptNodeArray.mCachedSize;
- final boolean changed = computeActualPtNodeArraySize(ptNodeArray, dict);
+ final boolean changed = computeActualPtNodeArraySize(ptNodeArray, dict,
+ codePointToOneByteCodeMap);
final int newNodeArraySize = ptNodeArray.mCachedSize;
if (oldNodeArraySize < newNodeArraySize) {
throw new RuntimeException("Increased size ?!");
@@ -686,9 +700,10 @@ public class BinaryDictEncoderUtils {
+ (frequency & FormatSpec.FLAG_BIGRAM_SHORTCUT_ATTR_FREQUENCY);
}
- /* package */ static final int getChildrenPosition(final PtNode ptNode) {
+ /* package */ static final int getChildrenPosition(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
int positionOfChildrenPosField = ptNode.mCachedAddressAfterUpdate
- + getNodeHeaderSize(ptNode);
+ + getNodeHeaderSize(ptNode, codePointToOneByteCodeMap);
if (ptNode.isTerminal()) {
// A terminal node has the frequency.
// If positionOfChildrenPosField is incorrect, we may crash when jumping to the children
@@ -705,10 +720,12 @@ public class BinaryDictEncoderUtils {
* @param dict the dictionary the node array is a part of (for relative offsets).
* @param dictEncoder the dictionary encoder.
* @param ptNodeArray the node array to write.
+ * @param codePointToOneByteCodeMap the map to convert the code points.
*/
@SuppressWarnings("unused")
/* package */ static void writePlacedPtNodeArray(final FusionDictionary dict,
- final DictEncoder dictEncoder, final PtNodeArray ptNodeArray) {
+ final DictEncoder dictEncoder, final PtNodeArray ptNodeArray,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
// TODO: Make the code in common with BinaryDictIOUtils#writePtNode
dictEncoder.setPosition(ptNodeArray.mCachedAddressAfterUpdate);
@@ -727,7 +744,7 @@ public class BinaryDictEncoderUtils {
+ FormatSpec.MAX_TERMINAL_FREQUENCY
+ " : " + ptNode.mProbabilityInfo.toString());
}
- dictEncoder.writePtNode(ptNode, dict);
+ dictEncoder.writePtNode(ptNode, dict, codePointToOneByteCodeMap);
}
if (dictEncoder.getPosition() != ptNodeArray.mCachedAddressAfterUpdate
+ ptNodeArray.mCachedSize) {
@@ -834,12 +851,16 @@ public class BinaryDictEncoderUtils {
// Write out the options.
for (final String key : dict.mOptions.mAttributes.keySet()) {
final String value = dict.mOptions.mAttributes.get(key);
- CharEncoding.writeString(headerBuffer, key);
- CharEncoding.writeString(headerBuffer, value);
+ CharEncoding.writeString(headerBuffer, key, null);
+ CharEncoding.writeString(headerBuffer, value, null);
+ }
+ // Write out the codePointTable if there is codePointOccurrenceArray.
+ if (codePointOccurrenceArray != null) {
+ final String codePointTableString =
+ encodeCodePointTable(codePointOccurrenceArray);
+ CharEncoding.writeString(headerBuffer, DictionaryHeader.CODE_POINT_TABLE_KEY, null);
+ CharEncoding.writeString(headerBuffer, codePointTableString, null);
}
-
- // TODO: Write out the code point table.
-
final int size = headerBuffer.size();
final byte[] bytes = headerBuffer.toByteArray();
// Write out the header size.
@@ -857,10 +878,30 @@ public class BinaryDictEncoderUtils {
final HashMap<Integer, Integer> mCodePointToOneByteCodeMap;
final ArrayList<Entry<Integer, Integer>> mCodePointOccurrenceArray;
+ // Let code point table empty for version 200 dictionary which used in test
+ CodePointTable() {
+ mCodePointToOneByteCodeMap = null;
+ mCodePointOccurrenceArray = null;
+ }
+
CodePointTable(final HashMap<Integer, Integer> codePointToOneByteCodeMap,
final ArrayList<Entry<Integer, Integer>> codePointOccurrenceArray) {
mCodePointToOneByteCodeMap = codePointToOneByteCodeMap;
mCodePointOccurrenceArray = codePointOccurrenceArray;
}
}
+
+ private static String encodeCodePointTable(
+ final ArrayList<Entry<Integer, Integer>> codePointOccurrenceArray) {
+ final StringBuilder codePointTableString = new StringBuilder();
+ int currentCodePointTableIndex = FormatSpec.MINIMAL_ONE_BYTE_CHARACTER_VALUE;
+ for (final Entry<Integer, Integer> entry : codePointOccurrenceArray) {
+ // Native reads the table as a string
+ codePointTableString.appendCodePoint(entry.getKey());
+ if (FormatSpec.MAXIMAL_ONE_BYTE_CHARACTER_VALUE < ++currentCodePointTableIndex) {
+ break;
+ }
+ }
+ return codePointTableString.toString();
+ }
}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java
index 645fd5c02..10dd00325 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java
@@ -21,6 +21,7 @@ import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
import com.android.inputmethod.latin.makedict.FusionDictionary.PtNode;
import java.io.IOException;
+import java.util.HashMap;
/**
* An interface of binary dictionary encoder.
@@ -33,5 +34,6 @@ public interface DictEncoder {
public void setPosition(final int position);
public int getPosition();
public void writePtNodeCount(final int ptNodeCount);
- public void writePtNode(final PtNode ptNode, final FusionDictionary dict);
+ public void writePtNode(final PtNode ptNode, final FusionDictionary dict,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap);
}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java
index 18f4bcf5f..6227f13e1 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java
@@ -177,7 +177,8 @@ public class Ver2DictDecoder extends AbstractDictDecoder {
if (header == null) {
throw new IOException("Cannot read the dictionary header.");
}
- if (header.mFormatOptions.mVersion != FormatSpec.VERSION2) {
+ if (header.mFormatOptions.mVersion != FormatSpec.VERSION2 &&
+ header.mFormatOptions.mVersion != FormatSpec.VERSION201) {
throw new UnsupportedFormatException("File header has a wrong version : "
+ header.mFormatOptions.mVersion);
}
@@ -200,19 +201,19 @@ public class Ver2DictDecoder extends AbstractDictDecoder {
if (0 != (flags & FormatSpec.FLAG_HAS_MULTIPLE_CHARS)) {
int index = 0;
int character = CharEncoding.readChar(mDictBuffer);
- addressPointer += CharEncoding.getCharSize(character);
+ addressPointer += CharEncoding.getCharSize(character, null);
while (FormatSpec.INVALID_CHARACTER != character) {
// FusionDictionary is making sure that the length of the word is smaller than
// MAX_WORD_LENGTH.
// So we'll never write past the end of mCharacterBuffer.
mCharacterBuffer[index++] = character;
character = CharEncoding.readChar(mDictBuffer);
- addressPointer += CharEncoding.getCharSize(character);
+ addressPointer += CharEncoding.getCharSize(character, null);
}
characters = Arrays.copyOfRange(mCharacterBuffer, 0, index);
} else {
final int character = CharEncoding.readChar(mDictBuffer);
- addressPointer += CharEncoding.getCharSize(character);
+ addressPointer += CharEncoding.getCharSize(character, null);
characters = new int[] { character };
}
final ProbabilityInfo probabilityInfo;
diff --git a/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
index c47190190..2c2152be7 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
@@ -124,7 +124,7 @@ public class Ver2DictEncoder implements DictEncoder {
@Override
public void writeDictionary(final FusionDictionary dict, final FormatOptions formatOptions)
throws IOException, UnsupportedFormatException {
- if (formatOptions.mVersion > FormatSpec.VERSION2) {
+ if (formatOptions.mVersion > FormatSpec.VERSION201) {
throw new UnsupportedFormatException(
"The given format options has wrong version number : "
+ formatOptions.mVersion);
@@ -135,7 +135,14 @@ public class Ver2DictEncoder implements DictEncoder {
}
// Make code point conversion table ordered by occurrence of code points
- final CodePointTable codePointTable = makeCodePointTable(dict);
+ // Version 201 or later have codePointTable
+ final CodePointTable codePointTable;
+ if (mCodePointTableMode == CODE_POINT_TABLE_OFF || formatOptions.mVersion
+ < FormatSpec.MINIMUM_SUPPORTED_VERSION_OF_CODE_POINT_TABLE) {
+ codePointTable = new CodePointTable();
+ } else {
+ codePointTable = makeCodePointTable(dict);
+ }
BinaryDictEncoderUtils.writeDictionaryHeader(mOutStream, dict, formatOptions,
codePointTable.mCodePointOccurrenceArray);
@@ -152,7 +159,8 @@ public class Ver2DictEncoder implements DictEncoder {
ArrayList<PtNodeArray> flatNodes = BinaryDictEncoderUtils.flattenTree(dict.mRootNodeArray);
MakedictLog.i("Computing addresses...");
- BinaryDictEncoderUtils.computeAddresses(dict, flatNodes);
+ BinaryDictEncoderUtils.computeAddresses(dict, flatNodes,
+ codePointTable.mCodePointToOneByteCodeMap);
MakedictLog.i("Checking PtNode array...");
if (MakedictLog.DBG) BinaryDictEncoderUtils.checkFlatPtNodeArrayList(flatNodes);
@@ -164,7 +172,8 @@ public class Ver2DictEncoder implements DictEncoder {
MakedictLog.i("Writing file...");
for (PtNodeArray nodeArray : flatNodes) {
- BinaryDictEncoderUtils.writePlacedPtNodeArray(dict, this, nodeArray);
+ BinaryDictEncoderUtils.writePlacedPtNodeArray(dict, this, nodeArray,
+ codePointTable.mCodePointToOneByteCodeMap);
}
if (MakedictLog.DBG) BinaryDictEncoderUtils.showStatistics(flatNodes);
mOutStream.write(mBuffer, 0, mPosition);
@@ -196,15 +205,19 @@ public class Ver2DictEncoder implements DictEncoder {
countSize);
}
- private void writePtNodeFlags(final PtNode ptNode) {
- final int childrenPos = BinaryDictEncoderUtils.getChildrenPosition(ptNode);
+ private void writePtNodeFlags(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ final int childrenPos = BinaryDictEncoderUtils.getChildrenPosition(ptNode,
+ codePointToOneByteCodeMap);
mPosition = BinaryDictEncoderUtils.writeUIntToBuffer(mBuffer, mPosition,
BinaryDictEncoderUtils.makePtNodeFlags(ptNode, childrenPos),
FormatSpec.PTNODE_FLAGS_SIZE);
}
- private void writeCharacters(final int[] codePoints, final boolean hasSeveralChars) {
- mPosition = CharEncoding.writeCharArray(codePoints, mBuffer, mPosition);
+ private void writeCharacters(final int[] codePoints, final boolean hasSeveralChars,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ mPosition = CharEncoding.writeCharArray(codePoints, mBuffer, mPosition,
+ codePointToOneByteCodeMap);
if (hasSeveralChars) {
mBuffer[mPosition++] = FormatSpec.PTNODE_CHARACTERS_TERMINATOR;
}
@@ -217,8 +230,10 @@ public class Ver2DictEncoder implements DictEncoder {
}
}
- private void writeChildrenPosition(final PtNode ptNode) {
- final int childrenPos = BinaryDictEncoderUtils.getChildrenPosition(ptNode);
+ private void writeChildrenPosition(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ final int childrenPos = BinaryDictEncoderUtils.getChildrenPosition(ptNode,
+ codePointToOneByteCodeMap);
mPosition += BinaryDictEncoderUtils.writeChildrenPosition(mBuffer, mPosition,
childrenPos);
}
@@ -228,7 +243,8 @@ public class Ver2DictEncoder implements DictEncoder {
*
* @param shortcuts the shortcut attributes list.
*/
- private void writeShortcuts(final ArrayList<WeightedString> shortcuts) {
+ private void writeShortcuts(final ArrayList<WeightedString> shortcuts,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
if (null == shortcuts || shortcuts.isEmpty()) return;
final int indexOfShortcutByteSize = mPosition;
@@ -241,7 +257,8 @@ public class Ver2DictEncoder implements DictEncoder {
target.getProbability());
mPosition = BinaryDictEncoderUtils.writeUIntToBuffer(mBuffer, mPosition, shortcutFlags,
FormatSpec.PTNODE_ATTRIBUTE_FLAGS_SIZE);
- final int shortcutShift = CharEncoding.writeString(mBuffer, mPosition, target.mWord);
+ final int shortcutShift = CharEncoding.writeString(mBuffer, mPosition, target.mWord,
+ codePointToOneByteCodeMap);
mPosition += shortcutShift;
}
final int shortcutByteSize = mPosition - indexOfShortcutByteSize;
@@ -281,12 +298,14 @@ public class Ver2DictEncoder implements DictEncoder {
}
@Override
- public void writePtNode(final PtNode ptNode, final FusionDictionary dict) {
- writePtNodeFlags(ptNode);
- writeCharacters(ptNode.mChars, ptNode.hasSeveralChars());
+ public void writePtNode(final PtNode ptNode, final FusionDictionary dict,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ writePtNodeFlags(ptNode, codePointToOneByteCodeMap);
+ writeCharacters(ptNode.mChars, ptNode.hasSeveralChars(), codePointToOneByteCodeMap);
writeFrequency(ptNode.getProbability());
- writeChildrenPosition(ptNode);
- writeShortcuts(ptNode.mShortcutTargets);
+ writeChildrenPosition(ptNode, codePointToOneByteCodeMap);
+ // TODO: Use codePointToOneByteCodeMap for shortcuts.
+ writeShortcuts(ptNode.mShortcutTargets, null /* codePointToOneByteCodeMap */);
writeBigrams(ptNode.mBigrams, dict);
}
}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
index 401ffde6d..3262a1623 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
@@ -27,6 +27,7 @@ import com.android.inputmethod.latin.utils.LocaleUtils;
import java.io.File;
import java.io.IOException;
+import java.util.HashMap;
/**
* An implementation of DictEncoder for version 4 binary dictionary.
@@ -142,6 +143,7 @@ public class Ver4DictEncoder implements DictEncoder {
}
@Override
- public void writePtNode(PtNode ptNode, FusionDictionary dict) {
+ public void writePtNode(PtNode ptNode, FusionDictionary dict,
+ HashMap<Integer, Integer> codePointToOneByteCodeMap) {
}
}
diff --git a/tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java b/tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java
new file mode 100644
index 000000000..ca1039bd9
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.touchinputconsumer;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * Tests for GestureConsumer.NULL_GESTURE_CONSUMER.
+ */
+@SmallTest
+public class NullGestureConsumerTests extends AndroidTestCase {
+ /**
+ * Tests that GestureConsumer.NULL_GESTURE_CONSUMER indicates that it won't consume gesture data
+ * and that its methods don't raise exceptions even for invalid data.
+ */
+ public void testNullGestureConsumer() {
+ assertFalse(GestureConsumer.NULL_GESTURE_CONSUMER.willConsume());
+ GestureConsumer.NULL_GESTURE_CONSUMER.onInit(null, null);
+ GestureConsumer.NULL_GESTURE_CONSUMER.onGestureStarted(null, null);
+ GestureConsumer.NULL_GESTURE_CONSUMER.onGestureCanceled();
+ GestureConsumer.NULL_GESTURE_CONSUMER.onGestureCompleted(null);
+ GestureConsumer.NULL_GESTURE_CONSUMER.onImeSuggestionsProcessed(null, -1, -1);
+ }
+
+ /**
+ * Tests that newInstance returns NULL_GESTURE_CONSUMER for invalid input.
+ */
+ public void testNewInstanceGivesNullGestureConsumerForInvalidInputs() {
+ assertSame(GestureConsumer.NULL_GESTURE_CONSUMER,
+ GestureConsumer.newInstance(null, null, null, null));
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
new file mode 100644
index 000000000..76e28288f
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.utils;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+
+/**
+ * Tests for {@link CollectionUtils}.
+ */
+@SmallTest
+public class CollectionUtilsTests extends AndroidTestCase {
+ /**
+ * Tests that {@link CollectionUtils#arrayAsList(E[],int,int)} gives the expected
+ * results for a few valid inputs.
+ */
+ public void testArrayAsList() {
+ final String[] array = { "0", "1", "2", "3", "4" };
+ final ArrayList<String> empty = new ArrayList<>();
+ assertEquals(empty, CollectionUtils.arrayAsList(array, 0, 0));
+ assertEquals(empty, CollectionUtils.arrayAsList(array, 1, 1));
+ final ArrayList<String> expected123 = new ArrayList<>(Arrays.asList("1", "2", "3"));
+ assertEquals(expected123, CollectionUtils.arrayAsList(array, 1, 4));
+ }
+
+ /**
+ * Tests that {@link CollectionUtils#isEmpty(java.util.Collection)} gives the expected
+ * results for a few cases.
+ */
+ public void testIsNullOrEmpty() {
+ assertTrue(CollectionUtils.isNullOrEmpty(null));
+ assertTrue(CollectionUtils.isNullOrEmpty(new ArrayList()));
+ assertTrue(CollectionUtils.isNullOrEmpty(Collections.EMPTY_SET));
+ assertFalse(CollectionUtils.isNullOrEmpty(Collections.singleton("Not empty")));
+ }
+
+}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
index 44f9695cf..5dfb7bf11 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
@@ -158,7 +158,7 @@ public class DictionaryMaker {
String outputBinary = null;
String outputXml = null;
String outputCombined = null;
- int outputBinaryFormatVersion = 2; // the default version is 2.
+ int outputBinaryFormatVersion = FormatSpec.VERSION201; // the default version is 201.
// Don't use code point table by default.
int codePointTableMode = Ver2DictEncoder.CODE_POINT_TABLE_OFF;