From 0925d57d1cff3db9a93e737ac68c940b464d360c Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Tue, 24 Apr 2012 15:08:39 +0100 Subject: Provoke search with the Return key in addition to the Done key Also ensure that starting a search closes the keyboard. --- android/src/com/artifex/mupdf/MuPDFActivity.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'android/src') diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java index 18c0f864..61ac7cdf 100644 --- a/android/src/com/artifex/mupdf/MuPDFActivity.java +++ b/android/src/com/artifex/mupdf/MuPDFActivity.java @@ -349,16 +349,22 @@ public class MuPDFActivity extends Activity } }); + mSearchText.setOnKeyListener(new View.OnKeyListener() { + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) + search(1); + return false; + } + }); + // Activate search invoking buttons mSearchBack.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { - hideKeyboard(); search(-1); } }); mSearchFwd.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { - hideKeyboard(); search(1); } }); @@ -616,6 +622,7 @@ public class MuPDFActivity extends Activity } void search(int direction) { + hideKeyboard(); if (core == null) return; killSearch(); -- cgit v1.2.3