mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
cleanup: TextSearchActivity has gone
This commit is contained in:
parent
f8c0b02184
commit
2f318fe914
5 changed files with 39 additions and 87 deletions
|
@ -25,8 +25,9 @@ import android.app.SearchManager;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import org.geometerplus.zlibrary.core.application.ZLApplication;
|
||||
|
@ -51,6 +52,8 @@ import org.geometerplus.fbreader.library.Book;
|
|||
|
||||
import org.geometerplus.android.fbreader.library.KillerCallback;
|
||||
|
||||
import org.geometerplus.android.util.UIUtil;
|
||||
|
||||
public final class FBReader extends ZLAndroidActivity {
|
||||
public static final String BOOK_PATH_KEY = "BookPath";
|
||||
|
||||
|
@ -145,6 +148,37 @@ public final class FBReader extends ZLAndroidActivity {
|
|||
fbReader.addAction(ActionCode.PROCESS_HYPERLINK, new ProcessHyperlinkAction(this, fbReader));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||
final String pattern = intent.getStringExtra(SearchManager.QUERY);
|
||||
final Handler successHandler = new Handler() {
|
||||
public void handleMessage(Message message) {
|
||||
showTextSearchControls(true);
|
||||
}
|
||||
};
|
||||
final Handler failureHandler = new Handler() {
|
||||
public void handleMessage(Message message) {
|
||||
UIUtil.showErrorMessage(FBReader.this, "textNotFound");
|
||||
}
|
||||
};
|
||||
final Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
final FBReaderApp fbReader = (FBReaderApp)FBReaderApp.Instance();
|
||||
fbReader.TextSearchPatternOption.setValue(pattern);
|
||||
if (fbReader.getTextView().search(pattern, true, false, false, false) != 0) {
|
||||
successHandler.sendEmptyMessage(0);
|
||||
} else {
|
||||
failureHandler.sendEmptyMessage(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
UIUtil.wait("search", runnable, this);
|
||||
} else {
|
||||
super.onNewIntent(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue