summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2010-05-06 14:27:07 -0400
committerLeon Scroggins III <scroggo@google.com>2010-05-06 14:27:07 -0400
commitcda8600237ad458e9579b34541ef6fa3504e10b4 (patch)
tree25d569152958eb936c8d70da3fed8a237cd2a900
parent95953dda5295c1d6cdcff2807c683d525c234b3c (diff)
downloadpackages_apps_Browser-cda8600237ad458e9579b34541ef6fa3504e10b4.zip
packages_apps_Browser-cda8600237ad458e9579b34541ef6fa3504e10b4.tar.gz
packages_apps_Browser-cda8600237ad458e9579b34541ef6fa3504e10b4.tar.bz2
Close find in BACK rather than just dismissing IME
Bug 2641316 Change-Id: I2f706d2e7e3cce47c7a7db319fdcbac10b3780ad
-rw-r--r--src/com/android/browser/FindDialog.java27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/com/android/browser/FindDialog.java b/src/com/android/browser/FindDialog.java
index 93a64d4..9646952 100644
--- a/src/com/android/browser/FindDialog.java
+++ b/src/com/android/browser/FindDialog.java
@@ -131,14 +131,29 @@ import android.widget.TextView;
}
@Override
+ public boolean dispatchKeyEventPreIme(KeyEvent event) {
+ if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ KeyEvent.DispatcherState state = getKeyDispatcherState();
+ if (state != null) {
+ int action = event.getAction();
+ if (KeyEvent.ACTION_DOWN == action
+ && event.getRepeatCount() == 0) {
+ state.startTracking(event, this);
+ return true;
+ } else if (KeyEvent.ACTION_UP == action
+ && !event.isCanceled() && state.isTracking(event)) {
+ mBrowserActivity.closeFind();
+ return true;
+ }
+ }
+ }
+ return super.dispatchKeyEventPreIme(event);
+ }
+
+ @Override
public boolean dispatchKeyEvent(KeyEvent event) {
int keyCode = event.getKeyCode();
- if (keyCode == KeyEvent.KEYCODE_BACK) {
- if (event.getAction() == KeyEvent.ACTION_UP) {
- mBrowserActivity.closeFind();
- return true;
- }
- } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ if (event.getAction() == KeyEvent.ACTION_UP) {
if (keyCode == KeyEvent.KEYCODE_ENTER
&& mEditText.hasFocus()) {
if (mMatchesFound) {