content: package com.cjj.mousepaint;
  
  import android.content.Context;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.os.PersistableBundle;
  import android.util.Log;
  import android.view.KeyEvent;
  import android.view.View;
  import android.webkit.WebChromeClient;
  import android.webkit.WebSettings;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.widget.Toast;
  
  import com.cjj.mousepaint.utils.StatusBarCompat;
  
  import butterknife.Bind;
  import butterknife.ButterKnife;
  
  public class WebActivity extends BaseActivity {
  
      public static final String EXTRA_URL = "extra_url";
      public static final String EXTRA_TITLE = "title";
  
      @Bind(R.id.webView) WebView mWebView;
  //    @Bind(R.id.swipe_back) SwipebackLayout mSwipeBack;
  
      Context mContext;
      String mUrl, mTitle;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_web);
          ButterKnife.bind(this);
          StatusBarCompat.compat(this, getResources().getColor(R.color.black_tran));
          mContext = this;
          mUrl = getIntent().getStringExtra(EXTRA_URL);
          Log.i("url","url----->"+mUrl);
          mTitle = getIntent().getStringExtra(EXTRA_TITLE);
  
          WebSettings settings = mWebView.getSettings();
          settings.setJavaScriptEnabled(true);
          settings.setLoadWithOverviewMode(true);
          settings.setAppCacheEnabled(true);
          settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
          settings.setSupportZoom(true);
          mWebView.setWebChromeClient(new ChromeClient());
          mWebView.setWebViewClient(new MyWebClient());
  
          mWebView.loadUrl(mUrl);
  
      }
  
  
  
  
      @Override public boolean onKeyDown(int keyCode, KeyEvent event) {
          if (event.getAction() == KeyEvent.ACTION_DOWN) {
              switch (keyCode) {
                  case KeyEvent.KEYCODE_BACK:
                      if (mWebView.canGoBack()) {
                          mWebView.goBack();
                      }
                      else {
                          finish();
                      }
                      return true;
              }
          }
          return super.onKeyDown(keyCode, event);
      }
  
      @Override protected void onDestroy() {
          super.onDestroy();
          if (mWebView != null) mWebView.destroy();
          ButterKnife.unbind(this);
      }
  
      @Override protected void onPause() {
          if (mWebView != null) mWebView.onPause();
          super.onPause();
      }
  
      @Override protected void onResume() {
          super.onResume();
          if (mWebView != null) mWebView.onResume();
      }
  
      private class ChromeClient extends WebChromeClient {
  
          @Override public void onProgressChanged(WebView view, int newProgress) {
              super.onProgressChanged(view, newProgress);
  //            mProgressbar.setProgress(newProgress);
          }
  
          @Override public void onReceivedTitle(WebView view, String title) {
              super.onReceivedTitle(view, title);
              setTitle(title);
          }
      }
  
      private class MyWebClient extends WebViewClient {
  
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              if (url != null) view.loadUrl(url);
              return true;
          }
      }
  }
  