aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java3
-rw-r--r--java/src/com/android/inputmethod/latin/CandidateView.java16
-rw-r--r--java/src/com/android/inputmethod/latin/ContactsDictionary.java6
3 files changed, 13 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 2512118d4..7c68c93f2 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -745,8 +745,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
}
- mKeyboardView = (LatinKeyboardView) mCurrentInputView.findViewById(
- R.id.latin_keyboard_view);
+ mKeyboardView = (LatinKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
mKeyboardView.setOnKeyboardActionListener(mInputMethodService);
mThemeIndex = themeIndex;
return mCurrentInputView;
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index e5ed2da31..b4f6b2c91 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -156,7 +156,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
tv.setOnLongClickListener(this);
mWords.add(tv);
if (i > 0) {
- View divider = inflater.inflate(R.layout.candidate_divider, null);
+ final View divider = inflater.inflate(R.layout.candidate_divider, null);
mDividers.add(divider);
}
}
@@ -198,7 +198,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
final int color;
if (isAutoCorrect && mConfigCandidateHighlightFontColorEnabled) {
color = mColorAutoCorrect;
- } else if (isSuggestedCandidate) {
+ } else if (isSuggestedCandidate && mConfigCandidateHighlightFontColorEnabled) {
color = mColorSuggestedCandidate;
} else {
color = mColorTypedWord;
@@ -349,8 +349,10 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
@Override
public boolean onLongClick(View view) {
- int index = (Integer) view.getTag();
- CharSequence word = mSuggestions.getWord(index);
+ final int index = (Integer) view.getTag();
+ if (index >= mSuggestions.size())
+ return true;
+ final CharSequence word = mSuggestions.getWord(index);
if (word.length() < 2)
return false;
addToDictionary(word);
@@ -359,8 +361,10 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
@Override
public void onClick(View view) {
- int index = (Integer) view.getTag();
- CharSequence word = mSuggestions.getWord(index);
+ final int index = (Integer) view.getTag();
+ if (index >= mSuggestions.size())
+ return;
+ final CharSequence word = mSuggestions.getWord(index);
if (mShowingAddToDictionary && index == 0) {
addToDictionary(word);
} else {
diff --git a/java/src/com/android/inputmethod/latin/ContactsDictionary.java b/java/src/com/android/inputmethod/latin/ContactsDictionary.java
index b057cf4e3..66a041508 100644
--- a/java/src/com/android/inputmethod/latin/ContactsDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ContactsDictionary.java
@@ -40,7 +40,7 @@ public class ContactsDictionary extends ExpandableDictionary {
/**
* Frequency for contacts information into the dictionary
*/
- private static final int FREQUENCY_FOR_CONTACTS = 128;
+ private static final int FREQUENCY_FOR_CONTACTS = 40;
private static final int FREQUENCY_FOR_CONTACTS_BIGRAM = 90;
private static final int INDEX_NAME = 1;
@@ -114,7 +114,7 @@ public class ContactsDictionary extends ExpandableDictionary {
while (!cursor.isAfterLast()) {
String name = cursor.getString(INDEX_NAME);
- if (name != null) {
+ if (name != null && -1 == name.indexOf('@')) {
int len = name.length();
String prevWord = null;
@@ -143,8 +143,6 @@ public class ContactsDictionary extends ExpandableDictionary {
if (wordLen < maxWordLength && wordLen > 1) {
super.addWord(word, FREQUENCY_FOR_CONTACTS);
if (!TextUtils.isEmpty(prevWord)) {
- // TODO Do not add email address
- // Not so critical
super.setBigram(prevWord, word,
FREQUENCY_FOR_CONTACTS_BIGRAM);
}