Loading java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +8 −7 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.ResearchLogger; import com.android.inputmethod.latin.define.ProductionFlag; Loading @@ -30,8 +31,8 @@ import com.android.inputmethod.latin.define.ProductionFlag; * * The input events are {@link #onLoadKeyboard(String)}, {@link #onSaveKeyboardState()}, * {@link #onPressKey(int)}, {@link #onReleaseKey(int, boolean)}, * {@link #onCodeInput(int, boolean, boolean)}, {@link #onCancelInput(boolean)}, * {@link #onUpdateShiftState(boolean)}, {@link #onLongPressTimeout(int)}. * {@link #onCodeInput(int, boolean, int)}, {@link #onCancelInput(boolean)}, * {@link #onUpdateShiftState(int)}, {@link #onLongPressTimeout(int)}. * * The actions are {@link SwitchActions}'s methods. */ Loading @@ -50,7 +51,7 @@ public class KeyboardState { public void setSymbolsShiftedKeyboard(); /** * Request to call back {@link KeyboardState#onUpdateShiftState(boolean)}. * Request to call back {@link KeyboardState#onUpdateShiftState(int)}. */ public void requestUpdatingShiftState(); Loading Loading @@ -371,14 +372,14 @@ public class KeyboardState { } } public void onUpdateShiftState(boolean autoCaps) { public void onUpdateShiftState(int autoCaps) { if (DEBUG_EVENT) { Log.d(TAG, "onUpdateShiftState: autoCaps=" + autoCaps + " " + this); } updateAlphabetShiftState(autoCaps); } private void updateAlphabetShiftState(boolean autoCaps) { private void updateAlphabetShiftState(int autoCaps) { if (!mIsAlphabetMode) return; if (!mShiftKeyState.isReleasing()) { // Ignore update shift state event while the shift key is being pressed (including Loading @@ -386,7 +387,7 @@ public class KeyboardState { return; } if (!mAlphabetShiftState.isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (mShiftKeyState.isReleasing() && autoCaps) { if (mShiftKeyState.isReleasing() && autoCaps != Constants.TextUtils.CAP_MODE_OFF) { // Only when shift key is releasing, automatic temporary upper case will be set. setShifted(AUTOMATIC_SHIFT); } else { Loading Loading @@ -521,7 +522,7 @@ public class KeyboardState { return false; } public void onCodeInput(int code, boolean isSinglePointer, boolean autoCaps) { public void onCodeInput(int code, boolean isSinglePointer, int autoCaps) { if (DEBUG_EVENT) { Log.d(TAG, "onCodeInput: code=" + Keyboard.printableCode(code) + " single=" + isSinglePointer Loading java/src/com/android/inputmethod/latin/Constants.java +15 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,21 @@ public final class Constants { } } public static class TextUtils { /** * Capitalization mode for {@link android.text.TextUtils#getCapsMode}: don't capitalize * characters. This value may be used with * {@link android.text.TextUtils#CAP_MODE_CHARACTERS}, * {@link android.text.TextUtils#CAP_MODE_WORDS}, and * {@link android.text.TextUtils#CAP_MODE_SENTENCES}. */ public static final int CAP_MODE_OFF = 0; private TextUtils() { // This utility class is not publicly instantiable. } } private Constants() { // This utility class is not publicly instantiable. } Loading java/src/com/android/inputmethod/latin/LatinIME.java +11 −8 Original line number Diff line number Diff line Loading @@ -1032,26 +1032,28 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen updateSuggestions(); } public boolean getCurrentAutoCapsState() { if (!mSettingsValues.mAutoCap) return false; public int getCurrentAutoCapsState() { if (!mSettingsValues.mAutoCap) return Constants.TextUtils.CAP_MODE_OFF; final EditorInfo ei = getCurrentInputEditorInfo(); if (ei == null) return false; if (ei == null) return Constants.TextUtils.CAP_MODE_OFF; final int inputType = ei.inputType; if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) return true; if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) { return TextUtils.CAP_MODE_CHARACTERS; } final boolean noNeedToCheckCapsMode = (inputType & (InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_CAP_WORDS)) == 0; if (noNeedToCheckCapsMode) return false; if (noNeedToCheckCapsMode) return Constants.TextUtils.CAP_MODE_OFF; final InputConnection ic = getCurrentInputConnection(); if (ic == null) return false; if (ic == null) return Constants.TextUtils.CAP_MODE_OFF; // TODO: This blocking IPC call is heavy. Consider doing this without using IPC calls. // Note: getCursorCapsMode() returns the current capitalization mode that is any // combination of CAP_MODE_CHARACTERS, CAP_MODE_WORDS, and CAP_MODE_SENTENCES. 0 means none // of them. return ic.getCursorCapsMode(inputType) != 0; return ic.getCursorCapsMode(inputType); } // "ic" may be null Loading Loading @@ -1522,7 +1524,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (ic != null) { // If it's the first letter, make note of auto-caps state if (mWordComposer.size() == 1) { mWordComposer.setAutoCapitalized(getCurrentAutoCapsState()); mWordComposer.setAutoCapitalized( getCurrentAutoCapsState() != Constants.TextUtils.CAP_MODE_OFF); } ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1); } Loading java/src/com/android/inputmethod/latin/ResearchLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -444,7 +444,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } public static void keyboardState_onCodeInput( final int code, final boolean isSinglePointer, final boolean autoCaps, final int code, final boolean isSinglePointer, final int autoCaps, final KeyboardState keyboardState) { if (UnsLogGroup.KEYBOARDSTATE_ONCODEINPUT_ENABLED) { final String s = "onCodeInput: code=" + Keyboard.printableCode(code) Loading tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -206,8 +206,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { // Chording input in automatic upper case. public void testChordingAutomaticUpperCase() { // Set auto caps mode on. setAutoCapsMode(AUTO_CAPS); // Set capitalize the first character of all words mode. setAutoCapsMode(CAP_MODE_WORDS); // Update shift state with auto caps enabled. pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED); Loading Loading
java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +8 −7 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.ResearchLogger; import com.android.inputmethod.latin.define.ProductionFlag; Loading @@ -30,8 +31,8 @@ import com.android.inputmethod.latin.define.ProductionFlag; * * The input events are {@link #onLoadKeyboard(String)}, {@link #onSaveKeyboardState()}, * {@link #onPressKey(int)}, {@link #onReleaseKey(int, boolean)}, * {@link #onCodeInput(int, boolean, boolean)}, {@link #onCancelInput(boolean)}, * {@link #onUpdateShiftState(boolean)}, {@link #onLongPressTimeout(int)}. * {@link #onCodeInput(int, boolean, int)}, {@link #onCancelInput(boolean)}, * {@link #onUpdateShiftState(int)}, {@link #onLongPressTimeout(int)}. * * The actions are {@link SwitchActions}'s methods. */ Loading @@ -50,7 +51,7 @@ public class KeyboardState { public void setSymbolsShiftedKeyboard(); /** * Request to call back {@link KeyboardState#onUpdateShiftState(boolean)}. * Request to call back {@link KeyboardState#onUpdateShiftState(int)}. */ public void requestUpdatingShiftState(); Loading Loading @@ -371,14 +372,14 @@ public class KeyboardState { } } public void onUpdateShiftState(boolean autoCaps) { public void onUpdateShiftState(int autoCaps) { if (DEBUG_EVENT) { Log.d(TAG, "onUpdateShiftState: autoCaps=" + autoCaps + " " + this); } updateAlphabetShiftState(autoCaps); } private void updateAlphabetShiftState(boolean autoCaps) { private void updateAlphabetShiftState(int autoCaps) { if (!mIsAlphabetMode) return; if (!mShiftKeyState.isReleasing()) { // Ignore update shift state event while the shift key is being pressed (including Loading @@ -386,7 +387,7 @@ public class KeyboardState { return; } if (!mAlphabetShiftState.isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (mShiftKeyState.isReleasing() && autoCaps) { if (mShiftKeyState.isReleasing() && autoCaps != Constants.TextUtils.CAP_MODE_OFF) { // Only when shift key is releasing, automatic temporary upper case will be set. setShifted(AUTOMATIC_SHIFT); } else { Loading Loading @@ -521,7 +522,7 @@ public class KeyboardState { return false; } public void onCodeInput(int code, boolean isSinglePointer, boolean autoCaps) { public void onCodeInput(int code, boolean isSinglePointer, int autoCaps) { if (DEBUG_EVENT) { Log.d(TAG, "onCodeInput: code=" + Keyboard.printableCode(code) + " single=" + isSinglePointer Loading
java/src/com/android/inputmethod/latin/Constants.java +15 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,21 @@ public final class Constants { } } public static class TextUtils { /** * Capitalization mode for {@link android.text.TextUtils#getCapsMode}: don't capitalize * characters. This value may be used with * {@link android.text.TextUtils#CAP_MODE_CHARACTERS}, * {@link android.text.TextUtils#CAP_MODE_WORDS}, and * {@link android.text.TextUtils#CAP_MODE_SENTENCES}. */ public static final int CAP_MODE_OFF = 0; private TextUtils() { // This utility class is not publicly instantiable. } } private Constants() { // This utility class is not publicly instantiable. } Loading
java/src/com/android/inputmethod/latin/LatinIME.java +11 −8 Original line number Diff line number Diff line Loading @@ -1032,26 +1032,28 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen updateSuggestions(); } public boolean getCurrentAutoCapsState() { if (!mSettingsValues.mAutoCap) return false; public int getCurrentAutoCapsState() { if (!mSettingsValues.mAutoCap) return Constants.TextUtils.CAP_MODE_OFF; final EditorInfo ei = getCurrentInputEditorInfo(); if (ei == null) return false; if (ei == null) return Constants.TextUtils.CAP_MODE_OFF; final int inputType = ei.inputType; if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) return true; if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) { return TextUtils.CAP_MODE_CHARACTERS; } final boolean noNeedToCheckCapsMode = (inputType & (InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_CAP_WORDS)) == 0; if (noNeedToCheckCapsMode) return false; if (noNeedToCheckCapsMode) return Constants.TextUtils.CAP_MODE_OFF; final InputConnection ic = getCurrentInputConnection(); if (ic == null) return false; if (ic == null) return Constants.TextUtils.CAP_MODE_OFF; // TODO: This blocking IPC call is heavy. Consider doing this without using IPC calls. // Note: getCursorCapsMode() returns the current capitalization mode that is any // combination of CAP_MODE_CHARACTERS, CAP_MODE_WORDS, and CAP_MODE_SENTENCES. 0 means none // of them. return ic.getCursorCapsMode(inputType) != 0; return ic.getCursorCapsMode(inputType); } // "ic" may be null Loading Loading @@ -1522,7 +1524,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (ic != null) { // If it's the first letter, make note of auto-caps state if (mWordComposer.size() == 1) { mWordComposer.setAutoCapitalized(getCurrentAutoCapsState()); mWordComposer.setAutoCapitalized( getCurrentAutoCapsState() != Constants.TextUtils.CAP_MODE_OFF); } ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1); } Loading
java/src/com/android/inputmethod/latin/ResearchLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -444,7 +444,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } public static void keyboardState_onCodeInput( final int code, final boolean isSinglePointer, final boolean autoCaps, final int code, final boolean isSinglePointer, final int autoCaps, final KeyboardState keyboardState) { if (UnsLogGroup.KEYBOARDSTATE_ONCODEINPUT_ENABLED) { final String s = "onCodeInput: code=" + Keyboard.printableCode(code) Loading
tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -206,8 +206,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { // Chording input in automatic upper case. public void testChordingAutomaticUpperCase() { // Set auto caps mode on. setAutoCapsMode(AUTO_CAPS); // Set capitalize the first character of all words mode. setAutoCapsMode(CAP_MODE_WORDS); // Update shift state with auto caps enabled. pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED); Loading