Exemple #1
1
  @Override
  public synchronized void loadUrl(String url) {
    if (url == null || url.trim().isEmpty()) {
      NinjaToast.show(context, R.string.toast_load_error);
      return;
    }

    url = BrowserUnit.queryWrapper(context, url.trim());
    if (url.startsWith(BrowserUnit.URL_SCHEME_MAIL_TO)) {
      Intent intent = IntentUnit.getEmailIntent(MailTo.parse(url));
      context.startActivity(intent);
      reload();

      return;
    } else if (url.startsWith(BrowserUnit.URL_SCHEME_INTENT)) {
      Intent intent;
      try {
        intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
        context.startActivity(intent);
      } catch (URISyntaxException u) {
      }

      return;
    }

    webViewClient.updateWhite(adBlock.isWhite(url));
    super.loadUrl(url);
    if (browserController != null && foreground) {
      browserController.updateBookmarks();
    }
  }
Exemple #2
0
 public synchronized void update(String title, String url) {
   album.setAlbumTitle(title);
   if (foreground) {
     browserController.updateBookmarks();
     browserController.updateInputBox(url);
   }
 }
Exemple #3
0
  public synchronized void update(int progress) {
    if (foreground) {
      browserController.updateProgress(progress);
    }

    setAlbumCover(ViewUnit.capture(this, dimen144dp, dimen108dp, false, Bitmap.Config.RGB_565));
    if (isLoadFinish()) {
      SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
      if (sp.getBoolean(context.getString(R.string.sp_scroll_bar), true)) {
        setHorizontalScrollBarEnabled(true);
        setVerticalScrollBarEnabled(true);
      } else {
        setHorizontalScrollBarEnabled(false);
        setVerticalScrollBarEnabled(false);
      }
      setScrollbarFadingEnabled(true);

      new Handler()
          .postDelayed(
              new Runnable() {
                @Override
                public void run() {
                  setAlbumCover(
                      ViewUnit.capture(
                          NinjaWebView.this, dimen144dp, dimen108dp, false, Bitmap.Config.RGB_565));
                }
              },
              animTime);

      if (prepareRecord()) {
        RecordAction action = new RecordAction(context);
        action.open(true);
        action.addHistory(new Record(getTitle(), getUrl(), System.currentTimeMillis()));
        action.close();
        browserController.updateAutoComplete();
      }
    }
  }