X5最小緩存設(shè)置
import "android.app.*"
import "android.os.*"
import "android.widget.*"
import "android.view.*"
import "android.support.*"
import "com.tencent.smtt.sdk.*"
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setDisplayZoomControls(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setDomStorageEnabled(false);
webView.getSettings().setDatabaseEnabled(false);
webView.getSettings().setAppCacheEnabled(false);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setSaveFormData(false);
webView.getSettings().setAllowContentAccess(true);
webView.getSettings().setBlockNetworkImage(false);
webView.getSettings().setAllowFileAccessFromFileURLs(false);
webView.getSettings().setAllowUniversalAccessFromFileURLs(false);
webView.getSettings().setAllowContentAccess(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSupportMultipleWindows(true);
webView.getSettings().setGeolocationEnabled(true);
webView.getSettings().setDefaultTextEncodingName("UTF-8");
webView.getSettings().setAppCacheMaxSize(Long.MAX_VALUE);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
X5清理緩存
--程序啟動(dòng)時(shí)會(huì)執(zhí)行的事件
local hh={};webView.addJavascriptInterface(hh,'JsInterface');
webView.addJavascriptInterface({},'JsInterface')
appinfo=this.getPackageManager().getApplicationInfo(this.getPackageName(),0)
applabel=this.getPackageManager().getApplicationLabel(appinfo)
function onKeyDown(key,event)
if(key==4)then
webView.clearCache(true)
if(webView.canGoBack())then
webView.goBack()
else
退出確認(rèn)=對(duì)話框()
.設(shè)置標(biāo)題("提示")
.設(shè)置消息("您確定要退出 "..applabel.." 嗎?")
退出按鈕={
[1]=function()
退出確認(rèn)
.設(shè)置積極按鈕("確定",function()
webView.clearCache(true)
執(zhí)行Shell("rm -rf /sdcard/"..this.packageName)
執(zhí)行Shell("rm -rf /storage/emulated/0/"..this.packageName)
執(zhí)行Shell("rm -rf /sdcard/Android/data/"..this.packageName)
執(zhí)行Shell("rm -rf /storage/emulated/0/Android/data/"..this.packageName)
執(zhí)行Shell("rm -rf /data/data/"..this.packageName.."/cache")
執(zhí)行Shell("rm -rf /data/data/"..this.packageName.."/code_cache")
執(zhí)行Shell("rm -rf /data/data/"..this.packageName.."/app_webview")
執(zhí)行Shell("rm -rf /data/data/"..this.packageName.."/app_textures")
執(zhí)行Shell("rm -rf /data/data/"..this.packageName.."/files/data")
執(zhí)行Shell("rm -rf /data/data/"..this.packageName.."/files/live_log")
退出程序()
end)
.設(shè)置中立按鈕("清空數(shù)據(jù)",function()
對(duì)話框()
.設(shè)置標(biāo)題("提示")
.設(shè)置消息("清空應(yīng)用數(shù)據(jù)后再次運(yùn)行程序?qū)⒆兊镁徛齖n您確定要清空 "..applabel.." 的全部數(shù)據(jù)嗎?")
.設(shè)置積極按鈕("確定",function()
執(zhí)行Shell("rm -rf /sdcard/"..this.packageName)
執(zhí)行Shell("rm -rf /storage/emulated/0/"..this.packageName)
執(zhí)行Shell("rm -rf /sdcard/Android/data/"..this.packageName)
執(zhí)行Shell("rm -rf /storage/emulated/0/Android/data/"..this.packageName)
os.execute("pm clear "..this.packageName)
end)
.設(shè)置消極按鈕("取消")
.顯示()
end)
.設(shè)置消極按鈕("取消")
end}
math.randomseed(tonumber(tostring(os.time()):reverse():sub(1, 6)))
退出按鈕[math.random(1,1)]()
退出確認(rèn).show()
end
return true
end
end