aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java71
1 files changed, 22 insertions, 49 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index aea6add56..31c832c31 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -16,6 +16,10 @@
package com.android.inputmethod.latin;
+import static com.android.inputmethod.latin.Constants.ImeOption.FORCE_ASCII;
+import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE;
+import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE_COMPAT;
+
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -81,49 +85,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private static final boolean TRACE = false;
private static boolean DEBUG;
- /**
- * The private IME option used to indicate that no microphone should be
- * shown for a given text field. For instance, this is specified by the
- * search dialog when the dialog is already showing a voice search button.
- *
- * @deprecated Use {@link LatinIME#IME_OPTION_NO_MICROPHONE} with package name prefixed.
- */
- @SuppressWarnings("dep-ann")
- public static final String IME_OPTION_NO_MICROPHONE_COMPAT = "nm";
-
- /**
- * The private IME option used to indicate that no microphone should be
- * shown for a given text field. For instance, this is specified by the
- * search dialog when the dialog is already showing a voice search button.
- */
- public static final String IME_OPTION_NO_MICROPHONE = "noMicrophoneKey";
-
- /**
- * The private IME option used to indicate that no settings key should be
- * shown for a given text field.
- */
- public static final String IME_OPTION_NO_SETTINGS_KEY = "noSettingsKey";
-
- /**
- * The private IME option used to indicate that the given text field needs
- * ASCII code points input.
- *
- * @deprecated Use {@link EditorInfo#IME_FLAG_FORCE_ASCII}.
- */
- @SuppressWarnings("dep-ann")
- public static final String IME_OPTION_FORCE_ASCII = "forceAscii";
-
- /**
- * The subtype extra value used to indicate that the subtype keyboard layout set name.
- */
- public static final String SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET = "KeyboardLayoutSet";
-
- /**
- * The subtype extra value used to indicate that the subtype keyboard layout is capable for
- * typing ASCII characters.
- */
- public static final String SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE = "AsciiCapable";
-
private static final int EXTENDED_TOUCHABLE_REGION_HEIGHT = 100;
// How many continuous deletes at which to start deleting at a higher speed.
@@ -441,8 +402,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
loadSettings();
- ImfUtils.setAdditionalInputMethodSubtypes(
- this, mSettingsValues.getPrefefinedAdditionalSubtypes());
+ ImfUtils.setAdditionalInputMethodSubtypes(this, mSettingsValues.getAdditionalSubtypes());
// TODO: remove the following when it's not needed by updateCorrectionMode() any more
mInputAttributes = new InputAttributes(null, false /* isFullscreenMode */);
@@ -650,6 +610,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
super.onStartInput(editorInfo, restarting);
}
+ @SuppressWarnings("deprecation")
private void onStartInputViewInternal(EditorInfo editorInfo, boolean restarting) {
super.onStartInputView(editorInfo, restarting);
final KeyboardSwitcher switcher = mKeyboardSwitcher;
@@ -670,12 +631,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_onStartInputViewInternal(editorInfo);
}
- if (StringUtils.inPrivateImeOptions(null, IME_OPTION_NO_MICROPHONE_COMPAT, editorInfo)) {
+ if (InputAttributes.inPrivateImeOptions(null, NO_MICROPHONE_COMPAT, editorInfo)) {
Log.w(TAG, "Deprecated private IME option specified: "
+ editorInfo.privateImeOptions);
- Log.w(TAG, "Use " + getPackageName() + "." + IME_OPTION_NO_MICROPHONE + " instead");
+ Log.w(TAG, "Use " + getPackageName() + "." + NO_MICROPHONE + " instead");
}
- if (StringUtils.inPrivateImeOptions(getPackageName(), IME_OPTION_FORCE_ASCII, editorInfo)) {
+ if (InputAttributes.inPrivateImeOptions(getPackageName(), FORCE_ASCII, editorInfo)) {
Log.w(TAG, "Deprecated private IME option specified: "
+ editorInfo.privateImeOptions);
Log.w(TAG, "Use EditorInfo.IME_FLAG_FORCE_ASCII flag instead");
@@ -1078,7 +1039,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (ic == null) return false;
final CharSequence lastThree = ic.getTextBeforeCursor(3, 0);
if (lastThree != null && lastThree.length() == 3
- && StringUtils.canBeFollowedByPeriod(lastThree.charAt(0))
+ && canBeFollowedByPeriod(lastThree.charAt(0))
&& lastThree.charAt(1) == Keyboard.CODE_SPACE
&& lastThree.charAt(2) == Keyboard.CODE_SPACE
&& mHandler.isAcceptingDoubleSpaces()) {
@@ -1094,6 +1055,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return false;
}
+ private static boolean canBeFollowedByPeriod(final int codePoint) {
+ // TODO: Check again whether there really ain't a better way to check this.
+ // TODO: This should probably be language-dependant...
+ return Character.isLetterOrDigit(codePoint)
+ || codePoint == Keyboard.CODE_SINGLE_QUOTE
+ || codePoint == Keyboard.CODE_DOUBLE_QUOTE
+ || codePoint == Keyboard.CODE_CLOSING_PARENTHESIS
+ || codePoint == Keyboard.CODE_CLOSING_SQUARE_BRACKET
+ || codePoint == Keyboard.CODE_CLOSING_CURLY_BRACKET
+ || codePoint == Keyboard.CODE_CLOSING_ANGLE_BRACKET;
+ }
+
// "ic" may be null
private static void removeTrailingSpaceWhileInBatchEdit(final InputConnection ic) {
if (ic == null) return;