diff options
author | 2014-08-25 08:25:31 +0000 | |
---|---|---|
committer | 2014-08-25 08:25:31 +0000 | |
commit | f6f55add175bcd37710764afd05052974167bd1d (patch) | |
tree | a84bfb71a0464d9e64a68841a405c9f87560b91b /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | |
parent | c06c6e42ad24e02a5433dcb44dba452d1cfb3f4f (diff) | |
parent | e0d00803087ac2f873332d43a78453c068633545 (diff) | |
download | latinime-f6f55add175bcd37710764afd05052974167bd1d.tar.gz latinime-f6f55add175bcd37710764afd05052974167bd1d.tar.xz latinime-f6f55add175bcd37710764afd05052974167bd1d.zip |
am e0d00803: am 4a71d2c4: Allow to add/remove background color to/from the committed text
* commit 'e0d00803087ac2f873332d43a78453c068633545':
Allow to add/remove background color to/from the committed text
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 348bae63a..6fce2497e 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin.inputlogic; +import android.graphics.Color; import android.os.SystemClock; import android.text.SpannableString; import android.text.TextUtils; @@ -1994,7 +1995,9 @@ public final class InputLogic { } /** - * Commits the chosen word to the text field and saves it for later retrieval. + * Commits the chosen word to the text field and saves it for later retrieval. This is a + * synonym of {@code commitChosenWordWithBackgroundColor(settingsValues, chosenWord, + * commitType, separatorString, Color.TRANSPARENT}. * * @param settingsValues the current values of the settings. * @param chosenWord the word we want to commit. @@ -2003,6 +2006,23 @@ public final class InputLogic { */ private void commitChosenWord(final SettingsValues settingsValues, final String chosenWord, final int commitType, final String separatorString) { + commitChosenWordWithBackgroundColor(settingsValues, chosenWord, commitType, separatorString, + Color.TRANSPARENT); + } + + /** + * Commits the chosen word to the text field and saves it for later retrieval. + * + * @param settingsValues the current values of the settings. + * @param chosenWord the word we want to commit. + * @param commitType the type of the commit, as one of LastComposedWord.COMMIT_TYPE_* + * @param separatorString the separator that's causing the commit, or NOT_A_SEPARATOR if none. + * @param backgroundColor the background color to be specified with the committed text. Pass + * {@link Color#TRANSPARENT} to not specify the background color. + */ + private void commitChosenWordWithBackgroundColor(final SettingsValues settingsValues, + final String chosenWord, final int commitType, final String separatorString, + final int backgroundColor) { final SuggestedWords suggestedWords = mSuggestedWords; final CharSequence chosenWordWithSuggestions = SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord, @@ -2012,7 +2032,7 @@ public final class InputLogic { // information from the 1st previous word. final PrevWordsInfo prevWordsInfo = mConnection.getPrevWordsInfoFromNthPreviousWord( settingsValues.mSpacingAndPunctuations, mWordComposer.isComposingWord() ? 2 : 1); - mConnection.commitText(chosenWordWithSuggestions, 1); + mConnection.commitTextWithBackgroundColor(chosenWordWithSuggestions, 1, backgroundColor); // Add the word to the user history dictionary performAdditionToUserHistoryDictionary(settingsValues, chosenWord, prevWordsInfo); // TODO: figure out here if this is an auto-correct or if the best word is actually |