Giter VIP home page Giter VIP logo

cachewebview's Introduction

CacheWebView

English

CacheWebView通过拦截资源实现自定义缓存静态资源。突破WebView缓存空间限制,让缓存更简单。让网站离线也能正常访问。

为什么要用CacheWebView

  • 让WebView缓存空间更大
  • 强制缓存静态资源,这样会更快
  • 想方便的拿到web缓存资源,比如说从缓存中拿页面已经加载过的图片

使用方式

引入库

注意2.x.x 不兼容 1.x.x

implementation 'ren.yale.android:cachewebviewlib:2.2.1'

修改代码

Application 里初始化


    WebViewCacheInterceptorInst.getInstance().
                init(new WebViewCacheInterceptor.Builder(this));

给WebView添加拦截

  • 如果你的项目minSdkVersion>=21
    mWebView.setWebViewClient(new WebViewClient(){

            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Nullable
            @Override
            public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
                return  WebViewCacheInterceptorInst.getInstance().interceptRequest(request);
            }

            @Nullable
            @Override
            public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
                return  WebViewCacheInterceptorInst.getInstance().interceptRequest(url);
            }
     });

  • 如果你的项目minSdkVersion<21

将调用 mWebView.loadUrl(url) 的地方替换为:WebViewCacheInterceptorInst.getInstance().loadUrl(mWebView,url)


    mWebView.setWebViewClient(new WebViewClient(){


            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                WebViewCacheInterceptorInst.getInstance().loadUrl(mWebView,request.getUrl().toString());
                return true;
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                WebViewCacheInterceptorInst.getInstance().loadUrl(mWebView,url);
                return true;
            }

            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Nullable
            @Override
            public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
                return  WebViewCacheInterceptorInst.getInstance().interceptRequest(request);
            }

            @Nullable
            @Override
            public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
                return  WebViewCacheInterceptorInst.getInstance().interceptRequest(url);
            }
    });

以上就配置完毕,其他代码不用改,这样拥有默认100M缓存空间;如果你需要更详细的配置,可以看看下面的进阶设置;


  • 腾讯X5内核WebView兼容处理
     mWebView.setWebViewClient(new WebViewClient() {

            @Override
            public WebResourceResponse shouldInterceptRequest(WebView webView, String s) {
                return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().
                        interceptRequest(s));
            }

            @Override
            public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {

                return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().
                        interceptRequest(WebResourceRequestAdapter.adapter(webResourceRequest)));
            }
        });

下面是兼容代码,可以参考:

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class WebResourceRequestAdapter implements android.webkit.WebResourceRequest {

    private com.tencent.smtt.export.external.interfaces.WebResourceRequest mWebResourceRequest;

    private WebResourceRequestAdapter(com.tencent.smtt.export.external.interfaces.WebResourceRequest x5Request){
        mWebResourceRequest = x5Request;
    }

    public static WebResourceRequestAdapter adapter(com.tencent.smtt.export.external.interfaces.WebResourceRequest x5Request){
        return new WebResourceRequestAdapter(x5Request);
    }

    @Override
    public Uri getUrl() {
        return mWebResourceRequest.getUrl();
    }

    @Override
    public boolean isForMainFrame() {
        return mWebResourceRequest.isForMainFrame();
    }

    @Override
    public boolean isRedirect() {
        return mWebResourceRequest.isRedirect();
    }

    @Override
    public boolean hasGesture() {
        return mWebResourceRequest.hasGesture();
    }

    @Override
    public String getMethod() {
        return mWebResourceRequest.getMethod();
    }

    @Override
    public Map<String, String> getRequestHeaders() {
        return mWebResourceRequest.getRequestHeaders();
    }
}

public class WebResourceResponseAdapter extends com.tencent.smtt.export.external.interfaces.WebResourceResponse {

    private android.webkit.WebResourceResponse mWebResourceResponse;

    private WebResourceResponseAdapter(android.webkit.WebResourceResponse webResourceResponse){
        mWebResourceResponse = webResourceResponse;
    }

