Exemplo n.º 1
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    try {
      MetaioCloudUtils.unbindDrawables(findViewById(android.R.id.content));

      mWebView.destroy();

    } catch (Exception e) {

    }
  }
Exemplo n.º 2
0
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
      JunaioChannel channel = null;

      try {
        // Try to launch default intent first if valid
        Intent intent = MetaioCloudPlugin.getDefaultIntent(url);
        if (intent != null) {
          try {
            startActivity(intent);
            return true;
          } catch (Exception e) {
            MetaioCloudPlugin.log(
                Log.ERROR, "WebViewActivity: Failed to launched the default intent");
            return false;
          }
        }
      } catch (Exception e) {
      }
      try {

        if (url.compareToIgnoreCase("junaio://?action=closewebview") == 0) {
          MetaioCloudPlugin.log("Closing webview: " + url);
          finish();
          return true;
        } else if ((channel = MetaioCloudUtils.parseUrl(Uri.parse(url))) != null
            && channel.getChannelID() > -1) {
          MetaioCloudPlugin.log("Channel ID: " + channel.getChannelID());
          MetaioCloudPlugin.getDataSource()
              .loadPOIsAndChannelInformationForID(channel.getChannelID());
          finish();
          return true;
        }
        // Open in Google Docs viewer if supported file type (based on file extention)
        else if (MetaioCloudPlugin.isSupportedOnGoogleDocs(url)
            && !url.contains("docs.google.com/gview?embedded")) {
          url = "http://docs.google.com/gview?embedded=true&url=" + url;
          view.loadUrl(url);
          return true;

        } else if (url.contains("youtube.com")) {
          Uri parsedUrl = Uri.parse(url);
          Intent youtubeIntent = new Intent(Intent.ACTION_VIEW, parsedUrl);
          startActivity(youtubeIntent);
          finish();
          return true;
        } else if (url.startsWith("http")) {
          view.loadUrl(url);
          return false; // load it in webview
        } else {
          Intent externalIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
          externalIntent.addCategory(Intent.CATEGORY_BROWSABLE);
          startActivity(externalIntent);
          return true;
        }
      } catch (Exception e) {
        return false;
      }

      //			return false;
    }