diff options
author | 2013-04-26 08:23:56 +0000 | |
---|---|---|
committer | 2013-04-26 08:23:56 +0000 | |
commit | c03aaa1bde589f582daa83f1ecdc66ce8a4691b2 (patch) | |
tree | 1349a07af3761ff21db1c9cfb9a75d7778642991 /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | 1ff8b1ce3a44de7b5cbc3f5c6ea7b1e3f778a739 (diff) | |
parent | bb61293675234f6e5e1312db70618be985b37a83 (diff) | |
download | latinime-c03aaa1bde589f582daa83f1ecdc66ce8a4691b2.tar.gz latinime-c03aaa1bde589f582daa83f1ecdc66ce8a4691b2.tar.xz latinime-c03aaa1bde589f582daa83f1ecdc66ce8a4691b2.zip |
Merge "[ZF2] Read settings for profanity filtering."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 03f7d1c10..c8c7bb456 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -139,6 +139,8 @@ public final class BinaryDictionary extends Dictionary { inputSize, 0 /* commitPoint */, isGesture, prevWordCodePointArray, mUseFullEditDistance, mOutputCodePoints, mOutputScores, mSpaceIndices, mOutputTypes); + final boolean blockPotentiallyOffensive = + Settings.getInstance().getBlockPotentiallyOffensive(); final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList(); for (int j = 0; j < count; ++j) { final int start = j * MAX_WORD_LENGTH; @@ -148,10 +150,11 @@ public final class BinaryDictionary extends Dictionary { } if (len > 0) { final int flags = mOutputTypes[j] & SuggestedWordInfo.KIND_MASK_FLAGS; - if (0 != (flags & SuggestedWordInfo.KIND_FLAG_POSSIBLY_OFFENSIVE) + if (blockPotentiallyOffensive + && 0 != (flags & SuggestedWordInfo.KIND_FLAG_POSSIBLY_OFFENSIVE) && 0 == (flags & SuggestedWordInfo.KIND_FLAG_EXACT_MATCH)) { - // If the word is possibly offensive, we don't output it unless it's also - // an exact match. + // If we block potentially offensive words, and if the word is possibly + // offensive, then we don't output it unless it's also an exact match. continue; } final int kind = mOutputTypes[j] & SuggestedWordInfo.KIND_MASK_KIND; |