    public static WebResourceResponseAdapter adapter(android.webkit.WebResourceResponse webResourceResponse){
        if (webResourceResponse == null){
            return null;
        }
        return new WebResourceResponseAdapter(webResourceResponse);

    }

    @Override
    public String getMimeType() {
        return mWebResourceResponse.getMimeType();
    }

    @Override
    public InputStream getData() {
        return mWebResourceResponse.getData();
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    public int getStatusCode() {
        return mWebResourceResponse.getStatusCode();
    }

    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
    @Override
    public Map<String, String> getResponseHeaders() {
        return mWebResourceResponse.getResponseHeaders();
    }

    @Override
    public String getEncoding() {
        return mWebResourceResponse.getEncoding();
    }

    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
    @Override
    public String getReasonPhrase() {
        return mWebResourceResponse.getReasonPhrase();
    }
}


如果你的项目minSdkVersion<21, 在 mWebView.loadUrl(url) 之后调用 WebViewCacheInterceptorInst.getInstance().loadUrl(url,mWebView.getSettings().getUserAgentString());


进阶设置

  • 基本设置
   WebViewCacheInterceptor.Builder builder =  new WebViewCacheInterceptor.Builder(this);

    builder.setCachePath(new File(this.getCacheDir(),"cache_path_name"))//设置缓存路径,默认getCacheDir,名称CacheWebViewCache
                       .setDynamicCachePath(new File(this.getCacheDir(),"dynamic_webview_cache"))
                       .setCacheSize(1024*1024*100)//设置缓存大小,默认100M
                       .setConnectTimeoutSecond(20)//设置http请求链接超时,默认20秒
                       .setReadTimeoutSecond(20)//设置http请求链接读取超时,默认20秒
                       .setCacheType(CacheType.NORMAL);//设置缓存为正常模式,默认模式为强制缓存静态资源

    WebViewCacheInterceptorInst.getInstance().init(builder);
  • 设置缓存后缀

CacheWebview通过后缀判断来缓存静态文件,可以添加删除

    WebViewCacheInterceptor.Builder builder =  new WebViewCacheInterceptor.Builder(this);

    CacheExtensionConfig extension = new CacheExtensionConfig();
    extension.addExtension("json").removeExtension("swf");//添加删除缓存后缀

    builder.setCacheExtensionConfig(extension);

    WebViewCacheInterceptorInst.getInstance().init(builder);

默认有以下后缀缓存

    private static HashSet STATIC = new HashSet() {
        {
            add("html");
            add("htm");
            add("js");
            add("ico");
            add("css");
            add("png");
            add("jpg");
            add("jpeg");
            add("gif");
            add("bmp");
            add("ttf");
            add("woff");
            add("woff2");
            add("otf");
            add("eot");
            add("svg");
            add("xml");
            add("swf");
            add("txt");
            add("text");
            add("conf");
            add("webp");
        }
    };

默认有以下后缀不缓存

    private static HashSet NO_CACH = new HashSet() {
        {
            add("mp4");
            add("mp3");
            add("ogg");
            add("avi");
            add("wmv");
            add("flv");
            add("rmvb");
            add("3gp");
        }
    };
  • 设置Assets路径

CacheWebview可以从Assets路径加载静态资源,只要设置了Assets路径就是开启此功能,默认未开启;


  
    WebViewCacheInterceptor.Builder builder =  new WebViewCacheInterceptor.Builder(this);
    //默认精确匹配地址规则
    builder.setAssetsDir("static");
    
    //后缀匹配规则
    //builder.isAssetsSuffixMod(true);
    //WebViewCacheInterceptorInst.getInstance().initAssetsData(); //后台线程获取Assets文件资源
    
    WebViewCacheInterceptorInst.getInstance().init(builder);

builder.setAssetsDir("static")后匹配规则:

assets 结构如下:

(1)默认精确匹配规则:那么只有满足这种结构的url:http://xxx.com/scripts/jquery.min.js 都会从assets获取资源

(2)后缀匹配规则:那么只要满足这种结构的url:http://xxx.com/x/xx/scripts/jquery.min.js 都会从assets获取资源

