aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/dicttool/Android.mk8
-rw-r--r--tools/dicttool/NativeLib.mk3
-rw-r--r--tools/dicttool/compat/android/content/Context.java20
-rw-r--r--tools/dicttool/compat/android/test/AndroidTestCase.java8
-rw-r--r--tools/dicttool/compat/android/util/SparseArray.java6
-rw-r--r--tools/dicttool/compat/android/util/SparseIntArray.java2
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/event/CombinerChain.java20
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java5
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java12
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java2
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java3
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java3
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java36
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java8
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java4
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java2
-rw-r--r--tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl10
-rw-r--r--tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml2
-rw-r--r--tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml24
-rw-r--r--tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml2
-rw-r--r--tools/make-keyboard-text/res/values-mr-rIN/donottranslate-more-keys.xml60
-rw-r--r--tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml24
-rw-r--r--tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java2
-rw-r--r--tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java2
-rw-r--r--tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java2
-rw-r--r--tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java7
-rw-r--r--tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java4
27 files changed, 199 insertions, 82 deletions
diff --git a/tools/dicttool/Android.mk b/tools/dicttool/Android.mk
index e12d7e0b5..ce51df1eb 100644
--- a/tools/dicttool/Android.mk
+++ b/tools/dicttool/Android.mk
@@ -15,7 +15,9 @@
# HACK: Temporarily disable host tool build on Mac until the build system is ready for C++11.
LATINIME_HOST_OSNAME := $(shell uname -s)
-ifneq ($(LATINIME_HOST_OSNAME), Darwin) # TODO: Remove this
+ifeq ($(LATINIME_HOST_OSNAME), Darwin) # TODO: Remove this
+$(warning dicttool_aosp is not supported on $(LATINIME_HOST_OSNAME))
+else # TODO: Remove this
LATINIME_DICTTOOL_AOSP_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)
@@ -44,11 +46,11 @@ LATINIME_SRC_FILES_FOR_DICTTOOL := \
latin/InputPointers.java \
latin/LastComposedWord.java \
latin/LatinImeLogger.java \
+ latin/PrevWordsInfo.java \
latin/SuggestedWords.java \
latin/WordComposer.java \
latin/settings/NativeSuggestOptions.java \
latin/utils/BinaryDictionaryUtils.java \
- latin/utils/CollectionUtils.java \
latin/utils/CombinedFormatUtils.java \
latin/utils/CoordinateUtils.java \
latin/utils/FileUtils.java \
@@ -82,7 +84,7 @@ LOCAL_SRC_FILES := $(LOCAL_TOOL_SRC_FILES) \
$(call all-java-files-under, $(DICTTOOL_ONDEVICE_TESTS_DIRECTORY))
LOCAL_JAVA_LIBRARIES := junit
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LATINIME_HOST_NATIVE_LIBNAME)
+LOCAL_REQUIRED_MODULES := $(LATINIME_HOST_NATIVE_LIBNAME)
LOCAL_JAR_MANIFEST := etc/manifest.txt
LOCAL_MODULE := dicttool_aosp
diff --git a/tools/dicttool/NativeLib.mk b/tools/dicttool/NativeLib.mk
index 74034482b..028025d91 100644
--- a/tools/dicttool/NativeLib.mk
+++ b/tools/dicttool/NativeLib.mk
@@ -30,6 +30,9 @@ ifeq ($(FLAG_DBG), true)
endif #FLAG_DBG
LOCAL_CFLAGS += -DHOST_TOOL -fPIC -Wno-deprecated -Wno-unused-parameter -Wno-unused-function
+ifneq ($(strip $(HOST_JDK_IS_64BIT_VERSION)),)
+LOCAL_MULTILIB := 64
+endif #HOST_JDK_IS_64BIT_VERSION
LOCAL_CLANG := true
# For C++11
diff --git a/tools/dicttool/compat/android/content/Context.java b/tools/dicttool/compat/android/content/Context.java
new file mode 100644
index 000000000..afe1322ac
--- /dev/null
+++ b/tools/dicttool/compat/android/content/Context.java
@@ -0,0 +1,20 @@
+/*
+ * 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 android.content;
+
+public class Context {
+}
diff --git a/tools/dicttool/compat/android/test/AndroidTestCase.java b/tools/dicttool/compat/android/test/AndroidTestCase.java
index d01b7ad7c..f765ce0fc 100644
--- a/tools/dicttool/compat/android/test/AndroidTestCase.java
+++ b/tools/dicttool/compat/android/test/AndroidTestCase.java
@@ -16,6 +16,8 @@
package android.test;
+import com.android.inputmethod.latin.dicttool.Test;
+
import junit.framework.TestCase;
import java.io.File;
@@ -27,7 +29,11 @@ import java.io.File;
*/
public class AndroidTestCase extends TestCase {
public File getCacheDir() {
- return new File(".");
+ final File dir = Test.TEST_TMP_DIR;
+ if (!dir.isDirectory()) {
+ dir.mkdirs();
+ }
+ return dir;
}
public AndroidTestCase getContext() {
return this;
diff --git a/tools/dicttool/compat/android/util/SparseArray.java b/tools/dicttool/compat/android/util/SparseArray.java
index 6c76f19f4..9efbd39c7 100644
--- a/tools/dicttool/compat/android/util/SparseArray.java
+++ b/tools/dicttool/compat/android/util/SparseArray.java
@@ -16,8 +16,6 @@
package android.util;
-import com.android.inputmethod.latin.utils.CollectionUtils;
-
import java.util.ArrayList;
import java.util.Collections;
@@ -30,8 +28,8 @@ public class SparseArray<E> {
}
public SparseArray(final int initialCapacity) {
- mKeys = CollectionUtils.newArrayList(initialCapacity);
- mValues = CollectionUtils.newArrayList(initialCapacity);
+ mKeys = new ArrayList<>(initialCapacity);
+ mValues = new ArrayList<>(initialCapacity);
}
public int size() {
diff --git a/tools/dicttool/compat/android/util/SparseIntArray.java b/tools/dicttool/compat/android/util/SparseIntArray.java
index ac8a04ceb..e4d3dfd07 100644
--- a/tools/dicttool/compat/android/util/SparseIntArray.java
+++ b/tools/dicttool/compat/android/util/SparseIntArray.java
@@ -24,7 +24,7 @@ public class SparseIntArray {
}
public SparseIntArray(final int initialCapacity) {
- mArray = new SparseArray<Integer>(initialCapacity);
+ mArray = new SparseArray<>(initialCapacity);
}
public int size() {
diff --git a/tools/dicttool/compat/com/android/inputmethod/event/CombinerChain.java b/tools/dicttool/compat/com/android/inputmethod/event/CombinerChain.java
index b68df1ce7..458f22c45 100644
--- a/tools/dicttool/compat/com/android/inputmethod/event/CombinerChain.java
+++ b/tools/dicttool/compat/com/android/inputmethod/event/CombinerChain.java
@@ -16,13 +16,20 @@
package com.android.inputmethod.event;
-import com.android.inputmethod.latin.utils.CollectionUtils;
-
import java.util.ArrayList;
+/**
+ * Compatibility class that stands in for the combiner chain in LatinIME.
+ *
+ * This is not used by dicttool, it's just needed by the dependency chain.
+ */
+// TODO: there should not be a dependency to this in dicttool, so there
+// should be a sensible way to separate them cleanly.
public class CombinerChain {
- private StringBuilder mComposingWord = new StringBuilder();
- public CombinerChain(final Combiner... combinerList) {}
+ private StringBuilder mComposingWord;
+ public CombinerChain(final String initialText, final Combiner... combinerList) {
+ mComposingWord = new StringBuilder(initialText);
+ }
public void processEvent(final ArrayList<Event> previousEvents, final Event newEvent) {
mComposingWord.append(newEvent.getTextToCommit());
@@ -35,4 +42,9 @@ public class CombinerChain {
public void reset() {
mComposingWord.setLength(0);
}
+
+ public static Combiner[] createCombiners(final String spec) {
+ // Dicttool never uses a combiner at all, so we just return a zero-sized array.
+ return new Combiner[0];
+ }
}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
index f9771c8dd..2cbc04154 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
@@ -19,15 +19,14 @@ package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.DictDecoder;
-import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
import org.xml.sax.SAXException;
-import java.io.File;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -54,7 +53,7 @@ public final class BinaryDictOffdeviceUtils {
private final static int MAX_DECODE_DEPTH = 8;
public static class DecoderChainSpec {
- ArrayList<String> mDecoderSpec = new ArrayList<String>();
+ ArrayList<String> mDecoderSpec = new ArrayList<>();
File mFile;
public DecoderChainSpec addStep(final String stepDescription) {
mDecoderSpec.add(stepDescription);
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java
index 391328fda..6a0e1b7f0 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java
@@ -98,7 +98,7 @@ public class CombinedInputOutput {
headerLine = reader.readLine();
}
final String header[] = headerLine.split(",");
- final HashMap<String, String> attributes = new HashMap<String, String>();
+ final HashMap<String, String> attributes = new HashMap<>();
for (String item : header) {
final String keyValue[] = item.split("=");
if (2 != keyValue.length) {
@@ -115,8 +115,8 @@ public class CombinedInputOutput {
String word = null;
ProbabilityInfo probabilityInfo = new ProbabilityInfo(0);
boolean isNotAWord = false;
- ArrayList<WeightedString> bigrams = new ArrayList<WeightedString>();
- ArrayList<WeightedString> shortcuts = new ArrayList<WeightedString>();
+ ArrayList<WeightedString> bigrams = new ArrayList<>();
+ ArrayList<WeightedString> shortcuts = new ArrayList<>();
while (null != (line = reader.readLine())) {
if (line.startsWith(COMMENT_LINE_STARTER)) continue;
final String args[] = line.trim().split(",");
@@ -128,8 +128,8 @@ public class CombinedInputOutput {
dict.setBigram(word, s.mWord, s.mProbabilityInfo);
}
}
- if (!shortcuts.isEmpty()) shortcuts = new ArrayList<WeightedString>();
- if (!bigrams.isEmpty()) bigrams = new ArrayList<WeightedString>();
+ if (!shortcuts.isEmpty()) shortcuts = new ArrayList<>();
+ if (!bigrams.isEmpty()) bigrams = new ArrayList<>();
isNotAWord = false;
for (String param : args) {
final String params[] = param.split("=", 2);
@@ -223,7 +223,7 @@ public class CombinedInputOutput {
*/
public static void writeDictionaryCombined(
final Writer destination, final FusionDictionary dict) throws IOException {
- final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<WordProperty>();
+ final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<>();
for (final WordProperty wordProperty : dict) {
// This for ordering by frequency, then by asciibetic order
wordPropertiesInDict.add(wordProperty);
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 8e8ab19e0..37c8d4184 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
@@ -138,7 +138,7 @@ public class DictionaryMaker {
}
public Arguments(String[] argsArray) throws IOException {
- final LinkedList<String> args = new LinkedList<String>(Arrays.asList(argsArray));
+ final LinkedList<String> args = new LinkedList<>(Arrays.asList(argsArray));
if (args.isEmpty()) {
displayHelp();
}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java
index cacee5268..8ae035f64 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java
@@ -29,8 +29,7 @@ public class Dicttool {
abstract public String getHelp();
abstract public void run() throws Exception;
}
- static HashMap<String, Class<? extends Command>> sCommands =
- new HashMap<String, Class<? extends Command>>();
+ static HashMap<String, Class<? extends Command>> sCommands = new HashMap<>();
static {
CommandList.populate();
}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java
index cd3d4d393..94d1ae8bb 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java
@@ -85,8 +85,7 @@ public class Diff extends Dicttool.Command {
private static void diffHeaders(final FusionDictionary dict0, final FusionDictionary dict1) {
boolean hasDifferences = false;
- final HashMap<String, String> options1 =
- new HashMap<String, String>(dict1.mOptions.mAttributes);
+ final HashMap<String, String> options1 = new HashMap<>(dict1.mOptions.mAttributes);
for (final String optionKey : dict0.mOptions.mAttributes.keySet()) {
if (!dict0.mOptions.mAttributes.get(optionKey).equals(
dict1.mOptions.mAttributes.get(optionKey))) {
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java
index 48817b1b1..b6383d788 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java
@@ -19,16 +19,29 @@ package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderEncoderTests;
import com.android.inputmethod.latin.makedict.BinaryDictEncoderFlattenTreeTests;
import com.android.inputmethod.latin.makedict.FusionDictionaryTest;
+import com.android.inputmethod.latin.utils.FileUtils;
+import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.nio.file.Files;
import java.util.ArrayList;
/**
* Dicttool command implementing self-tests.
*/
public class Test extends Dicttool.Command {
+ private static final String getTmpDir() {
+ try {
+ return Files.createTempDirectory("dicttool").toString();
+ } catch (IOException e) {
+ throw new RuntimeException("Can't get temporary directory", e);
+ }
+ }
+ private static final String TEST_TMP_DIR_BASE = getTmpDir();
+ public static final File TEST_TMP_DIR = new File(TEST_TMP_DIR_BASE);
public static final String COMMAND = "test";
private static final int DEFAULT_MAX_UNIGRAMS = 1500;
private long mSeed = System.currentTimeMillis();
@@ -40,8 +53,8 @@ public class Test extends Dicttool.Command {
BinaryDictDecoderEncoderTests.class,
BinaryDictEncoderFlattenTreeTests.class,
};
- private ArrayList<Method> mAllTestMethods = new ArrayList<Method>();
- private ArrayList<String> mUsedTestMethods = new ArrayList<String>();
+ private ArrayList<Method> mAllTestMethods = new ArrayList<>();
+ private ArrayList<String> mUsedTestMethods = new ArrayList<>();
public Test() {
for (final Class<?> c : sClassesToTest) {
@@ -56,8 +69,12 @@ public class Test extends Dicttool.Command {
@Override
public String getHelp() {
- final StringBuilder s = new StringBuilder("test [-s seed] [-m maxUnigrams] [testName...]\n"
- + "If seed is not specified, the current time is used.\nTest list is:\n");
+ final StringBuilder s = new StringBuilder(
+ "test [-s seed] [-m maxUnigrams] [-n] [testName...]\n"
+ + "If seed is not specified, the current time is used.\n"
+ + "If -n option is provided, do not delete temporary files in "
+ + TEST_TMP_DIR_BASE + "/*.\n"
+ + "Test list is:\n");
for (final Method m : mAllTestMethods) {
s.append(" ");
s.append(m.getName());
@@ -70,17 +87,26 @@ public class Test extends Dicttool.Command {
public void run() throws IllegalAccessException, InstantiationException,
InvocationTargetException {
int i = 0;
+ boolean deleteTmpDir = true;
while (i < mArgs.length) {
final String arg = mArgs[i++];
if ("-s".equals(arg)) {
mSeed = Long.parseLong(mArgs[i++]);
} else if ("-m".equals(arg)) {
mMaxUnigrams = Integer.parseInt(mArgs[i++]);
+ } else if ("-n".equals(arg)) {
+ deleteTmpDir = false;
} else {
mUsedTestMethods.add(arg);
}
}
- runChosenTests();
+ try {
+ runChosenTests();
+ } finally {
+ if (deleteTmpDir) {
+ FileUtils.deleteRecursively(TEST_TMP_DIR);
+ }
+ }
}
private void runChosenTests() throws IllegalAccessException, InstantiationException,
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java
index 17e77dca1..7435fa7d6 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java
@@ -115,7 +115,7 @@ public class XmlDictInputOutput {
}
}
} else if (ROOT_TAG.equals(localName)) {
- final HashMap<String, String> attributes = new HashMap<String, String>();
+ final HashMap<String, String> attributes = new HashMap<>();
for (int attrIndex = 0; attrIndex < attrs.getLength(); ++attrIndex) {
final String attrName = attrs.getLocalName(attrIndex);
attributes.put(attrName, attrs.getValue(attrIndex));
@@ -172,7 +172,7 @@ public class XmlDictInputOutput {
DST_ATTRIBUTE = dstAttribute;
DST_FREQ = dstFreq;
mSrc = null;
- mAssocMap = new HashMap<String, ArrayList<WeightedString>>();
+ mAssocMap = new HashMap<>();
}
@Override
@@ -184,7 +184,7 @@ public class XmlDictInputOutput {
int freq = getValueFromFreqString(attrs.getValue(uri, DST_FREQ));
WeightedString bigram = new WeightedString(dst, freq / XML_TO_MEMORY_RATIO);
ArrayList<WeightedString> bigramList = mAssocMap.get(mSrc);
- if (null == bigramList) bigramList = new ArrayList<WeightedString>();
+ if (null == bigramList) bigramList = new ArrayList<>();
bigramList.add(bigram);
mAssocMap.put(mSrc, bigramList);
}
@@ -352,7 +352,7 @@ public class XmlDictInputOutput {
*/
public static void writeDictionaryXml(Writer destination, FusionDictionary dict)
throws IOException {
- final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<WordProperty>();
+ final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<>();
for (WordProperty wordProperty : dict) {
wordPropertiesInDict.add(wordProperty);
}
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
index 4f1273bdc..fccb654b0 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
@@ -16,12 +16,10 @@
package com.android.inputmethod.latin.dicttool;
-import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.DictDecoder;
import com.android.inputmethod.latin.makedict.DictEncoder;
import com.android.inputmethod.latin.makedict.DictionaryHeader;
-import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.makedict.FormatSpec.DictionaryOptions;
import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
import com.android.inputmethod.latin.makedict.FusionDictionary;
@@ -32,8 +30,8 @@ import com.android.inputmethod.latin.makedict.Ver2DictEncoder;
import junit.framework.TestCase;
-import java.io.File;
import java.io.BufferedOutputStream;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
index 6e81c3f3a..71f8ac8d4 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
@@ -32,7 +32,7 @@ import java.util.Random;
* Unit tests for FusionDictionary.
*/
public class FusionDictionaryTest extends TestCase {
- private static final ArrayList<String> sWords = new ArrayList<String>();
+ private static final ArrayList<String> sWords = new ArrayList<>();
private static final int MAX_UNIGRAMS = 1000;
private void prepare(final long seed) {
diff --git a/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl b/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl
index 2b5494fa5..6a7469ccb 100644
--- a/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl
+++ b/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl
@@ -16,8 +16,6 @@
package com.android.inputmethod.keyboard.internal;
-import com.android.inputmethod.latin.utils.CollectionUtils;
-
import java.util.HashMap;
import java.util.Locale;
@@ -44,14 +42,12 @@ import java.util.Locale;
*/
public final class KeyboardTextsTable {
// Name to index map.
- private static final HashMap<String, Integer> sNameToIndexesMap = CollectionUtils.newHashMap();
+ private static final HashMap<String, Integer> sNameToIndexesMap = new HashMap<>();
// Locale to texts table map.
- private static final HashMap<String, String[]> sLocaleToTextsTableMap =
- CollectionUtils.newHashMap();
+ private static final HashMap<String, String[]> sLocaleToTextsTableMap = new HashMap<>();
// TODO: Remove this variable after debugging.
// Texts table to locale maps.
- private static final HashMap<String[], String> sTextsTableToLocaleMap =
- CollectionUtils.newHashMap();
+ private static final HashMap<String[], String> sTextsTableToLocaleMap = new HashMap<>();
public static String getText(final String name, final String[] textsTable) {
final Integer indexObj = sNameToIndexesMap.get(name);
diff --git a/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml
index 4ecb10533..ab78f45c6 100644
--- a/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml
+++ b/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml
@@ -80,7 +80,7 @@
U+061B: "؛" ARABIC SEMICOLON -->
<string name="keyspec_tablet_comma">"&#x060C;"</string>
<string name="keyhintlabel_tablet_comma">"&#x061F;"</string>
- <string name="morekeys_tablet_comma">"!fixedColumnOrder!4,:,!,&#x061F;,&#x061B;,-,/,\",\'"</string>
+ <string name="morekeys_tablet_comma">"!fixedColumnOrder!4,:,!,&#x061F;,&#x061B;,-,\",\'"</string>
<!-- U+266A: "♪" EIGHTH NOTE -->
<string name="morekeys_bullet">&#x266A;</string>
<!-- U+2605: "★" BLACK STAR
diff --git a/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml
index 7998bf161..c22edbaae 100644
--- a/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml
+++ b/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml
@@ -27,33 +27,33 @@
U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
U+0101: "ā" LATIN SMALL LETTER A WITH MACRON -->
<string name="morekeys_a">&#x00E0;,&#x00E1;,&#x00E2;,&#x00E4;,&#x00E6;,&#x00E3;,&#x00E5;,&#x0101;</string>
- <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
U+0113: "ē" LATIN SMALL LETTER E WITH MACRON -->
- <string name="morekeys_e">&#x00E8;,&#x00E9;,&#x00EA;,&#x00EB;,&#x0113;</string>
- <!-- U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ <string name="morekeys_e">&#x00E9;,&#x00E8;,&#x00EA;,&#x00EB;,&#x0113;</string>
+ <!-- U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
- U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE -->
- <string name="morekeys_i">&#x00EE;,&#x00EF;,&#x00ED;,&#x012B;,&#x00EC;</string>
- <!-- U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ <string name="morekeys_i">&#x00ED;,&#x00EE;,&#x00EF;,&#x012B;,&#x00EC;</string>
+ <!-- U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
- U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
U+0153: "œ" LATIN SMALL LIGATURE OE
U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE -->
- <string name="morekeys_o">&#x00F4;,&#x00F6;,&#x00F2;,&#x00F3;,&#x0153;,&#x00F8;,&#x014D;,&#x00F5;</string>
- <!-- U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ <string name="morekeys_o">&#x00F3;,&#x00F4;,&#x00F6;,&#x00F2;,&#x0153;,&#x00F8;,&#x014D;,&#x00F5;</string>
+ <!-- U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
- U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
U+016B: "ū" LATIN SMALL LETTER U WITH MACRON -->
- <string name="morekeys_u">&#x00FB;,&#x00FC;,&#x00F9;,&#x00FA;,&#x016B;</string>
+ <string name="morekeys_u">&#x00FA;,&#x00FB;,&#x00FC;,&#x00F9;,&#x016B;</string>
<!-- U+00DF: "ß" LATIN SMALL LETTER SHARP S -->
<string name="morekeys_s">&#x00DF;</string>
<!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
diff --git a/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml
index bdbc92afa..58f455504 100644
--- a/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml
+++ b/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml
@@ -82,7 +82,7 @@
U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -->
<string name="keyspec_tablet_comma">"&#x060C;"</string>
<string name="keyhintlabel_tablet_comma">"&#x061F;"</string>
- <string name="morekeys_tablet_comma">"!fixedColumnOrder!4,:,!,&#x061F;,&#x061B;,-,/,!text/keyspec_left_double_angle_quote,!text/keyspec_right_double_angle_quote"</string>
+ <string name="morekeys_tablet_comma">"!fixedColumnOrder!4,:,!,&#x061F;,&#x061B;,-,!text/keyspec_left_double_angle_quote,!text/keyspec_right_double_angle_quote"</string>
<!-- U+FDFC: "﷼" RIAL SIGN -->
<string name="keyspec_currency">&#xFDFC;</string>
<!-- U+266A: "♪" EIGHTH NOTE -->
diff --git a/tools/make-keyboard-text/res/values-mr-rIN/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-mr-rIN/donottranslate-more-keys.xml
new file mode 100644
index 000000000..19db16da1
--- /dev/null
+++ b/tools/make-keyboard-text/res/values-mr-rIN/donottranslate-more-keys.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Label for "switch to alphabetic" key.
+ U+0915: "क" DEVANAGARI LETTER KA
+ U+0916: "ख" DEVANAGARI LETTER KHA
+ U+0917: "ग" DEVANAGARI LETTER GA -->
+ <string name="keylabel_to_alpha">&#x0915;&#x0916;&#x0917;</string>
+ <!-- U+0967: "१" DEVANAGARI DIGIT ONE -->
+ <string name="keyspec_symbols_1">&#x0967;</string>
+ <!-- U+0968: "२" DEVANAGARI DIGIT TWO -->
+ <string name="keyspec_symbols_2">&#x0968;</string>
+ <!-- U+0969: "३" DEVANAGARI DIGIT THREE -->
+ <string name="keyspec_symbols_3">&#x0969;</string>
+ <!-- U+096A: "४" DEVANAGARI DIGIT FOUR -->
+ <string name="keyspec_symbols_4">&#x096A;</string>
+ <!-- U+096B: "५" DEVANAGARI DIGIT FIVE -->
+ <string name="keyspec_symbols_5">&#x096B;</string>
+ <!-- U+096C: "६" DEVANAGARI DIGIT SIX -->
+ <string name="keyspec_symbols_6">&#x096C;</string>
+ <!-- U+096D: "७" DEVANAGARI DIGIT SEVEN -->
+ <string name="keyspec_symbols_7">&#x096D;</string>
+ <!-- U+096E: "८" DEVANAGARI DIGIT EIGHT -->
+ <string name="keyspec_symbols_8">&#x096E;</string>
+ <!-- U+096F: "९" DEVANAGARI DIGIT NINE -->
+ <string name="keyspec_symbols_9">&#x096F;</string>
+ <!-- U+0966: "०" DEVANAGARI DIGIT ZERO -->
+ <string name="keyspec_symbols_0">&#x0966;</string>
+ <!-- Label for "switch to symbols" key. -->
+ <string name="keylabel_to_symbol">?&#x0967;&#x0968;&#x0969;</string>
+ <string name="additional_morekeys_symbols_1">1</string>
+ <string name="additional_morekeys_symbols_2">2</string>
+ <string name="additional_morekeys_symbols_3">3</string>
+ <string name="additional_morekeys_symbols_4">4</string>
+ <string name="additional_morekeys_symbols_5">5</string>
+ <string name="additional_morekeys_symbols_6">6</string>
+ <string name="additional_morekeys_symbols_7">7</string>
+ <string name="additional_morekeys_symbols_8">8</string>
+ <string name="additional_morekeys_symbols_9">9</string>
+ <string name="additional_morekeys_symbols_0">0</string>
+ <!-- U+20B9: "₹" INDIAN RUPEE SIGN -->
+ <string name="keyspec_currency">&#x20B9;</string>
+</resources>
diff --git a/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml
index f9150f366..2c5df0c81 100644
--- a/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml
+++ b/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml
@@ -28,33 +28,33 @@
U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
U+0101: "ā" LATIN SMALL LETTER A WITH MACRON -->
<string name="morekeys_a">&#x00E0;,&#x00E1;,&#x00E2;,&#x00E4;,&#x00E6;,&#x00E3;,&#x00E5;,&#x0101;</string>
- <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
U+0113: "ē" LATIN SMALL LETTER E WITH MACRON -->
- <string name="morekeys_e">&#x00E8;,&#x00E9;,&#x00EA;,&#x00EB;,&#x0113;</string>
- <!-- U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ <string name="morekeys_e">&#x00E9;,&#x00E8;,&#x00EA;,&#x00EB;,&#x0113;</string>
+ <!-- U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
- U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE -->
- <string name="morekeys_i">&#x00EE;,&#x00EF;,&#x00ED;,&#x012B;,&#x00EC;</string>
- <!-- U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ <string name="morekeys_i">&#x00ED;,&#x00EE;,&#x00EF;,&#x012B;,&#x00EC;</string>
+ <!-- U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
- U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
U+0153: "œ" LATIN SMALL LIGATURE OE
U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE -->
- <string name="morekeys_o">&#x00F4;,&#x00F6;,&#x00F2;,&#x00F3;,&#x0153;,&#x00F8;,&#x014D;,&#x00F5;</string>
- <!-- U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ <string name="morekeys_o">&#x00F3;,&#x00F4;,&#x00F6;,&#x00F2;,&#x0153;,&#x00F8;,&#x014D;,&#x00F5;</string>
+ <!-- U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
- U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
U+016B: "ū" LATIN SMALL LETTER U WITH MACRON -->
- <string name="morekeys_u">&#x00FB;,&#x00FC;,&#x00F9;,&#x00FA;,&#x016B;</string>
+ <string name="morekeys_u">&#x00FA;,&#x00FB;,&#x00FC;,&#x00F9;,&#x016B;</string>
<!-- U+00DF: "ß" LATIN SMALL LETTER SHARP S -->
<string name="morekeys_s">&#x00DF;</string>
<!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java
index c947a63bf..abb33397b 100644
--- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java
+++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java
@@ -61,7 +61,7 @@ public final class JarUtils {
}
public static ArrayList<String> getEntryNameListing(final JarFile jar, final JarFilter filter) {
- final ArrayList<String> result = new ArrayList<String>();
+ final ArrayList<String> result = new ArrayList<>();
final Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElement();
diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java
index 0dfa37667..c1a7ec5eb 100644
--- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java
+++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java
@@ -35,7 +35,7 @@ public final class LocaleUtils {
// Intentional empty constructor for utility class.
}
- private static final HashMap<String, Locale> sLocaleCache = new HashMap<String, Locale>();
+ private static final HashMap<String, Locale> sLocaleCache = new HashMap<>();
private static final int INDEX_LANGUAGE = 0;
private static final int INDEX_SCRIPT = 1;
diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java
index 36a03f8dc..6c15ce6bf 100644
--- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java
+++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java
@@ -36,7 +36,7 @@ public class MakeKeyboardText {
}
public Options(final String[] argsArray) {
- final LinkedList<String> args = new LinkedList<String>(Arrays.asList(argsArray));
+ final LinkedList<String> args = new LinkedList<>(Arrays.asList(argsArray));
String arg = null;
String java = null;
try {
diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java
index c8cb4acec..563acc57e 100644
--- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java
+++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java
@@ -43,12 +43,11 @@ public class MoreKeysResources {
private final JarFile mJar;
// String resources maps sorted by its language. The language is determined from the jar entry
// name by calling {@link JarUtils#getLocaleFromEntryName(String)}.
- private final TreeMap<String, StringResourceMap> mResourcesMap =
- new TreeMap<String, StringResourceMap>();
+ private final TreeMap<String, StringResourceMap> mResourcesMap = new TreeMap<>();
// Default string resources map.
private final StringResourceMap mDefaultResourceMap;
// Histogram of string resource names. This is used to sort {@link #mSortedResourceNames}.
- private final HashMap<String, Integer> mNameHistogram = new HashMap<String, Integer>();
+ private final HashMap<String, Integer> mNameHistogram = new HashMap<>();
// Sorted string resource names array; Descending order of histogram count.
// The string resource name is specified as an attribute "name" in string resource files.
// The string resource can be accessed by specifying name "!text/<name>"
@@ -68,7 +67,7 @@ public class MoreKeysResources {
// Initialize name histogram and names list.
final HashMap<String, Integer> nameHistogram = mNameHistogram;
- final ArrayList<String> resourceNamesList = new ArrayList<String>();
+ final ArrayList<String> resourceNamesList = new ArrayList<>();
for (final StringResource res : mDefaultResourceMap.getResources()) {
nameHistogram.put(res.mName, 0); // Initialize histogram value.
resourceNamesList.add(res.mName);
diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java
index 6a79268e5..cf44f2cad 100644
--- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java
+++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java
@@ -73,7 +73,7 @@ public class StringResourceMap {
}
mResources = Collections.unmodifiableList(handler.mResources);
- final HashMap<String,StringResource> map = new HashMap<String,StringResource>();
+ final HashMap<String, StringResource> map = new HashMap<>();
for (final StringResource res : mResources) {
map.put(res.mName, res);
}
@@ -105,7 +105,7 @@ public class StringResourceMap {
private static final String TAG_STRING = "string";
private static final String ATTR_NAME = "name";
- final ArrayList<StringResource> mResources = new ArrayList<StringResource>();
+ final ArrayList<StringResource> mResources = new ArrayList<>();
private String mName;
private final StringBuilder mValue = new StringBuilder();