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

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

    setTitle(null);

    mProgressBar.setMax(100);
    webView.setWebChromeClient(
        new WebChromeClient() {
          @Override
          public void onProgressChanged(WebView view, int progress) {
            if (progress < 100 && mProgressBar.getVisibility() == ProgressBar.GONE) {
              mProgressBar.setVisibility(ProgressBar.VISIBLE);
            }
            mProgressBar.setProgress(progress);
            if (progress == 100) {
              mProgressBar.setVisibility(ProgressBar.GONE);
            }
          }

          @Override
          public void onReceivedTitle(WebView view, String title) {
            super.onReceivedTitle(view, title);
            if (title != null && title.length() > 0) {
              setTitle(title);
            } else {
              setTitle(null);
            }
          }
        });
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
          }
        });

    if (savedInstanceState == null) {
      webView.loadUrl(mUrl);
    }
  }
Exemplo n.º 2
0
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   webView.restoreState(savedInstanceState);
 }
Exemplo n.º 3
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   webView.saveState(outState);
 }