  • 自定义拦截规则
    builder.setResourceInterceptor(new ResourceInterceptor() {
            @Override
            public boolean interceptor(String url) {
                return true;//按照默认规则,false 不拦截资源
            }
        });
  • 获取缓存文件

    String url = "http://m.mm131.com/css/at.js";
    InputStream inputStream =  WebViewCacheInterceptorInst.getInstance().getCacheFile(url);
    if (inputStream!=null){

    }

  • 清除缓存文件
    WebViewCacheInterceptorInst.getInstance().clearCache();
  • 强制缓存失效

    强制缓存失效后,由WebView正常加载资源

    WebViewCacheInterceptorInst.getInstance().enableForce(false);
  • HostnameVerifier设置

builder.setTrustAllHostname();不安全

    WebViewCacheInterceptor.Builder builder =  new WebViewCacheInterceptor.Builder(this);
    builder.setTrustAllHostname();//HostnameVerifier不验证,HostnameVerifier.verify()返回true,默认正常验证
    WebViewCacheInterceptorInst.getInstance().init(builder);

  • SSLSocketFactory 设置
    WebViewCacheInterceptor.Builder builder =  new WebViewCacheInterceptor.Builder(this);
    builder.setSSLSocketFactory(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager);//自定义SSLSocketFactory和X509TrustManager
    WebViewCacheInterceptorInst.getInstance().init(builder);

  • Debug log

默认开启debug log , TAG="CacheWebView",可以关闭log

    WebViewCacheInterceptor.Builder builder =  new WebViewCacheInterceptor.Builder(this);
    builder.setDebug(false);
    WebViewCacheInterceptorInst.getInstance().init(builder);

  • 非单例模式

调用方法和单例一样

