aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-10-03 14:06:44 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-10-03 15:09:10 +0900
commitc6ff7c42d9aeafe2b2d21a34be10f1e9a450153a (patch)
treea7c6edc52be40be97037d07d5cf4a84e740f093e /java/src/com/android/inputmethod/latin/LatinIME.java
parent3e5a3c18bebbfb56012383411b24ee81ffde09cb (diff)
downloadlatinime-c6ff7c42d9aeafe2b2d21a34be10f1e9a450153a.tar.gz
latinime-c6ff7c42d9aeafe2b2d21a34be10f1e9a450153a.tar.xz
latinime-c6ff7c42d9aeafe2b2d21a34be10f1e9a450153a.zip
Add SuggestedWords.isEmpty() method
Change-Id: I0fcb104a6a81aee4b99f5ee848eba7495630dc7d
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java20
1 files changed, 8 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 69a4fa63c..c0938cf97 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1518,8 +1518,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords,
final boolean dismissGestureFloatingPreviewText) {
- final String batchInputText = (suggestedWords.size() > 0)
- ? suggestedWords.getWord(0) : null;
+ final String batchInputText = suggestedWords.isEmpty()
+ ? null : suggestedWords.getWord(0);
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
mainKeyboardView.showGestureFloatingPreviewText(batchInputText);
showSuggestionStrip(suggestedWords, null);
@@ -1537,8 +1537,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
public void onEndBatchInput(final InputPointers batchPointers) {
final SuggestedWords suggestedWords = BatchInputUpdater.getInstance().onEndBatchInput(
batchPointers, this);
- final String batchInputText = (suggestedWords.size() > 0)
- ? suggestedWords.getWord(0) : null;
+ final String batchInputText = suggestedWords.isEmpty()
+ ? null : suggestedWords.getWord(0);
if (TextUtils.isEmpty(batchInputText)) {
return;
}
@@ -1963,19 +1963,15 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private void showSuggestionStrip(final SuggestedWords suggestedWords,
final CharSequence typedWord) {
- if (null == suggestedWords || suggestedWords.size() <= 0) {
+ if (suggestedWords.isEmpty()) {
clearSuggestionStrip();
return;
}
final CharSequence autoCorrection;
- if (suggestedWords.size() > 0) {
- if (suggestedWords.mWillAutoCorrect) {
- autoCorrection = suggestedWords.getWord(1);
- } else {
- autoCorrection = typedWord;
- }
+ if (suggestedWords.mWillAutoCorrect) {
+ autoCorrection = suggestedWords.getWord(1);
} else {
- autoCorrection = null;
+ autoCorrection = typedWord;
}
mWordComposer.setAutoCorrection(autoCorrection);
final boolean isAutoCorrection = suggestedWords.willAutoCorrect();