当前位置: 首页>>代码示例>>Java>>正文


Java WebSettings.setAppCacheEnabled方法代码示例

本文整理汇总了Java中com.tencent.smtt.sdk.WebSettings.setAppCacheEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java WebSettings.setAppCacheEnabled方法的具体用法?Java WebSettings.setAppCacheEnabled怎么用?Java WebSettings.setAppCacheEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tencent.smtt.sdk.WebSettings的用法示例。


在下文中一共展示了WebSettings.setAppCacheEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initWebViewSettings

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
    WebSettings ws = mWebView.getSettings();
    ws.setDefaultTextEncodingName("utf-8");
    ws.setJavaScriptEnabled(true);
    ws.setPluginsEnabled(true);
    ws.setDomStorageEnabled(true);
    ws.setRenderPriority(com.tencent.smtt.sdk.WebSettings.RenderPriority.HIGH);
    ws.setAllowFileAccess(true);
    ws.setAllowContentAccess(true);
    ws.setAppCacheEnabled(false);
    ws.setCacheMode(com.tencent.smtt.sdk.WebSettings.LOAD_NO_CACHE);
    ws.setSaveFormData(true);
    ws.setJavaScriptCanOpenWindowsAutomatically(true);
    ws.setLoadsImagesAutomatically(true);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        ws.setAllowFileAccessFromFileURLs(true);
        ws.setAllowUniversalAccessFromFileURLs(true);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        mWebView.setWebContentsDebuggingEnabled(true);
    }
}
 
开发者ID:snailycy,项目名称:AndroidHybridLib,代码行数:23,代码来源:WrapperWebView.java

示例2: initWebViewSettings

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
    WebSettings webSetting = this.getSettings();
    webSetting.setJavaScriptEnabled(true);
    webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
    webSetting.setAllowFileAccess(true);
    webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
    webSetting.setSupportZoom(true);
    webSetting.setBuiltInZoomControls(true);
    webSetting.setUseWideViewPort(true);
    webSetting.setSupportMultipleWindows(true);
    // webSetting.setLoadWithOverviewMode(true);
    webSetting.setAppCacheEnabled(true);
    // webSetting.setDatabaseEnabled(true);
    webSetting.setDomStorageEnabled(true);
    webSetting.setGeolocationEnabled(true);
    webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
    // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
    webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
    // webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
    webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
}
 
开发者ID:jianesrq0724,项目名称:UpdateLibrary,代码行数:22,代码来源:X5WebView.java

示例3: initWebViewSetting

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
/**
 * 初始化WebView的setting事件
 */
private void initWebViewSetting() {
    WebSettings webSetting = mWebView.getSettings();
    webSetting.setAllowFileAccess(true);
    webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
    webSetting.setSupportZoom(true);
    webSetting.setBuiltInZoomControls(true);
    webSetting.setUseWideViewPort(true);
    webSetting.setSupportMultipleWindows(false);
    // webSetting.setLoadWithOverviewMode(true);
    webSetting.setAppCacheEnabled(true);
    // webSetting.setDatabaseEnabled(true);
    webSetting.setDomStorageEnabled(true);
    webSetting.setJavaScriptEnabled(true);
    webSetting.setGeolocationEnabled(true);
    webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
    webSetting.setAppCachePath(this.getDir("appcache", 0).getPath());
    webSetting.setDatabasePath(this.getDir("databases", 0).getPath());
    webSetting.setGeolocationDatabasePath(this.getDir("geolocation", 0)
            .getPath());
    // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
    webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().sync();
}
 
开发者ID:jianesrq0724,项目名称:UpdateLibrary,代码行数:28,代码来源:X5WebViewBrowseActivity.java

示例4: initWebViewSettings

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
    WebSettings webSetting = this.getSettings();
    webSetting.setJavaScriptEnabled(true);
    webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
    webSetting.setAllowFileAccess(true);
    webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
    webSetting.setSupportZoom(true);
    webSetting.setBuiltInZoomControls(true);
    webSetting.setUseWideViewPort(true);
    webSetting.setSupportMultipleWindows(true);
    webSetting.setAppCacheEnabled(true);
    webSetting.setDomStorageEnabled(true);
    webSetting.setGeolocationEnabled(true);
    webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
    webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
    webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
}
 
开发者ID:banwenmang,项目名称:X5web,代码行数:18,代码来源:X5WebView.java