    WebViewCacheInterceptor.Builder builder =  new WebViewCacheInterceptor.Builder(this);
    WebViewRequestInterceptor webViewRequestInterceptor = builder.build();
    webViewRequestInterceptor.getCacheFile("");

混淆

#CacheWebview
-dontwarn ren.yale.android.cachewebviewlib.**
-keep class ren.yale.android.cachewebviewlib.**{*;}

#okhttp
-dontwarn okhttp3.**
-keep class okhttp3.**{*;}

#okio
-dontwarn okio.**
-keep class okio.**{*;}

贡献

如何贡献代码

博客

如何让Android WebView访问更快

cachewebview's People

Contributors

coderkan avatar gracefulife avatar issuerapota avatar kuwork avatar libinliu2013 avatar po1arbear avatar yale8848 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cachewebview's Issues

对源码的一点质疑,关于资源的 referer

Mobile: all

Android OS: all

NetWork: WiFI/3G/4G/5G

URL: all

LIB Version: 源码


源码里有关资源的referer的获取有些问题,如果页面不是通过 loadUrl 主动加载,比如页面内点击一个url,请求资源的referer就会丢失,有可能造成访问问题。

为什么要把系统缓存也开启

发现这个框架同时开启了系统缓存和自定义缓存 ,关掉系统缓存后,部分图片无法显示 , 也没有使用异步缓存

速度问题

实测在shouldInterceptRequest中拦截request 打开网页的速度会比正常情况慢得多。
原因是因为浏览器使用单线程调用shouldInterceptRequest,而正常情况下浏览器使用多线程加载。

H5加载白屏问题

Mobile: 国产手机~

Android OS: 6.0

NetWork: WiFI/3G/4G/5G

URL: http://shopTest.qdshsh.com/#/userId=179

LIB Version: 1.3.5


WebView 配置:

        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        settings.setDomStorageEnabled(true);
        settings.setDatabaseEnabled(true);
        settings.setAppCacheEnabled(true);
        settings.setAllowFileAccess(true);
        settings.setSavePassword(true);
        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        settings.setUseWideViewPort(true);

偶尔加载H5出现白屏问题 , 请教下~

你好,给个建议

库内部调用webview 和webclient 的地方 最好抽成一个 interface 可以自定义 实现类 用别的webview 我现在项目用的是腾讯的webview 要去你源码修改包名 这样库的耦合性太高了

使用 loadDataWithBaseURL 无法自适应屏幕

Mobile: all

Android OS: all

NetWork: all

URL: none

LIB Version: 1.3.3


我的需求是要加载 HTML 标签而不是 URL,所以我需要使用 loadDataWithBaseURL,在原生的 WebView 是可以做到自适应屏幕,包括字体、图片等,但是 CacheWebView 使用 loadDataWithBaseURL 这个方法出来的效果就跟在电脑的浏览器模拟移动设备一样,字体、图片都非常小,既然 CacheWebView 是继承于原生的 WebView 为什么会有差别呢,是否做了其他处理?
我只是将 CacheWebView 放在 xml,然后调用 loadDataWithBaseURL,没有其他配置。

2.0.0版本的支持https吗

在shouldInterceptRequest方法里面拦截到url,给request添加了header后,调用return WebViewCacheInterceptorInst.getInstance().interceptRequest(view, request); 会报错

报错信息为:javax.net.ssl.SSLPeerUnverifiedException
请问怎么解决?

能否提供全局WebView的方案?

谢谢作者的库,对于加载是提升了不少速度,但是初始加载的时候还是有白屏时间。我搜索了相关文章,有介绍说是可以全局一个webview,首先预加载index.html,然后通过通过路由跳转具体页面,页面关闭时,webview回到index.html页面。我也做了测试,效果是会好很多,但是发现在回退,js调用出现了一些问题,内存占用也很大,作者能否写一个这方面的解决方案,谢谢。

关于缓存的问题

这个自定义的WebView是不是在有网络的情况下就不走缓存了,直接去请求数据了?

关于终止加载的问题

Mobile:

Android OS:

NetWork:

URL:

LIB Version:


好像这个库没有重写停止加载的功能?如果在加载过程中停止、后退、刷新或者点击新链接,就会出现长时间等待。
我尝试在停止加载时主动中断当前httpurlconnection,但是只能终止一个连接而已,后续的资源仍然会加载,感觉有点困惑,不知道该怎么改了(不太清楚原生内核的stoploading都干了些什么工作……)
测试页面可以用360搜索,或者手机乐园官网

你好, 我就想问2个问题

Mobile: coolpad7230
Android OS: 4.2

NetWork: WiFI

URL: asset的html加在线图片

LIB Version: 1.3.7


我基础比较差, 你的代码看不怎么懂, 好像没看到开线程下载缓存资源啊,
还有我用你的库的时候, 我assets里面有内置的html, 里面的图片是在线的url,
我加载的时候发现内置的html也要很久才出来, 我设置了先不加载图片也是一样
而且页面变的很宽, 就好像打开了一个电脑版网页一样

我本来想自定义缓存, 看了很多资料, 但是卡在最后shouldInterceptRequest的返回里面了, 当我没有缓存的资源时, 我就去开线程下载,然后存进缓存里面, 下载完毕却不知道怎么让shouldInterceptRequest返回资源了,因为下载完毕时我在线程里面了, 请问你是怎么解决这个问题的, 谢谢!

清除缓存写成 static 方法

Mobile:

All Android.

Android OS:

All OS

NetWork:

Al Network.

URL:

LIB Version:


现在的清除缓存是需要实例化,希望能够在logout的时候进行完全的缓存清除。

image caching issues

Mobile: All phone
Android OS: 8.0
NetWork: WiFI/3G/4G/5G
URL: Page with big image
LIB Version: ren.yale.android:cachewebviewlib:1.3.5

i have a problem with the current method of caching.
it cause corrupted image when you close unfinished page.
because the webview still caching the image before it completed.
this problem isn't exist on default webview.

使用预加载会导致好多手机加载之后白屏

Mobile: 华为mate8、samsungS8、vivo x9 plus
Android OS: 7.0 7.1 (都是7下面的内核)

NetWork: 4G

URL: http://emobile.jiiiiiin.cn/InvestmentFinance/FinanceCalc/0

LIB Version: compile 'ren.yale.android:cachewebviewlib:1.3.9'


在使用预加载CacheWebView.cacheWebView(this).loadUrl(BaseConfig.getUrl(BaseConfig.URL_FINANCE_URL));无论使用的是这种方式,还是在主application中使用service的方式,以上的手机都会存在加载白屏,目前前端使用的是vue构建的spa应用,但是我觉得和前端无关,只要把这行代码注释,就ok了,下面是,加载的webview相关的生命周期日志,其中onProgressChanged的newProgress只跑到10,就再也不更新了进度了。

但是在我的mate9/mate10上面就不会出现,麻烦老大帮忙解决一下哈。!!!

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:33.144 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:33.144 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:33.144 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ WebChromeClientImpl.onProgressChanged  (WebChromeClientImpl.java:42)
03-26 18:19:33.144 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:89)
03-26 18:19:33.144 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:33.144 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ onProgressChanged 10
03-26 18:19:33.144 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ WebViewClientImpl.onPageStarted  (WebViewClientImpl.java:52)
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:89)
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ 开始加载页面 onPageStarted http://emobile.jiiiiiin.cn/InvestmentFinance?l=false&BankId=9999&b=false&id=354765082709445&_locale=zh_CN&d=ANDROID&m=samsung/SM-G9500&cs=3.01&LoginType=K&sv=7.0
03-26 18:19:33.145 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:33.255 25022-25022/com.csii.mobilebank W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored
03-26 18:19:33.293 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.295 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.296 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.298 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.302 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.304 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.306 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.307 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.315 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.317 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.319 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.321 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.350 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.388 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.408 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.409 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.411 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.412 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.418 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.418 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.420 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.421 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.432 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{3900c V.ED..... ......ID 0,630-1440,1232} during layout: running second layout pass
03-26 18:19:33.433 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{cb02d55 V.ED..... ......ID 0,1580-1443,2182} during layout: running second layout pass
03-26 18:19:33.456 25022-25022/com.csii.mobilebank D/baidu_location_client: baidu location connected ...
03-26 18:19:33.471 25022-25022/com.csii.mobilebank D/ViewRootImpl@eaf2231[MainActivity]: Relayout returned: oldFrame=[0,0][1440,2960] newFrame=[0,0][1440,2960] result=0x1 surface={isValid=true 547147013120} surfaceGenerationChanged=false
03-26 18:19:33.472 25022-25027/com.csii.mobilebank I/art: Compiler allocated 4MB to compile void com.alibaba.android.vlayout.layout.GridLayoutHelper.layoutViews(android.support.v7.widget.RecyclerView$Recycler, android.support.v7.widget.RecyclerView$State, com.alibaba.android.vlayout.VirtualLayoutManager$LayoutStateWrapper, com.alibaba.android.vlayout.layout.LayoutChunkResult, com.alibaba.android.vlayout.LayoutManagerHelper)
03-26 18:19:33.481 25022-25027/com.csii.mobilebank I/art: Do full code cache collection, code=101KB, data=124KB
03-26 18:19:33.481 25022-25027/com.csii.mobilebank I/art: After code cache collection, code=86KB, data=88KB
03-26 18:19:33.717 25022-25027/com.csii.mobilebank I/art: Do partial code cache collection, code=115KB, data=124KB
03-26 18:19:33.717 25022-25027/com.csii.mobilebank I/art: After code cache collection, code=115KB, data=124KB
03-26 18:19:33.717 25022-25027/com.csii.mobilebank I/art: Increasing code cache capacity to 512KB
03-26 18:19:33.731 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.732 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.736 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.737 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.739 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.740 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.741 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.741 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.742 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:33.754 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{9d272d2 V.ED..... ......ID 0,630-1440,1232} during layout: running second layout pass
03-26 18:19:33.754 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{e030fa3 V.ED..... ......ID 0,1580-1443,2182} during layout: running second layout pass
03-26 18:19:33.754 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{12382a0 V.ED..... ......ID 0,2354-1440,2628} during layout: running second layout pass
03-26 18:19:33.776 25022-25022/com.csii.mobilebank D/ViewRootImpl@eaf2231[MainActivity]: Relayout returned: oldFrame=[0,0][1440,2960] newFrame=[0,0][1440,2960] result=0x1 surface={isValid=true 547147013120} surfaceGenerationChanged=false
03-26 18:19:33.867 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{521ef6 V.ED..... ......ID 0,630-1440,1232} during layout: running second layout pass
03-26 18:19:33.867 25022-25022/com.csii.mobilebank I/ViewRootImpl@eaf2231[MainActivity]: requestLayout is already in process
03-26 18:19:33.867 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{aa52f7 V.ED..... ......ID 0,1580-1443,2182} during layout: running second layout pass
03-26 18:19:33.867 25022-25022/com.csii.mobilebank W/View: requestLayout() improperly called by com.alibaba.android.vlayout.LayoutView{fd6c564 V.ED..... ......ID 0,2354-1440,2628} during layout: running second layout pass
03-26 18:19:39.944 25022-25022/com.csii.mobilebank D/ViewRootImpl@eaf2231[MainActivity]: ViewPostImeInputStage processPointer 0
03-26 18:19:39.984 25022-25022/com.csii.mobilebank D/ViewRootImpl@eaf2231[MainActivity]: ViewPostImeInputStage processPointer 1
03-26 18:19:39.990 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:39.993 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:39.993 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:39.993 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ HomeDelegateBase.gotoH5  (HomeDelegateBase.java:225)
03-26 18:19:39.993 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:89)
03-26 18:19:39.993 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:39.993 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ xxxx 理财工具 http://emobile.jiiiiiin.cn/InvestmentFinance/FinanceCalc/0
03-26 18:19:39.993 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.018 25022-25022/com.csii.mobilebank D/TextView: setTypeface with style : 0
03-26 18:19:40.035 25022-25022/com.csii.mobilebank I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
03-26 18:19:40.064 25022-25022/com.csii.mobilebank D/InputTransport: Input channel constructed: fd=108
03-26 18:19:40.064 25022-25022/com.csii.mobilebank D/InputTransport: Input channel destroyed: fd=218
03-26 18:19:40.088 25022-25022/com.csii.mobilebank D/ViewRootImpl@eaf2231[MainActivity]: Relayout returned: oldFrame=[0,0][1440,2960] newFrame=[0,0][1440,2960] result=0x1 surface={isValid=true 547147013120} surfaceGenerationChanged=false
03-26 18:19:40.204 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.206 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:40.206 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.206 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ AbstractWebViewDelegate.initWebView  (AbstractWebViewDelegate.java:99)
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:89)
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ onWebViewDelegateWebViewComponentInitialized url http://emobile.jiiiiiin.cn/InvestmentFinance/FinanceCalc/0
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ CommonSelfWebViewDelegate.onWebViewDelegateWebViewComponentInitialized  (CommonSelfWebViewDelegate.java:125)
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:83)
03-26 18:19:40.207 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.208 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ onWebViewDelegateWebViewComponentInitialized 
03-26 18:19:40.208 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ WebViewDelegateImpl.onBindView  (WebViewDelegateImpl.java:66)
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:89)
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ onBindView loadPage http://emobile.jiiiiiin.cn/InvestmentFinance/FinanceCalc/0
03-26 18:19:40.246 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.261 25022-25143/com.csii.mobilebank D/CacheWebView: visit http://emobile.jiiiiiin.cn/InvestmentFinance/FinanceCalc/0?l=false&BankId=9999&b=false&id=354765082709445&_locale=zh_CN&d=ANDROID&m=samsung/SM-G9500&cs=3.01&LoginType=K&sv=7.0
03-26 18:19:40.298 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ WebChromeClientImpl.onProgressChanged  (WebChromeClientImpl.java:42)
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:89)
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ **onProgressChanged 10**
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ Thread: main
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ WebViewClientImpl.onPageStarted  (WebViewClientImpl.java:52)
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │    LoggerProxy.e  (LoggerProxy.java:89)
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: │ 开始加载页面 onPageStarted http://emobile.jiiiiiin.cn/InvestmentFinance/FinanceCalc/0?l=false&BankId=9999&b=false&id=354765082709445&_locale=zh_CN&d=ANDROID&m=samsung/SM-G9500&cs=3.01&LoginType=K&sv=7.0
03-26 18:19:40.299 25022-25022/com.csii.mobilebank E/PRETTY_LOGGER: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────

