am c665cbee: Merge "Forward the capitalized mode to the positional info (D1)"
* commit 'c665cbee7f136ea3cf334262f8dc1e7621f2004f': Forward the capitalized mode to the positional info (D1)main
commit
5df7f0c8a2
|
@ -45,19 +45,21 @@ public final class LastComposedWord {
|
||||||
public final String mCommittedWord;
|
public final String mCommittedWord;
|
||||||
public final String mSeparatorString;
|
public final String mSeparatorString;
|
||||||
public final String mPrevWord;
|
public final String mPrevWord;
|
||||||
|
public final int mCapitalizedMode;
|
||||||
public final InputPointers mInputPointers =
|
public final InputPointers mInputPointers =
|
||||||
new InputPointers(Constants.Dictionary.MAX_WORD_LENGTH);
|
new InputPointers(Constants.Dictionary.MAX_WORD_LENGTH);
|
||||||
|
|
||||||
private boolean mActive;
|
private boolean mActive;
|
||||||
|
|
||||||
public static final LastComposedWord NOT_A_COMPOSED_WORD =
|
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
|
// 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.
|
// immutable. Do not fiddle with their contents after you passed them to this constructor.
|
||||||
public LastComposedWord(final int[] primaryKeyCodes, final InputPointers inputPointers,
|
public LastComposedWord(final int[] primaryKeyCodes, final InputPointers inputPointers,
|
||||||
final String typedWord, final String committedWord,
|
final String typedWord, final String committedWord, final String separatorString,
|
||||||
final String separatorString, final String prevWord) {
|
final String prevWord, final int capitalizedMode) {
|
||||||
mPrimaryKeyCodes = primaryKeyCodes;
|
mPrimaryKeyCodes = primaryKeyCodes;
|
||||||
if (inputPointers != null) {
|
if (inputPointers != null) {
|
||||||
mInputPointers.copy(inputPointers);
|
mInputPointers.copy(inputPointers);
|
||||||
|
@ -67,6 +69,7 @@ public final class LastComposedWord {
|
||||||
mSeparatorString = separatorString;
|
mSeparatorString = separatorString;
|
||||||
mActive = true;
|
mActive = true;
|
||||||
mPrevWord = prevWord;
|
mPrevWord = prevWord;
|
||||||
|
mCapitalizedMode = capitalizedMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deactivate() {
|
public void deactivate() {
|
||||||
|
|
|
@ -1225,7 +1225,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
}
|
}
|
||||||
mPositionalInfoForUserDictPendingAddition =
|
mPositionalInfoForUserDictPendingAddition =
|
||||||
new PositionalInfoForUserDictPendingAddition(
|
new PositionalInfoForUserDictPendingAddition(
|
||||||
word, mLastSelectionEnd, getCurrentInputEditorInfo());
|
word, mLastSelectionEnd, getCurrentInputEditorInfo(),
|
||||||
|
mLastComposedWord.mCapitalizedMode);
|
||||||
mUserDictionary.addWordToUserDictionary(word, 128);
|
mUserDictionary.addWordToUserDictionary(word, 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,15 @@ public final class PositionalInfoForUserDictPendingAddition {
|
||||||
final private String mOriginalWord;
|
final private String mOriginalWord;
|
||||||
final private int mCursorPos; // Position of the cursor after the word
|
final private int mCursorPos; // Position of the cursor after the word
|
||||||
final private EditorInfo mEditorInfo; // On what binding this has been added
|
final private EditorInfo mEditorInfo; // On what binding this has been added
|
||||||
|
final private int mCapitalizedMode;
|
||||||
private String mActualWordBeingAdded;
|
private String mActualWordBeingAdded;
|
||||||
|
|
||||||
public PositionalInfoForUserDictPendingAddition(final String word, final int cursorPos,
|
public PositionalInfoForUserDictPendingAddition(final String word, final int cursorPos,
|
||||||
final EditorInfo editorInfo) {
|
final EditorInfo editorInfo, final int capitalizedMode) {
|
||||||
mOriginalWord = word;
|
mOriginalWord = word;
|
||||||
mCursorPos = cursorPos;
|
mCursorPos = cursorPos;
|
||||||
mEditorInfo = editorInfo;
|
mEditorInfo = editorInfo;
|
||||||
|
mCapitalizedMode = capitalizedMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActualWordBeingAdded(final String actualWordBeingAdded) {
|
public void setActualWordBeingAdded(final String actualWordBeingAdded) {
|
||||||
|
|
|
@ -350,7 +350,7 @@ public final class WordComposer {
|
||||||
mPrimaryKeyCodes = new int[MAX_WORD_LENGTH];
|
mPrimaryKeyCodes = new int[MAX_WORD_LENGTH];
|
||||||
final LastComposedWord lastComposedWord = new LastComposedWord(primaryKeyCodes,
|
final LastComposedWord lastComposedWord = new LastComposedWord(primaryKeyCodes,
|
||||||
mInputPointers, mTypedWord.toString(), committedWord, separatorString,
|
mInputPointers, mTypedWord.toString(), committedWord, separatorString,
|
||||||
prevWord);
|
prevWord, mCapitalizedMode);
|
||||||
mInputPointers.reset();
|
mInputPointers.reset();
|
||||||
if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD
|
if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD
|
||||||
&& type != LastComposedWord.COMMIT_TYPE_MANUAL_PICK) {
|
&& type != LastComposedWord.COMMIT_TYPE_MANUAL_PICK) {
|
||||||
|
@ -374,6 +374,7 @@ public final class WordComposer {
|
||||||
mTypedWord.setLength(0);
|
mTypedWord.setLength(0);
|
||||||
mTypedWord.append(lastComposedWord.mTypedWord);
|
mTypedWord.append(lastComposedWord.mTypedWord);
|
||||||
refreshSize();
|
refreshSize();
|
||||||
|
mCapitalizedMode = lastComposedWord.mCapitalizedMode;
|
||||||
mAutoCorrection = null; // This will be filled by the next call to updateSuggestion.
|
mAutoCorrection = null; // This will be filled by the next call to updateSuggestion.
|
||||||
mIsResumed = true;
|
mIsResumed = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue