Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_innerweb);
    ButterKnife.bind(this);

    StatusBarHelper.setStatusBar(this);

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    WebSettings webSettings = wbInnerweb.getSettings();
    webSettings.setBuiltInZoomControls(true);
    webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setSaveFormData(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setDomStorageEnabled(true);
    wbInnerweb.requestFocus();
    wbInnerweb.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

    wbInnerweb.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url.indexOf("tel:") < 0) {
              view.loadUrl(url);
            }
            return true;
          }

          @Override
          public void onPageStarted(WebView view, String url, Bitmap favicon) {
            pbLoading.setVisibility(View.VISIBLE);
            super.onPageStarted(view, url, favicon);
          }

          @Override
          public void onPageFinished(WebView view, String url) {
            pbLoading.setVisibility(View.GONE);
            wbInnerweb.setVisibility(View.VISIBLE);
            super.onPageFinished(view, url);
          }
        });

    mUrl = getIntent().getStringExtra(PARAM_WEB_URL);
    wbInnerweb.loadUrl(mUrl);
  }
Exemplo n.º 2
0
 @Override
 public void setContentView(int layoutResID) {
   super.setContentView(layoutResID);
   StatusBarHelper.setStatusBar(this);
 }