缓存文件有时候不存在

你好,我想获取webview已经缓存好的图片,但是有时候该文件不存在,请问是什么原因呢?

CacheStatus cacheStatus = mCacheWebView.getWebViewCache().getCacheFile(url);
if (cacheStatus.isExist()) {
Intent intent = new Intent(context, ImageActivity.class);
context.startActivity(intent);
EventBus.getDefault().postSticky(new WebViewImagClickEvent(cacheStatus.getCacheFile()));
}

建议增加预加载资源

建议增加预加载资源。

大多数情况,如游戏,网站等,都需要在APP第一次安装时,预先装载部分资源。

是否增加assets中都资源装载到缓存区

缓存控制还有很大的问题

我想实现WebView仅缓存图片,可用CacheWebView实现起来并不顺利。
1、不想缓存的html,无论怎么设置,还是被CacheWebView缓存了下来。
2、想缓存的webp,设置后的确缓存下来了,可出现了一个令人窒息的问题,webp的缓存有概率会不可用。
一百多张图片,有时运气好,全部从本地缓存加载了,有时运气不太好,有几十张还得从网络获取,有时运气很不好,一张也没从本地缓存加载出来,全走网络了。
折腾了CacheWebView半天,实现出来的东西并不能让人满意,稳定性非常差。在某些机型上甚至出现了首次从网络获取到图片后,再也加载不出图片的问题。
最后结合CaCheWebView图片堵塞的思路,自己开了下脑洞,在原生WebView上几行代码便实现了仅缓存图片的功能。
供参考:http://m.blog.csdn.net/qq_35813887/article/details/78966907

