Пример #1
0
  @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 = NetworkLibrary.Instance();
        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(new QuietNetworkContext(), pattern);
          } else if (MimeType.TEXT_HTML.weakEquals(mime)) {
            Util.openInBrowser(this, searchTree.getUrl(pattern));
          }
        }
      }
    }
    finish();
  }
Пример #2
0
 private static void doBuyInBrowser(Activity activity, final NetworkBookItem book) {
   BookUrlInfo reference = book.reference(UrlInfo.Type.BookBuyInBrowser);
   if (reference != null) {
     Util.openInBrowser(activity, reference.Url);
   }
 }