diff options
Diffstat (limited to '')
-rw-r--r-- | common/Android.mk | 26 | ||||
-rw-r--r-- | common/src/com/android/inputmethod/annotations/ExternallyReferenced.java (renamed from java/src/com/android/inputmethod/annotations/ExternallyReferenced.java) | 0 | ||||
-rw-r--r-- | common/src/com/android/inputmethod/annotations/UsedForTesting.java (renamed from java/src/com/android/inputmethod/annotations/UsedForTesting.java) | 0 | ||||
-rw-r--r-- | common/src/com/android/inputmethod/latin/common/CodePointUtils.java (renamed from tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java) | 8 | ||||
-rw-r--r-- | common/src/com/android/inputmethod/latin/common/Constants.java (renamed from java/src/com/android/inputmethod/latin/Constants.java) | 35 |
5 files changed, 59 insertions, 10 deletions
diff --git a/common/Android.mk b/common/Android.mk new file mode 100644 index 000000000..99aed4c5d --- /dev/null +++ b/common/Android.mk @@ -0,0 +1,26 @@ +# 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. + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) +LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_MODULE := latinime-common +LOCAL_SDK_VERSION := 21 +include $(BUILD_STATIC_JAVA_LIBRARY) + +# Also build a host side library +include $(CLEAR_VARS) +LOCAL_MODULE := latinime-common-host +LOCAL_SRC_FILES := $(call all-java-files-under, src) +include $(BUILD_HOST_JAVA_LIBRARY) diff --git a/java/src/com/android/inputmethod/annotations/ExternallyReferenced.java b/common/src/com/android/inputmethod/annotations/ExternallyReferenced.java index ea5f12ce2..ea5f12ce2 100644 --- a/java/src/com/android/inputmethod/annotations/ExternallyReferenced.java +++ b/common/src/com/android/inputmethod/annotations/ExternallyReferenced.java diff --git a/java/src/com/android/inputmethod/annotations/UsedForTesting.java b/common/src/com/android/inputmethod/annotations/UsedForTesting.java index 2ada091e4..2ada091e4 100644 --- a/java/src/com/android/inputmethod/annotations/UsedForTesting.java +++ b/common/src/com/android/inputmethod/annotations/UsedForTesting.java diff --git a/tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java b/common/src/com/android/inputmethod/latin/common/CodePointUtils.java index a270ee774..592da5c1f 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java +++ b/common/src/com/android/inputmethod/latin/common/CodePointUtils.java @@ -14,11 +14,15 @@ * limitations under the License. */ -package com.android.inputmethod.latin.makedict; +package com.android.inputmethod.latin.common; + +import com.android.inputmethod.annotations.UsedForTesting; import java.util.Random; // Utility methods related with code points used for tests. +// TODO: Figure out where this class should be. +@UsedForTesting public class CodePointUtils { private CodePointUtils() { // This utility class is not publicly instantiable. @@ -60,6 +64,7 @@ public class CodePointUtils { 0x00FF /* LATIN SMALL LETTER Y WITH DIAERESIS */ }; + @UsedForTesting public static int[] generateCodePointSet(final int codePointSetSize, final Random random) { final int[] codePointSet = new int[codePointSetSize]; for (int i = codePointSet.length - 1; i >= 0; ) { @@ -80,6 +85,7 @@ public class CodePointUtils { /** * Generates a random word. */ + @UsedForTesting public static String generateWord(final Random random, final int[] codePointSet) { StringBuilder builder = new StringBuilder(); // 8 * 4 = 32 chars max, but we do it the following way so as to bias the random toward diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/common/src/com/android/inputmethod/latin/common/Constants.java index 43af66eb7..d3746423e 100644 --- a/java/src/com/android/inputmethod/latin/Constants.java +++ b/common/src/com/android/inputmethod/latin/common/Constants.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.inputmethod.latin; +package com.android.inputmethod.latin.common; public final class Constants { public static final class Color { @@ -57,6 +57,13 @@ public final class Constants { @SuppressWarnings("dep-ann") public static final String FORCE_ASCII = "forceAscii"; + /** + * The private IME option used to suppress the floating gesture preview for a given text + * field. This overrides the corresponding keyboard settings preference. + * {@link com.android.inputmethod.latin.settings.SettingsValues#mGestureFloatingPreviewTextEnabled} + */ + public static final String NO_FLOATING_GESTURE_PREVIEW = "noGestureFloatingPreview"; + private ImeOption() { // This utility class is not publicly instantiable. } @@ -217,15 +224,17 @@ public final class Constants { public static final int CODE_CLOSING_ANGLE_BRACKET = '>'; public static final int CODE_INVERTED_QUESTION_MARK = 0xBF; // ¿ public static final int CODE_INVERTED_EXCLAMATION_MARK = 0xA1; // ¡ + public static final int CODE_GRAVE_ACCENT = '`'; + public static final int CODE_CIRCUMFLEX_ACCENT = '^'; + public static final int CODE_TILDE = '~'; public static final String REGEXP_PERIOD = "\\."; public static final String STRING_SPACE = " "; - public static final String STRING_PERIOD_AND_SPACE = ". "; /** * Special keys code. Must be negative. - * These should be aligned with {@link KeyboardCodesSet#ID_TO_NAME}, - * {@link KeyboardCodesSet#DEFAULT}, and {@link KeyboardCodesSet#RTL}. + * These should be aligned with constants in + * {@link com.android.inputmethod.keyboard.internal.KeyboardCodesSet}. */ public static final int CODE_SHIFT = -1; public static final int CODE_CAPSLOCK = -2; @@ -287,21 +296,29 @@ public final class Constants { return "[" + sb + "]"; } - public static final int MAX_INT_BIT_COUNT = 32; - /** * Screen metrics (a.k.a. Device form factor) constants of - * {@link R.integer#config_screen_metrics}. + * {@link com.android.inputmethod.latin.R.integer#config_screen_metrics}. */ public static final int SCREEN_METRICS_SMALL_PHONE = 0; public static final int SCREEN_METRICS_LARGE_PHONE = 1; public static final int SCREEN_METRICS_LARGE_TABLET = 2; public static final int SCREEN_METRICS_SMALL_TABLET = 3; + public static boolean isPhone(final int screenMetrics) { + return screenMetrics == SCREEN_METRICS_SMALL_PHONE + || screenMetrics == SCREEN_METRICS_LARGE_PHONE; + } + + public static boolean isTablet(final int screenMetrics) { + return screenMetrics == SCREEN_METRICS_SMALL_TABLET + || screenMetrics == SCREEN_METRICS_LARGE_TABLET; + } + /** * Default capacity of gesture points container. - * This constant is used by {@link BatchInputArbiter} and etc. to preallocate regions that - * contain gesture event points. + * This constant is used by {@link com.android.inputmethod.keyboard.internal.BatchInputArbiter} + * and etc. to preallocate regions that contain gesture event points. */ public static final int DEFAULT_GESTURE_POINTS_CAPACITY = 128; |