<commit_before>package com.king.app.workhelper.activity;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.net.Uri;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.king.app.workhelper.R;
import com.king.app.workhelper.common.AppBaseActivity;
import com.king.applib.annotation.DoNotProguard;
import com.king.applib.log.Logger;
import com.king.applib.util.NetworkUtil;

import butterknife.BindView;

/**
 * @author huoguangxu
 * @since 2017/5/18.
 */

public class UploadImageActivity extends AppBaseActivity {
    public static final String ASSET_JS = "file:///android_asset/upload_image.html";

    @BindView(R.id.web_view) WebView mWebView;

    /** 上传图片后的回调.不管返回结果如何都要执行回调，并置为null */
    private ValueCallback<Uri> mPhotoCallback;
    /** 上传图片后的回调，用于5.0+.不管返回结果如何都要执行回调，并置为null */
    private ValueCallback<Uri[]> mPhotoCallbacks;
    
    @Override public int getContentLayout() {
        return R.layout.activity_upload_image;
    }

    @Override protected void initContentView() {
        super.initContentView();

        initWebViewSettings();
        mWebView.setWebViewClient(new DefaultWebViewClient());
        mWebView.setWebChromeClient(new DefaultWebChromeClient());
    }

    @SuppressLint("SetJavaScriptEnabled") 
    private void initWebViewSettings() {
        WebSettings settings = mWebView.getSettings();
//        settings.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
        settings.setAppCacheEnabled(true); //启用应用缓存
        settings.setDomStorageEnabled(true); //启用DOM缓存。
        settings.setDatabaseEnabled(true); //启用DOM缓存。
        settings.setPluginState(WebSettings.PluginState.ON);
        if (NetworkUtil.isNetworkAvailable()) { //判断是否联网
            settings.setCacheMode(WebSettings.LOAD_DEFAULT); //默认的缓存使用模式
        } else {
            settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY); //不从网络加载数据，只从缓存加载数据。
        }

        settings.setJavaScriptEnabled(true);
    }
<commit_msg>[developing]<commit_after>package com.king.app.workhelper.activity;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.net.Uri;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.king.app.workhelper.R;
import com.king.app.workhelper.common.AppBaseActivity;
import com.king.applib.annotation.DoNotProguard;
import com.king.applib.log.Logger;
import com.king.applib.util.NetworkUtil;

import butterknife.BindView;

/**
 * @author huoguangxu
 * @since 2017/5/18.
 */

public class UploadImageActivity extends AppBaseActivity {
    public static final String ASSET_JS = "file:///android_asset/upload_image.html";

    @BindView(R.id.web_view) WebView mWebView;

    /** 上传图片后的回调.不管返回结果如何都要执行回调，并置为null */
    private ValueCallback<Uri> mPhotoCallback;
    /** 上传图片后的回调，用于5.0+.不管返回结果如何都要执行回调，并置为null */
    private ValueCallback<Uri[]> mPhotoCallbacks;
    
    @Override public int getContentLayout() {
        return 0;
    }

    @Override protected void initContentView() {
        super.initContentView();

        initWebViewSettings();
        mWebView.setWebViewClient(new DefaultWebViewClient());
        mWebView.setWebChromeClient(new DefaultWebChromeClient());
    }

    @SuppressLint("SetJavaScriptEnabled") 
    private void initWebViewSettings() {
        WebSettings settings = mWebView.getSettings();
//        settings.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
        settings.setAppCacheEnabled(true); //启用应用缓存
        settings.setDomStorageEnabled(true); //启用DOM缓存。
        settings.setDatabaseEnabled(true); //启用DOM缓存。
        settings.setPluginState(WebSettings.PluginState.ON);
        if (NetworkUtil.isNetworkAvailable()) { //判断是否联网
            settings.setCacheMode(WebSettings.LOAD_DEFAULT); //默认的缓存使用模式
        } else {
            settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY); //不从网络加载数据，只从缓存加载数据。
        }

        settings.setJavaScriptEnabled(true);
    }

{'fraction_non_alphanumeric': 0.11079943899018233, 'fraction_numerical': 0.01425899953249182, 'mean_word_length': 3.8569807037457435, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5833935', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1461, 'n_words': 206}