访问js、css文件永远是200返回

测试时发现If-Modified-Since:Last-Modified和If-None-Match:ETag同时使用去请求js、css文件时(文件未修改),会返回200,同样只添加If-None-Match:ETag也是返回200,但是只添加If-Modified-Since:Last-Modified时才会返回304。这样js、css文件一直不会被缓存。不知其中的原因。。。。

希望添加强制刷新的功能

现在资源缓存之后好像就只能按照过期时间来进行管理,如果资源加载出了问题,就没有办法强制刷新,webview设置load_no_cache也没用。感觉应该在force和normal后面再加一个模式,强制不加载本地缓存,从而更新资源

加载速度

为什么连续打开、关闭某个网页,第三次或者往后,原始的webview加载的速度要比cacheView快,前者几乎秒开,为什么CacheWebView的速度会慢?

WebViewClient的两个方法不停调用

Mobile: 锤子手机-坚果Pro2

Android OS: 7.0

NetWork: 4G

URL: https://www.baidu.com

LIB Version: ren.yale.android:cachewebviewlib:1.2.2


WebViewClient的两个方法不停调用,日志大量输出. 确认 link中没有 http redirect. 谢谢

7-17 17:17:31.402 7345-7345/com.example.prod D/SunSuperWebViewClient: Web View Started
07-17 17:17:31.582 7345-7345/com.example.prod D/SunSuperWebViewClient: Web View Started
07-17 17:17:31.589 7345-7345/com.example.prod D/SunSuperWebViewClient: Web View Loaded : https://secure.example.com.au/MemberOnline/MobileApp/Member/Statements?ItemsPerPage=10&Page=1&yearFilter=2016&yearFilter=2015
07-17 17:17:31.590 7345-7345/com.example.prod D/SunSuperWebViewClient: Web View Started
07-17 17:17:31.721 7345-7345/com.example.prod D/SunSuperWebViewClient: Web View Started
07-17 17:17:31.732 7345-7345/com.example.prod D/SunSuperWebViewClient: Web View Loaded : https://secure.example.com.au/MemberOnline/MobileApp/Member/Statements?ItemsPerPage=10&Page=1&yearFilter=2016&yearFilter=2015

MP4文件缓存

请教个问题,有一个20M的.MP4文件,能否使用缓存播放?

缓存html会丢失页面登录状态

Mobile:

Android OS:

NetWork:

URL:

LIB Version:


似乎是header里面没有携带cookie信息,不知道能否解决,不然感觉缓存页面的作用就比较有限了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.