diff options
author | 2015-04-22 08:00:45 +0000 | |
---|---|---|
committer | 2015-04-22 08:00:45 +0000 | |
commit | 4acd7177dd95ac3d27636c3f73f89d53e7320bf5 (patch) | |
tree | c82d17e5ca4de615e1882c7b0bbe16767d690584 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | |
parent | f76430ddb9d0a9c5f7c6612b135d433532b3fa2f (diff) | |
parent | 490fa47a46015f2c8bd8f9010d236bfe5aecd4bb (diff) | |
download | latinime-4acd7177dd95ac3d27636c3f73f89d53e7320bf5.tar.gz latinime-4acd7177dd95ac3d27636c3f73f89d53e7320bf5.tar.xz latinime-4acd7177dd95ac3d27636c3f73f89d53e7320bf5.zip |
am 490fa47a: Always specify non-null Locale object to SuggestionSpan
* commit '490fa47a46015f2c8bd8f9010d236bfe5aecd4bb':
Always specify non-null Locale object to SuggestionSpan
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 18 |
1 files changed, 16 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 324ae3a19..f7dbc0a4d 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -60,6 +60,7 @@ import com.android.inputmethod.latin.utils.StatsUtils; import com.android.inputmethod.latin.utils.TextRange; import java.util.ArrayList; +import java.util.Locale; import java.util.TreeSet; import java.util.concurrent.TimeUnit; @@ -1903,6 +1904,15 @@ public final class InputLogic { } /** + * @return the {@link Locale} of the {@link #mDictionaryFacilitator} if available. Otherwise + * {@link Locale#ROOT}. + */ + @Nonnull + private Locale getDictionaryFacilitatorLocale() { + return mDictionaryFacilitator != null ? mDictionaryFacilitator.getLocale() : Locale.ROOT; + } + + /** * Gets a chunk of text with or the auto-correction indicator underline span as appropriate. * * This method looks at the old state of the auto-correction indicator to put or not put @@ -1921,8 +1931,10 @@ public final class InputLogic { */ // TODO: Shouldn't this go in some *Utils class instead? private CharSequence getTextWithUnderline(final String text) { + // TODO: Locale should be determined based on context and the text given. return mIsAutoCorrectionIndicatorOn - ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(mLatinIME, text) + ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline( + mLatinIME, text, getDictionaryFacilitatorLocale()) : text; } @@ -2122,9 +2134,11 @@ public final class InputLogic { Log.d(TAG, "commitChosenWord() : [" + chosenWord + "]"); } final SuggestedWords suggestedWords = mSuggestedWords; + // TODO: Locale should be determined based on context and the text given. + final Locale locale = getDictionaryFacilitatorLocale(); final CharSequence chosenWordWithSuggestions = SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord, - suggestedWords); + suggestedWords, locale); if (DebugFlags.DEBUG_ENABLED) { long runTimeMillis = System.currentTimeMillis() - startTimeMillis; Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " |