use of org.geometerplus.fbreader.network.tree.SearchCatalogTree in project FBReaderJ by geometer.
the class NetworkSearchActivity method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
final Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
final Bundle data = intent.getBundleExtra(SearchManager.APP_DATA);
if (data != null) {
final NetworkLibrary library = Util.networkLibrary(this);
final NetworkTree.Key key = (NetworkTree.Key) data.getSerializable(NetworkLibraryActivity.TREE_KEY_KEY);
final NetworkTree tree = library.getTreeByKey(key);
if (tree instanceof SearchCatalogTree) {
final SearchCatalogTree searchTree = (SearchCatalogTree) tree;
final String pattern = intent.getStringExtra(SearchManager.QUERY);
final MimeType mime = searchTree.getMimeType();
if (MimeType.APP_ATOM_XML.weakEquals(mime)) {
searchTree.startItemsLoader(myNetworkContext, pattern);
} else if (MimeType.TEXT_HTML.weakEquals(mime)) {
Util.openInBrowser(this, searchTree.getUrl(pattern));
}
}
}
}
finish();
}
Aggregations