diff options
Diffstat (limited to 'java/src')
3 files changed, 14 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 08af5c5e3..00cd74b19 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -35,7 +35,6 @@ import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.text.InputType; import android.text.TextUtils; -import android.util.DisplayMetrics; import android.util.Log; import android.util.PrintWriterPrinter; import android.util.Printer; @@ -1011,8 +1010,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: - if (event.getRepeatCount() == 0 && mKeyboardSwitcher.getKeyboardView() != null) { - if (mKeyboardSwitcher.getKeyboardView().handleBack()) { + if (event.getRepeatCount() == 0) { + if (mSuggestionsView != null && mSuggestionsView.handleBack()) { + return true; + } + final LatinKeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView(); + if (keyboardView != null && keyboardView.handleBack()) { return true; } } diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java index f54a48509..695e60ffd 100644 --- a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java @@ -67,7 +67,10 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { @Override public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) { - mListener.onCustomRequest(primaryCode - MoreSuggestions.SUGGESTION_CODE_BASE); + final int index = primaryCode - MoreSuggestions.SUGGESTION_CODE_BASE; + if (index >= 0 && index < SuggestionsView.MAX_SUGGESTIONS) { + mListener.onCustomRequest(index); + } } @Override diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java index 6879f7660..380e73bc0 100644 --- a/java/src/com/android/inputmethod/latin/SuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java @@ -728,6 +728,10 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, return false; } + public boolean handleBack() { + return dismissMoreSuggestions(); + } + @Override public boolean onLongClick(View view) { final SuggestionsViewParams params = mParams; |