package com.fss.common.commonUtils.moduleUtils;

import android.content.Context;
import android.webkit.WebSettings;
import android.webkit.WebView;

/**
 * Some default value of webview
 * User: cym
 * Date: 13-10-31
 * Time: 下午3:48
 *
 */
//WebViewUtils
public class WebViewUtils {
    private static WebView webView;

    public static WebView getCustomWebView(Context context,String appCacheDir) {
        webView = new WebView(context);

        WebSettings wSet = webView.getSettings();
        // wSet.setAppCacheMaxSize();
        wSet.setJavaScriptEnabled(true);
        wSet.setDomStorageEnabled(true);
       // String appCacheDir = this.getActivity().getApplicationContext().getDir("cache", Context.MODE_PRIVATE).getPath();
        wSet.setAppCachePath(appCacheDir) ;
        wSet.setAllowFileAccess(true);
        wSet.setAppCacheEnabled(true);
        return webView;
    };

    public static WebSettings getWebSettings(WebView webView,String appCacheDir){
        WebSettings wSet = webView.getSettings();
        // wSet.setAppCacheMaxSize();
        wSet.setJavaScriptEnabled(true);
        wSet.setDomStorageEnabled(true);
        // String appCacheDir = this.getActivity().getApplicationContext().getDir("cache", Context.MODE_PRIVATE).getPath();
        wSet.setAppCachePath(appCacheDir) ;
        wSet.setAllowFileAccess(true);
        wSet.setAppCacheEnabled(true);
        wSet.setCacheMode(WebSettings.LOAD_DEFAULT);
        return wSet;

    }
}

@@ -100,50 +100,177 @@
 kit.
-WebSettings;%0Aimport android.webkit.WebView
+CookieManager;%0Aimport android.webkit.CookieSyncManager;%0Aimport android.webkit.WebSettings;%0Aimport android.webkit.WebView;%0Aimport com.fss.common.commonUtils.logUtils.Logs
 ;%0A%0A/
@@ -356,11 +356,8 @@
 :48%0A
- *%0A
  */%0A
@@ -495,16 +495,17 @@
 context,
+ 
 String a
@@ -732,24 +732,25 @@
 ue);%0A       
+ 
 // String ap
@@ -886,33 +886,32 @@
 ath(appCacheDir)
- 
 ;%0A        wSet.s
@@ -1003,16 +1003,22 @@
 w;%0A    %7D
+%0A%0A    
 ;%0A%0A    p
@@ -1073,16 +1073,17 @@
 webView,
+ 
 String a
@@ -1093,16 +1093,17 @@
 acheDir)
+ 
 %7B%0A      
@@ -1431,17 +1431,16 @@
 acheDir)
- 
 ;%0A      
@@ -1591,11 +1591,634 @@
 ;%0A%0A    %7D
+%0A%0A    public static void syncCookie(Context context, String domainNameUrl, String... strings) %7B%0A        CookieSyncManager.createInstance(context);%0A        //CookieSyncManager.getInstance().startSync();%0A        CookieManager cookieManager = CookieManager.getInstance();%0A        cookieManager.setAcceptCookie(true);%0A        cookieManager.removeAllCookie();%0A        for (String s : strings) %7B%0A            cookieManager.setCookie(domainNameUrl, s);%0A%0A        %7D%0A        Logs.d(cookieManager.getCookie(domainNameUrl));%0A        CookieSyncManager.getInstance().sync();%0A        //    CookieSyncManager.getInstance().stopSync();%0A    %7D
 %0A%7D%0A

add syncCookie