示例5: initWebConfig

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebConfig() {
    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setLoadWithOverviewMode(true);
    settings.setAppCacheEnabled(true);
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    settings.setSupportZoom(true);
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    });

}
 
开发者ID:arieshao,项目名称:Integration,代码行数:17,代码来源:DetailActivity.java

示例6: initWebViewSetting

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
/**
 * init WebView
 */
private void initWebViewSetting() {
    WebSettings webSetting = mWebView.getSettings();
    webSetting.setAllowFileAccess(true);
    webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
    webSetting.setSupportZoom(true);
    webSetting.setBuiltInZoomControls(true);
    webSetting.setUseWideViewPort(true);
    webSetting.setSupportMultipleWindows(false);
    webSetting.setAppCacheEnabled(true);
    webSetting.setDomStorageEnabled(true);
    webSetting.setJavaScriptEnabled(true);
    webSetting.setGeolocationEnabled(true);
    webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
    webSetting.setAppCachePath(this.getDir("appcache", 0).getPath());
    webSetting.setDatabasePath(this.getDir("databases", 0).getPath());
    webSetting.setGeolocationDatabasePath(this.getDir("geolocation", 0)
            .getPath());
    webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
    long time = System.currentTimeMillis();
    if (mIntentUrl == null) {
        mWebView.loadUrl(mHomeUrl);
    } else {
        mWebView.loadUrl(mIntentUrl.toString());
    }

    // print the time of webView load
    TbsLog.d("time-cost", "cost time: " + (System.currentTimeMillis() - time));

    // manage Cookie
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().sync();
}
 
开发者ID:banwenmang,项目名称:X5web,代码行数:36,代码来源:BrowserActivity.java

示例7: initViews

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initViews() {

        WebSettings settings = getSettings();
        settings.setAppCacheEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setDatabaseEnabled(true);
        if (SystemUtil.isNetworkConnected()) {
            settings.setCacheMode(WebSettings.LOAD_DEFAULT);
        } else {
            settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY);
        }
        settings.setJavaScriptEnabled(true);
        settings.setLoadWithOverviewMode(true);
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        settings.setSupportZoom(true);

        mProgressView = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleHorizontal);
        mProgressView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 10));
        mProgressView.setBackgroundColor(progressColor);
        addView(mProgressView);

        setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
                if (newProgress == 100) {
                    mProgressView.setVisibility(GONE);
                } else {
                    if (mProgressView.getVisibility() == GONE)
                        mProgressView.setVisibility(VISIBLE);
                    mProgressView.setProgress(newProgress);
                }
            }
        });
    }
 
开发者ID:a396901990,项目名称:Article-Comment,代码行数:36,代码来源:XProgressWebView.java

示例8: provideWebView

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
@Provides
@ActivityScope
@SuppressLint("SetJavaScriptEnabled")
WebView provideWebView(Activity activity) {
    WebView webView = new WebView(activity) {
        boolean isTouchTriggered = false;

        @Override
        protected void onScrollChanged(int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            if (isTouchTriggered) {
                mBaseViewWebX5.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY);
            }
        }

        @Override
        public boolean onInterceptTouchEvent(MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                isTouchTriggered = true;
            }
            return super.onInterceptTouchEvent(event);
        }
    };
    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setAllowFileAccess(true);
    settings.setDomStorageEnabled(true);

    settings.setUseWideViewPort(true);
    settings.setLoadWithOverviewMode(true);

    settings.setSupportZoom(false);
    settings.setBuiltInZoomControls(false);
    settings.setDisplayZoomControls(false);

    String userAgent = JoyWeb.getUserAgent();
    if (TextUtil.isNotEmpty(userAgent)) {
        settings.setUserAgentString(settings.getUserAgentString() + " " + userAgent);
    }

    settings.setAppCacheEnabled(JoyWeb.isAppCacheEnabled());
    settings.setAppCachePath(JoyWeb.getAppCachePath());
    settings.setAppCacheMaxSize(JoyWeb.getAppCacheMaxSize());
    if (mCacheEnable) {
        boolean networkEnable = DeviceUtil.isNetworkEnable(activity.getApplicationContext());
        settings.setCacheMode(networkEnable ? WebSettings.LOAD_NO_CACHE : WebSettings.LOAD_CACHE_ONLY);
    } else {
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    }
    return webView;
}
 
开发者ID:joy-inc,项目名称:core-web,代码行数:51,代码来源:BaseWebX5Module.java


注:本文中的com.tencent.smtt.sdk.WebSettings.setAppCacheEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。