Ejemplo n.º 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();
    }
  }
 @Override
 public boolean shouldOverrideUrlLoading(WebView view, String url) {
   if (url.startsWith("file")) {
     // Keep local assets in this WebView.
     return false;
   } else if (url.startsWith("mailto:")) {
     try {
       MailTo mt = MailTo.parse(url);
       Intent i = new Intent(Intent.ACTION_SEND);
       i.setType("message/rfc822");
       i.putExtra(Intent.EXTRA_EMAIL, new String[] {mt.getTo()});
       i.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
       context.startActivity(i);
       view.reload();
     } catch (ActivityNotFoundException e) {
       Log.w(TAG, "Problem with Intent.ACTION_SEND", e);
       new AlertDialog.Builder(context)
           .setTitle("Contact Info")
           .setMessage("Please send your feedback to: [email protected]")
           .setPositiveButton(
               "Done",
               new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface dialog, int which) {
                   Log.d("AlertDialog", "Positive");
                 }
               })
           .show();
     }
     return true;
   } else {
     // Open external URLs in Browser.
     startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
     return true;
   }
 }
 public boolean shouldOverrideUrlLoading(WebView paramWebView, String paramString) {
   Object localObject;
   if (paramString.startsWith("mailto:")) {
     localObject = a;
     paramString = MailTo.parse(paramString);
     paramString =
         a(
             paramString.getTo(),
             paramString.getSubject(),
             paramString.getBody(),
             paramString.getCc());
   }
   try {
     ((Activity) localObject).startActivity(paramString);
     paramWebView.reload();
     return true;
     localObject = new HashMap();
     ((Map) localObject).put("Referer", WebActivity.c(a));
     paramWebView.loadUrl(paramString, (Map) localObject);
     return true;
   } catch (Exception paramString) {
     for (; ; ) {}
   }
 }
Ejemplo n.º 4
0
  protected void processCallBackUrl(String var1) {
    if (this.progressBar != null) {
      this.progressBar.setVisibility(0);
    }

    if (var1.contains("rtsp://")) {
      Intent var4 = new Intent("android.intent.action.VIEW", Uri.parse(var1));
      var4.setFlags(1073741824);
      this.startActivity(var4);
    } else if (var1.startsWith("mailto:")) {
      MailTo var3 = MailTo.parse(var1);
      Intent var2 = new Intent("android.intent.action.SEND");
      var2.setType("text/plain");
      var2.putExtra("android.intent.extra.EMAIL", new String[] {var3.getTo()});
      var2.putExtra("android.intent.extra.SUBJECT", var3.getSubject());
      var2.putExtra("android.intent.extra.CC", var3.getCc());
      var2.putExtra("android.intent.extra.TEXT", var3.getBody());
      this.startActivity(var2);
    } else {
      this.currentUrl = var1;
      this.webView.loadUrl(var1);
    }
  }