本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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());
}
}
示例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);
}
示例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);
}