當前位置: 首頁>>代碼示例>>Java>>正文


Java WebSettings.setDatabasePath方法代碼示例

本文整理匯總了Java中android.webkit.WebSettings.setDatabasePath方法的典型用法代碼示例。如果您正苦於以下問題:Java WebSettings.setDatabasePath方法的具體用法?Java WebSettings.setDatabasePath怎麽用?Java WebSettings.setDatabasePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.webkit.WebSettings的用法示例。


在下文中一共展示了WebSettings.setDatabasePath方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initViews

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled"})
private void initViews() {
    this.mWebView.setVerticalScrollBarEnabled(false);
    this.mWebView.setHorizontalScrollBarEnabled(false);
    this.mWebView.setWebViewClient(new FbWebViewClient());
    this.mWebView.setWebChromeClient(this.mChromeClient);
    this.mWebView.clearFormData();
    WebSettings settings = this.mWebView.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.mWeakContext == null || this.mWeakContext.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.mWeakContext.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.mWebView.clearView();
    this.mWebView.loadUrl(this.mUrl);
    this.mWebView.getSettings().setSavePassword(false);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:27,代碼來源:PKDialog.java

示例2: setCachePath

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setCachePath(){

        File  cacheFile = new File(this.getContext().getCacheDir(),CACHE_NAME);
        String path = cacheFile.getAbsolutePath();
        mAppCachePath = path;

        File file = new File(path);
        if (!file.exists()){
            file.mkdirs();
        }

        WebSettings webSettings = this.getSettings();
        webSettings.setAppCacheEnabled(true);
        webSettings.setDatabaseEnabled(true);
        webSettings.setDatabasePath(path);
    }
 
開發者ID:yale8848,項目名稱:CacheWebView,代碼行數:17,代碼來源:CacheWebView.java

示例3: a

import android.webkit.WebSettings; //導入方法依賴的package包/類
protected RegisterView a() {
    RegisterView registerView = new RegisterView(this.activity);
    registerView.c().getChildAt(registerView.c().getChildCount() - 1).setVisibility(8);
    registerView.a().setOnClickListener(new j(this));
    this.e = registerView.b();
    WebSettings settings = this.e.getSettings();
    settings.setBuiltInZoomControls(true);
    settings.setJavaScriptEnabled(true);
    settings.setCacheMode(1);
    settings.setDomStorageEnabled(true);
    settings.setDatabaseEnabled(true);
    settings.setDatabasePath(this.activity.getDir("database", 0).getPath());
    this.e.setVerticalScrollBarEnabled(false);
    this.e.setHorizontalScrollBarEnabled(false);
    this.e.setWebViewClient(new l(this));
    return registerView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:i.java

示例4: b

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled"})
private void b() {
    this.i.setVerticalScrollBarEnabled(false);
    this.i.setHorizontalScrollBarEnabled(false);
    this.i.setWebViewClient(new FbWebViewClient());
    this.i.setWebChromeClient(this.mChromeClient);
    this.i.clearFormData();
    WebSettings settings = this.i.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.c == null || this.c.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.c.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.i.loadUrl(this.e);
    this.i.setLayoutParams(a);
    this.i.setVisibility(4);
    this.i.getSettings().setSavePassword(false);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:28,代碼來源:TDialog.java

示例5: setCachePath

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setCachePath(){

        File cacheFile = new File(mWebView.getContext().getCacheDir(),"appcache_name");
        String path = cacheFile.getAbsolutePath();

        File file = new File(path);
        if (!file.exists()){
            file.mkdirs();
        }

        WebSettings webSettings = mWebView.getSettings();
        webSettings.setAppCacheEnabled(true);
        webSettings.setDatabaseEnabled(true);
        webSettings.setDatabasePath(path);
    }
 
開發者ID:yale8848,項目名稱:CacheWebView,代碼行數:16,代碼來源:Main2Activity.java

示例6: initViews

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled"})
private void initViews() {
    this.mWebView.setVerticalScrollBarEnabled(false);
    this.mWebView.setHorizontalScrollBarEnabled(false);
    this.mWebView.setWebViewClient(new FbWebViewClient());
    this.mWebView.setWebChromeClient(this.mChromeClient);
    this.mWebView.clearFormData();
    WebSettings settings = this.mWebView.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.mWeakContext == null || this.mWeakContext.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.mWeakContext.get()).getApplicationContext()
                .getDir("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.mWebView.clearView();
    this.mWebView.loadUrl(this.mUrl);
    this.mWebView.getSettings().setSavePassword(false);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:28,代碼來源:PKDialog.java

示例7: b

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled"})
private void b() {
    this.i.setVerticalScrollBarEnabled(false);
    this.i.setHorizontalScrollBarEnabled(false);
    this.i.setWebViewClient(new FbWebViewClient());
    this.i.setWebChromeClient(this.mChromeClient);
    this.i.clearFormData();
    WebSettings settings = this.i.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.c == null || this.c.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.c.get()).getApplicationContext().getDir
                ("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.i.loadUrl(this.e);
    this.i.setLayoutParams(a);
    this.i.setVisibility(4);
    this.i.getSettings().setSavePassword(false);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:29,代碼來源:TDialog.java

示例8: init

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void init(Context context) {
    mPlayer = new WebPlayer(this);

    setBackgroundColor(Color.BLACK);

    enableJavascript();

    WebSettings webSettings = getSettings();
    webSettings.setAllowContentAccess(true);
    webSettings.setAllowFileAccess(true);
    webSettings.setLoadsImagesAutomatically(true);
    webSettings.setDomStorageEnabled(true);
    webSettings.setAppCacheEnabled(true);
    webSettings.setDatabaseEnabled(true);
    webSettings.setDatabasePath(context.getDir("database", Context.MODE_PRIVATE).getPath());

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        webSettings.setAllowFileAccessFromFileURLs(true);
        webSettings.setAllowUniversalAccessFromFileURLs(true);
    }
    
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
        webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
    }

    setWebChromeClient(new ChromeClient());
    setWebViewClient(new ViewClient());
}
 
開發者ID:AltimitSystems,項目名稱:mv-android-client,代碼行數:29,代碼來源:WebPlayerView.java

示例9: initializeSettings

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@SuppressLint({ "SetJavaScriptEnabled", "NewApi" })
public void initializeSettings(WebSettings settings, Context context) {
	//setPageCacheCapacity2(settings);
	if (API < 18) {
		settings.setAppCacheMaxSize(Long.MAX_VALUE);
	}
	if (API < 17) {
		settings.setEnableSmoothTransition(true);
	}
	if (API > 16) {
		settings.setMediaPlaybackRequiresUserGesture(true);
	}
	if (API >= Build.VERSION_CODES.LOLLIPOP && !mBrowserController.isIncognito()) {
		settings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
	} else if (API >= Build.VERSION_CODES.LOLLIPOP) {
		// We're in Incognito mode, reject
		settings.setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW);
	}
	settings.setDomStorageEnabled(true);
	settings.setAppCacheEnabled(true);
	settings.setCacheMode(WebSettings.LOAD_DEFAULT);
	settings.setDatabaseEnabled(true);
	settings.setSupportZoom(true);
	settings.setBuiltInZoomControls(true);
	settings.setDisplayZoomControls(false);
	settings.setAllowContentAccess(true);
	settings.setAllowFileAccess(true);
	settings.setDefaultTextEncodingName("utf-8");
	if (API > 16) {
		settings.setAllowFileAccessFromFileURLs(false);
		settings.setAllowUniversalAccessFromFileURLs(false);
	}

	settings.setAppCachePath(context.getDir("appcache", 0).getPath());
	settings.setGeolocationDatabasePath(context.getDir("geolocation", 0).getPath());
	if (API < Build.VERSION_CODES.KITKAT) {
		settings.setDatabasePath(context.getDir("databases", 0).getPath());
	}


}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:43,代碼來源:LightningView.java

示例10: initViews

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void initViews() {
    Method method;
    WebSettings settings = this.mWebView.getSettings();
    settings.setBuiltInZoomControls(true);
    settings.setUserAgentString(settings.getUserAgentString() + "/" + UA_PREFIX + this.jsBridge.getVersion() + "/sdk");
    settings.setJavaScriptEnabled(true);
    Class cls = settings.getClass();
    try {
        method = cls.getMethod("setPluginsEnabled", new Class[]{Boolean.TYPE});
        if (method != null) {
            method.invoke(settings, new Object[]{Boolean.valueOf(true)});
        }
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (Throwable th) {
        th.printStackTrace();
    }
    try {
        method = cls.getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
        if (method != null) {
            method.invoke(settings, new Object[]{Boolean.valueOf(true)});
        }
    } catch (SecurityException e2) {
        e2.printStackTrace();
    } catch (NoSuchMethodException e3) {
    } catch (IllegalArgumentException e4) {
    } catch (IllegalAccessException e5) {
    } catch (InvocationTargetException e6) {
    }
    settings.setAppCachePath(getWebViewCacheDir());
    settings.setDatabasePath(getWebViewCacheDir());
    settings.setDatabaseEnabled(true);
    settings.setAppCacheEnabled(true);
    if (supportWebViewFullScreen()) {
        settings.setUseWideViewPort(true);
        if (VERSION.SDK_INT >= 7) {
            try {
                cls.getMethod("setLoadWithOverviewMode", new Class[]{Boolean.TYPE}).invoke(settings, new Object[]{Boolean.valueOf(true)});
            } catch (Exception e7) {
            }
        }
        if (SystemUtils.isSupportMultiTouch()) {
            if (SystemUtils.getAndroidSDKVersion() < 11) {
                try {
                    Field declaredField = WebView.class.getDeclaredField("mZoomButtonsController");
                    declaredField.setAccessible(true);
                    ZoomButtonsController zoomButtonsController = new ZoomButtonsController(this.mWebView);
                    zoomButtonsController.getZoomControls().setVisibility(8);
                    declaredField.set(this.mWebView, zoomButtonsController);
                } catch (Exception e8) {
                }
            } else {
                try {
                    this.mWebView.getSettings().getClass().getMethod("setDisplayZoomControls", new Class[]{Boolean.TYPE}).invoke(this.mWebView.getSettings(), new Object[]{Boolean.valueOf(false)});
                } catch (Exception e9) {
                }
            }
        }
    }
    this.mWebView.setWebViewClient(new d());
    this.mWebView.setWebChromeClient(new c());
    this.mWebView.setDownloadListener(this.mDownloadListener);
    this.mWebView.loadUrl(this.url);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:65,代碼來源:AppbarActivity.java

示例11: initData

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void initData() {

    mWebView.setHorizontalScrollBarEnabled(false);//水平不顯示
    mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);

    //listview,webview中滾動拖動到頂部或者底部時的陰影
    mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
    //取消滾動條白邊效果
    mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);//設置渲染優先級
    webSettings.setLoadWithOverviewMode(true);//縮放至屏幕大小,一定要設置
    webSettings.setJavaScriptEnabled(true);//支持JS
    webSettings.setAllowFileAccess(true);//設置是否允許文件訪問,默認是允許的
    webSettings.setSaveFormData(true);//設置是否保存表單數據,默認是保存的
    webSettings.setSavePassword(true);//設置是否保存密碼,默認是保存的,過時了
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通過JS打開新窗口
    webSettings.setUseWideViewPort(true);//是否啟用支持視窗meta標記
    webSettings.setTextSize(WebSettings.TextSize.NORMAL);// 固定頁麵字體大小
    webSettings.setGeolocationEnabled(true);//啟用地理定位
    webSettings.setDatabaseEnabled(true);// 開啟database storage API功能
    webSettings.setDomStorageEnabled(true);// 開啟DOM storage API 功能
    String databasePath = this.getApplicationContext().getDir("database", Context
            .MODE_PRIVATE).getPath();
    webSettings.setDatabasePath(databasePath);// 設置數據庫緩存路徑
    webSettings.setGeolocationDatabasePath(databasePath);//設置定位的數據庫路徑
    webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);//支持內容重新布局
    webSettings.setSupportZoom(true);//支持縮放
    webSettings.setBuiltInZoomControls(true);//設置支持縮放機製
    webSettings.setDisplayZoomControls(false);//設置顯示縮放控件

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //設置當一個安全站點企圖加載來自一個不安全站點資源時WebView的行為
        //MIXED_CONTENT_ALWAYS_ALLOW
        //MIXED_CONTENT_NEVER_ALLOW
        //MIXED_CONTENT_COMPATIBILITY_MODE
        webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }

    mWebView.setOnLongClickListener(new View.OnLongClickListener() {//禁止長按跳出複製彈窗
        @Override
        public boolean onLongClick(View view) {
            return true;
        }
    });

    mWebView.setDownloadListener(new WebViewDownloadListener());

    mWebView.setWebViewClient(new WVC());

    mWebView.setWebChromeClient(new WCC());

    Intent intent = getIntent();
    String url = intent.getStringExtra(C.intent.web_view_url);

    mWebView.loadUrl(url);
    mAddress.setText(url);

}
 
開發者ID:fendoudebb,項目名稱:PlayAndroid,代碼行數:63,代碼來源:WebViewActivity.java


注:本文中的android.webkit.WebSettings.setDatabasePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。