aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-01-17 11:01:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-01-17 11:02:00 +0000
commitc665cbee7f136ea3cf334262f8dc1e7621f2004f (patch)
tree5244d9a8fd45df4b1f9be5846c6c8b75222f855b /java/src
parent15ea1d40967c25ab27849e1d8c0acf55d8f07e29 (diff)
parentb6b7f5e39e9ea1bf9a05203c536327a6be7e7214 (diff)
downloadlatinime-c665cbee7f136ea3cf334262f8dc1e7621f2004f.tar.gz
latinime-c665cbee7f136ea3cf334262f8dc1e7621f2004f.tar.xz
latinime-c665cbee7f136ea3cf334262f8dc1e7621f2004f.zip
Merge "Forward the capitalized mode to the positional info (D1)"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LastComposedWord.java9
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java3
-rw-r--r--java/src/com/android/inputmethod/latin/PositionalInfoForUserDictPendingAddition.java4
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java3
4 files changed, 13 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LastComposedWord.java b/java/src/com/android/inputmethod/latin/LastComposedWord.java
index 488a6fcf2..a4019e906 100644
--- a/java/src/com/android/inputmethod/latin/LastComposedWord.java
+++ b/java/src/com/android/inputmethod/latin/LastComposedWord.java
@@ -45,19 +45,21 @@ public final class LastComposedWord {
public final String mCommittedWord;
public final String mSeparatorString;
public final String mPrevWord;
+ public final int mCapitalizedMode;
public final InputPointers mInputPointers =
new InputPointers(Constants.Dictionary.MAX_WORD_LENGTH);
private boolean mActive;
public static final LastComposedWord NOT_A_COMPOSED_WORD =
- new LastComposedWord(null, null, "", "", NOT_A_SEPARATOR, null);
+ new LastComposedWord(null, null, "", "", NOT_A_SEPARATOR, null,
+ WordComposer.CAPS_MODE_OFF);
// Warning: this is using the passed objects as is and fully expects them to be
// immutable. Do not fiddle with their contents after you passed them to this constructor.
public LastComposedWord(final int[] primaryKeyCodes, final InputPointers inputPointers,
- final String typedWord, final String committedWord,
- final String separatorString, final String prevWord) {
+ final String typedWord, final String committedWord, final String separatorString,
+ final String prevWord, final int capitalizedMode) {
mPrimaryKeyCodes = primaryKeyCodes;
if (inputPointers != null) {
mInputPointers.copy(inputPointers);
@@ -67,6 +69,7 @@ public final class LastComposedWord {
mSeparatorString = separatorString;
mActive = true;
mPrevWord = prevWord;
+ mCapitalizedMode = capitalizedMode;
}
public void deactivate() {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 24d3c089c..d02c4df7e 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1225,7 +1225,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
}
mPositionalInfoForUserDictPendingAddition =
new PositionalInfoForUserDictPendingAddition(
- word, mLastSelectionEnd, getCurrentInputEditorInfo());
+ word, mLastSelectionEnd, getCurrentInputEditorInfo(),
+ mLastComposedWord.mCapitalizedMode);
mUserDictionary.addWordToUserDictionary(word, 128);
}
diff --git a/java/src/com/android/inputmethod/latin/PositionalInfoForUserDictPendingAddition.java b/java/src/com/android/inputmethod/latin/PositionalInfoForUserDictPendingAddition.java
index 1fd25636c..a33cefcd6 100644
--- a/java/src/com/android/inputmethod/latin/PositionalInfoForUserDictPendingAddition.java
+++ b/java/src/com/android/inputmethod/latin/PositionalInfoForUserDictPendingAddition.java
@@ -33,13 +33,15 @@ public final class PositionalInfoForUserDictPendingAddition {
final private String mOriginalWord;
final private int mCursorPos; // Position of the cursor after the word
final private EditorInfo mEditorInfo; // On what binding this has been added
+ final private int mCapitalizedMode;
private String mActualWordBeingAdded;
public PositionalInfoForUserDictPendingAddition(final String word, final int cursorPos,
- final EditorInfo editorInfo) {
+ final EditorInfo editorInfo, final int capitalizedMode) {
mOriginalWord = word;
mCursorPos = cursorPos;
mEditorInfo = editorInfo;
+ mCapitalizedMode = capitalizedMode;
}
public void setActualWordBeingAdded(final String actualWordBeingAdded) {
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index 4f1759079..b9ec4979d 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -350,7 +350,7 @@ public final class WordComposer {
mPrimaryKeyCodes = new int[MAX_WORD_LENGTH];
final LastComposedWord lastComposedWord = new LastComposedWord(primaryKeyCodes,
mInputPointers, mTypedWord.toString(), committedWord, separatorString,
- prevWord);
+ prevWord, mCapitalizedMode);
mInputPointers.reset();
if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD
&& type != LastComposedWord.COMMIT_TYPE_MANUAL_PICK) {
@@ -374,6 +374,7 @@ public final class WordComposer {
mTypedWord.setLength(0);
mTypedWord.append(lastComposedWord.mTypedWord);
refreshSize();
+ mCapitalizedMode = lastComposedWord.mCapitalizedMode;
mAutoCorrection = null; // This will be filled by the next call to updateSuggestion.
mIsResumed = true;
}