diff options
Diffstat (limited to 'java/src')
3 files changed, 30 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboardView.java index 0e6e129bb..f2c5b7b49 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboardView.java @@ -27,7 +27,6 @@ import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy; import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; import com.android.inputmethod.latin.R; - /** * A view that renders a virtual {@link MiniKeyboard}. It handles rendering of keys and detecting * key presses and touch movements. @@ -115,7 +114,7 @@ public class MiniKeyboardView extends KeyboardView implements MoreKeysPanel { @Override public DrawingProxy getDrawingProxy() { - return this; + return this; } @Override @@ -174,9 +173,15 @@ public class MiniKeyboardView extends KeyboardView implements MoreKeysPanel { return x; } + private boolean mIsDismissing; + @Override public boolean dismissMoreKeysPanel() { - return mController.dismissMoreKeysPanel(); + if (mIsDismissing) return false; + mIsDismissing = true; + final boolean dismissed = mController.dismissMoreKeysPanel(); + mIsDismissing = false; + return dismissed; } @Override diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java index 51f6c040d..c61dd6313 100644 --- a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java @@ -35,7 +35,6 @@ import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy; import com.android.inputmethod.keyboard.PointerTracker.KeyEventHandler; import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; - /** * A view that renders a virtual {@link MoreSuggestions}. It handles rendering of keys and detecting * key presses and touch movements. @@ -125,7 +124,7 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { @Override public DrawingProxy getDrawingProxy() { - return this; + return this; } @Override @@ -180,10 +179,15 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { return x; } + private boolean mIsDismissing; + @Override public boolean dismissMoreKeysPanel() { - if (mController == null) return false; - return mController.dismissMoreKeysPanel(); + if (mIsDismissing) return false; + mIsDismissing = true; + final boolean dismissed = mController.dismissMoreKeysPanel(); + mIsDismissing = false; + return dismissed; } @Override diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index 8f478f385..095c2c51c 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -61,11 +61,6 @@ public class AndroidSpellCheckerService extends SpellCheckerService { private static final int CAPITALIZE_ALL = 2; // All caps private final static String[] EMPTY_STRING_ARRAY = new String[0]; - private final static SuggestionsInfo NOT_IN_DICT_EMPTY_SUGGESTIONS = - new SuggestionsInfo(0, EMPTY_STRING_ARRAY); - private final static SuggestionsInfo IN_DICT_EMPTY_SUGGESTIONS = - new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, - EMPTY_STRING_ARRAY); private final static Flag[] USE_FULL_EDIT_DISTANCE_FLAG_ARRAY; static { // See BinaryDictionary.java for an explanation of these flags @@ -103,6 +98,15 @@ public class AndroidSpellCheckerService extends SpellCheckerService { return new AndroidSpellCheckerSession(this); } + private static SuggestionsInfo getNotInDictEmptySuggestions() { + return new SuggestionsInfo(0, EMPTY_STRING_ARRAY); + } + + private static SuggestionsInfo getInDictEmptySuggestions() { + return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, + EMPTY_STRING_ARRAY); + } + private static class SuggestionsGatherer implements WordCallback { public static class Result { public final String[] mSuggestions; @@ -408,9 +412,9 @@ public class AndroidSpellCheckerService extends SpellCheckerService { DictAndProximity dictInfo = null; try { dictInfo = mDictionaryPool.takeOrGetNull(); - if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS; - return dictInfo.mDictionary.isValidWord(text) ? IN_DICT_EMPTY_SUGGESTIONS - : NOT_IN_DICT_EMPTY_SUGGESTIONS; + if (null == dictInfo) return getNotInDictEmptySuggestions(); + return dictInfo.mDictionary.isValidWord(text) ? getInDictEmptySuggestions() + : getNotInDictEmptySuggestions(); } finally { if (null != dictInfo) { if (!mDictionaryPool.offer(dictInfo)) { @@ -445,7 +449,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService { DictAndProximity dictInfo = null; try { dictInfo = mDictionaryPool.takeOrGetNull(); - if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS; + if (null == dictInfo) return getNotInDictEmptySuggestions(); dictInfo.mDictionary.getWords(composer, suggestionsGatherer, dictInfo.mProximityInfo); isInDict = dictInfo.mDictionary.isValidWord(text); @@ -490,7 +494,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService { throw e; } else { Log.e(TAG, "Exception while spellcheking: " + e); - return NOT_IN_DICT_EMPTY_SUGGESTIONS; + return getNotInDictEmptySuggestions(); } } } |