From 0c6cca901d467af394f4cf975d0f819c899185d7 Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Mon, 13 Aug 2012 14:24:50 +0100 Subject: Android: react to search button --- android/src/com/artifex/mupdf/MuPDFActivity.java | 35 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'android/src') diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java index 5696ea0b..ad72961b 100644 --- a/android/src/com/artifex/mupdf/MuPDFActivity.java +++ b/android/src/com/artifex/mupdf/MuPDFActivity.java @@ -576,21 +576,25 @@ public class MuPDFActivity extends Activity } void searchModeOn() { - mTopBarIsSearch = true; - //Focus on EditTextWidget - mSearchText.requestFocus(); - showKeyboard(); - mTopBarSwitcher.showNext(); + if (!mTopBarIsSearch) { + mTopBarIsSearch = true; + //Focus on EditTextWidget + mSearchText.requestFocus(); + showKeyboard(); + mTopBarSwitcher.showNext(); + } } void searchModeOff() { - mTopBarIsSearch = false; - hideKeyboard(); - mTopBarSwitcher.showPrevious(); - SearchTaskResult.set(null); - // Make the ReaderView act on the change to mSearchTaskResult - // via overridden onChildSetup method. - mDocView.resetupChildren(); + if (mTopBarIsSearch) { + mTopBarIsSearch = false; + hideKeyboard(); + mTopBarSwitcher.showPrevious(); + SearchTaskResult.set(null); + // Make the ReaderView act on the change to mSearchTaskResult + // via overridden onChildSetup method. + mDocView.resetupChildren(); + } } void updatePageNumView(int index) { @@ -718,4 +722,11 @@ public class MuPDFActivity extends Activity mSearchTask.safeExecute(new Integer(direction)); } + + @Override + public boolean onSearchRequested() { + showButtons(); + searchModeOn(); + return super.onSearchRequested(); + } } -- cgit v1.2.3