Loading java/src/com/android/inputmethod/latin/Constants.java +2 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,8 @@ public final class Constants { public static final int CODE_DOUBLE_QUOTE = '"'; public static final int CODE_QUESTION_MARK = '?'; public static final int CODE_EXCLAMATION_MARK = '!'; public static final int CODE_SLASH = '/'; public static final int CODE_COMMERCIAL_AT = '@'; // TODO: Check how this should work for right-to-left languages. It seems to stand // that for rtl languages, a closing parenthesis is a left parenthesis. Is this // managed by the font? Or is it a different char? Loading java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java +1 −1 Original line number Diff line number Diff line Loading @@ -252,7 +252,7 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { } private static boolean isValidName(final String name) { if (name != null && -1 == name.indexOf('@')) { if (name != null && -1 == name.indexOf(Constants.CODE_COMMERCIAL_AT)) { return true; } return false; Loading java/src/com/android/inputmethod/latin/InputTypeUtils.java +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ public final class InputTypeUtils implements InputType { private static final int[] SUPPRESSING_AUTO_SPACES_FIELD_VARIATION = { InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS, InputType.TYPE_TEXT_VARIATION_PASSWORD, InputType.TYPE_TEXT_VARIATION_URI, InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD }; public static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1; Loading java/src/com/android/inputmethod/latin/LatinIME.java +2 −1 Original line number Diff line number Diff line Loading @@ -2559,7 +2559,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // This essentially inserts a space, and that's it. public void promotePhantomSpace() { if (mSettings.getCurrent().shouldInsertSpacesAutomatically()) { if (mSettings.getCurrent().shouldInsertSpacesAutomatically() && !mConnection.textBeforeCursorLooksLikeURL()) { sendKeyCodePoint(Constants.CODE_SPACE); if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_promotePhantomSpace(); Loading java/src/com/android/inputmethod/latin/RichInputConnection.java +11 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.inputmethod.latin; import android.inputmethodservice.InputMethodService; import android.text.SpannableString; import android.text.TextUtils; import android.text.style.SuggestionSpan; import android.util.Log; import android.view.KeyEvent; import android.view.inputmethod.CompletionInfo; Loading Loading @@ -721,4 +720,15 @@ public final class RichInputConnection { // position and the expected position, then it must be a belated update. return (newSelStart - oldSelStart) * (mCurrentCursorPosition - newSelStart) >= 0; } /** * Looks at the text just before the cursor to find out if it looks like a URL. * * The weakest point here is, if we don't have enough text bufferized, we may fail to realize * we are in URL situation, but other places in this class have the same limitation and it * does not matter too much in the practice. */ public boolean textBeforeCursorLooksLikeURL() { return StringUtils.lastPartLooksLikeURL(mCommittedTextBeforeComposingText); } } Loading
java/src/com/android/inputmethod/latin/Constants.java +2 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,8 @@ public final class Constants { public static final int CODE_DOUBLE_QUOTE = '"'; public static final int CODE_QUESTION_MARK = '?'; public static final int CODE_EXCLAMATION_MARK = '!'; public static final int CODE_SLASH = '/'; public static final int CODE_COMMERCIAL_AT = '@'; // TODO: Check how this should work for right-to-left languages. It seems to stand // that for rtl languages, a closing parenthesis is a left parenthesis. Is this // managed by the font? Or is it a different char? Loading
java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java +1 −1 Original line number Diff line number Diff line Loading @@ -252,7 +252,7 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { } private static boolean isValidName(final String name) { if (name != null && -1 == name.indexOf('@')) { if (name != null && -1 == name.indexOf(Constants.CODE_COMMERCIAL_AT)) { return true; } return false; Loading
java/src/com/android/inputmethod/latin/InputTypeUtils.java +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ public final class InputTypeUtils implements InputType { private static final int[] SUPPRESSING_AUTO_SPACES_FIELD_VARIATION = { InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS, InputType.TYPE_TEXT_VARIATION_PASSWORD, InputType.TYPE_TEXT_VARIATION_URI, InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD }; public static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1; Loading
java/src/com/android/inputmethod/latin/LatinIME.java +2 −1 Original line number Diff line number Diff line Loading @@ -2559,7 +2559,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // This essentially inserts a space, and that's it. public void promotePhantomSpace() { if (mSettings.getCurrent().shouldInsertSpacesAutomatically()) { if (mSettings.getCurrent().shouldInsertSpacesAutomatically() && !mConnection.textBeforeCursorLooksLikeURL()) { sendKeyCodePoint(Constants.CODE_SPACE); if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_promotePhantomSpace(); Loading
java/src/com/android/inputmethod/latin/RichInputConnection.java +11 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.inputmethod.latin; import android.inputmethodservice.InputMethodService; import android.text.SpannableString; import android.text.TextUtils; import android.text.style.SuggestionSpan; import android.util.Log; import android.view.KeyEvent; import android.view.inputmethod.CompletionInfo; Loading Loading @@ -721,4 +720,15 @@ public final class RichInputConnection { // position and the expected position, then it must be a belated update. return (newSelStart - oldSelStart) * (mCurrentCursorPosition - newSelStart) >= 0; } /** * Looks at the text just before the cursor to find out if it looks like a URL. * * The weakest point here is, if we don't have enough text bufferized, we may fail to realize * we are in URL situation, but other places in this class have the same limitation and it * does not matter too much in the practice. */ public boolean textBeforeCursorLooksLikeURL() { return StringUtils.lastPartLooksLikeURL(mCommittedTextBeforeComposingText); } }