package com.just.library;

/**
 * Created by cenxiaozhong on 2017/8/10.
 */

public class WebPools {
}

@@ -74,30 +74,1393 @@
 */%0A%0A
-public class WebPools %7B
+import android.app.Activity;%0Aimport android.content.MutableContextWrapper;%0Aimport android.webkit.WebView;%0A%0Aimport java.util.Queue;%0Aimport java.util.concurrent.LinkedBlockingDeque;%0A%0A/**%0A *%0A */%0Apublic class WebPools %7B%0A%0A%0A    private final Queue%3CWebView%3E mWebViews;%0A%0A    private Object lock = new Object();%0A    private static final WebPools mWebPools = new WebPools();%0A%0A    private WebPools() %7B%0A        mWebViews=new LinkedBlockingDeque%3CWebView%3E();%0A    %7D%0A%0A    public static WebView acquireWebView(Activity activity) %7B%0A%0A        return mWebPools.acquireWebViewInternal(activity);%0A%0A    %7D%0A%0A    public static void recyclerWebView(WebView webView)%7B%0A%0A        MutableContextWrapper mContext= (MutableContextWrapper) webView.getContext();%0A        mContext.setBaseContext(null);%0A%0A        mWebPools.enqueue(webView);%0A%0A    %7D%0A%0A    private void enqueue(WebView webView)%7B%0A        mWebViews.offer(webView);%0A    %7D%0A    public WebView acquireWebViewInternal(Activity activity) %7B%0A%0A        WebView mWebView = mWebViews.poll();%0A        if (mWebView == null) %7B%0A            synchronized (lock) %7B%0A                return new WebView(new MutableContextWrapper(activity));%0A            %7D%0A        %7D else %7B%0A            MutableContextWrapper mMutableContextWrapper = (MutableContextWrapper) mWebView.getContext();%0A            mMutableContextWrapper.setBaseContext(activity);%0A            return mWebView;%0A        %7D%0A    %7D%0A%0A%0A
 %0A%7D%0A

update webpools