aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BinaryDictionary.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-05-15 11:05:03 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-15 11:05:03 -0700
commit3160671bc197109e83d2b70be29bc26d39b78375 (patch)
tree35473d63be137da69a8c5867232246e4b443436d /java/src/com/android/inputmethod/latin/BinaryDictionary.java
parent4746093c3c90a44eff373a1c02405a49185031fb (diff)
parent330072b0146ffe148417d43ee0842c1238b6923d (diff)
downloadlatinime-3160671bc197109e83d2b70be29bc26d39b78375.tar.gz
latinime-3160671bc197109e83d2b70be29bc26d39b78375.tar.xz
latinime-3160671bc197109e83d2b70be29bc26d39b78375.zip
am 330072b0: am c03aaa1b: Merge "[ZF2] Read settings for profanity filtering."
* commit '330072b0146ffe148417d43ee0842c1238b6923d': [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.java9
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;