Back button to dismiss the more suggestions

Bug: 5275063
Change-Id: If31e9a25d827f44c8d4ff455a780ec2a6d2d9bef
main
Tadashi G. Takaoka 2011-09-09 09:33:35 +09:00
parent a08a7e99b4
commit 2cb36637f4
2 changed files with 10 additions and 3 deletions

View File

@ -35,7 +35,6 @@ import android.preference.PreferenceActivity;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.util.PrintWriterPrinter; import android.util.PrintWriterPrinter;
import android.util.Printer; import android.util.Printer;
@ -1011,8 +1010,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) { switch (keyCode) {
case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_BACK:
if (event.getRepeatCount() == 0 && mKeyboardSwitcher.getKeyboardView() != null) { if (event.getRepeatCount() == 0) {
if (mKeyboardSwitcher.getKeyboardView().handleBack()) { if (mSuggestionsView != null && mSuggestionsView.handleBack()) {
return true;
}
final LatinKeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
if (keyboardView != null && keyboardView.handleBack()) {
return true; return true;
} }
} }

View File

@ -728,6 +728,10 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
return false; return false;
} }
public boolean handleBack() {
return dismissMoreSuggestions();
}
@Override @Override
public boolean onLongClick(View view) { public boolean onLongClick(View view) {
final SuggestionsViewParams params = mParams; final SuggestionsViewParams params = mParams;