예제 #1
0
  @Override
  public void initData() {
    super.initData();

    title = getIntent().getStringExtra(INTENTKEY_STRING_TITLE);
    url = getIntent().getStringExtra(INTENTKEY_STRING_URL);
  }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web);

    webView.loadUrl(url);
  }
예제 #3
0
  @Override
  public void initView() {
    super.initView();

    if (TextUtils.isEmpty(title)) hideTitleView();
    else setTitle(title);

    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setLoadWithOverviewMode(true);

    webView.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // 调用拨号程序
            if (url.startsWith("mailto:") || url.startsWith("geo:") || url.startsWith("tel:")) {
              Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
              startActivity(intent);
              return true;
            }

            view.loadUrl(url); // 在当前的webview中跳转到新的url

            return true;
          }
        });

    // webView.setWebChromeClient(new WebChromeClient() {
    // @Override
    // public void onProgressChanged(WebView view, int newProgress) {
    // mProgressBar.setProgress(newProgress);
    // mProgressBar.postInvalidate();
    // if (newProgress == 100) {
    // mProgressBar.setVisibility(View.GONE);
    // }
    // }
    // });
  }