mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
BookmarksActivity search code cleanup: separate search activity has been removed
Conflicts: AndroidManifest.xml AndroidManifest.xml.pattern src/org/geometerplus/android/fbreader/BookmarksActivity.java
This commit is contained in:
parent
0ac85a8404
commit
97bb486f67
1 changed files with 37 additions and 0 deletions
|
@ -103,6 +103,43 @@ public class BookmarksActivity extends TabActivity implements MenuItem.OnMenuIte
|
||||||
findViewById(R.id.search_results).setVisibility(View.GONE);
|
findViewById(R.id.search_results).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Bookmark> runSearch(String pattern) {
|
||||||
|
final FBReaderApp fbreader = (FBReaderApp)FBReaderApp.Instance();
|
||||||
|
fbreader.BookmarkSearchPatternOption.setValue(pattern);
|
||||||
|
|
||||||
|
final LinkedList<Bookmark> bookmarks = new LinkedList<Bookmark>();
|
||||||
|
pattern = pattern.toLowerCase();
|
||||||
|
for (Bookmark bookmark : BookmarksActivity.Instance.AllBooksBookmarks) {
|
||||||
|
if (ZLMiscUtil.matchesIgnoreCase(bookmark.getText(), pattern)) {
|
||||||
|
bookmarks.add(bookmark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bookmarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
if (!Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pattern = intent.getStringExtra(SearchManager.QUERY);
|
||||||
|
final FBReaderApp fbreader = (FBReaderApp)FBReaderApp.Instance();
|
||||||
|
fbreader.BookmarkSearchPatternOption.setValue(pattern);
|
||||||
|
|
||||||
|
final LinkedList<Bookmark> bookmarks = new LinkedList<Bookmark>();
|
||||||
|
pattern = pattern.toLowerCase();
|
||||||
|
for (Bookmark b : BookmarksActivity.Instance.AllBooksBookmarks) {
|
||||||
|
if (ZLMiscUtil.matchesIgnoreCase(b.getText(), pattern)) {
|
||||||
|
bookmarks.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!bookmarks.isEmpty()) {
|
||||||
|
showSearchResultsTab(bookmarks);
|
||||||
|
} else {
|
||||||
|
UIUtil.showErrorMessage(this, "bookmarkNotFound");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
if (!Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
if (!Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue