本文整理匯總了Java中android.webkit.WebSettings.PluginState類的典型用法代碼示例。如果您正苦於以下問題:Java PluginState類的具體用法?Java PluginState怎麽用?Java PluginState使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PluginState類屬於android.webkit.WebSettings包,在下文中一共展示了PluginState類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
private void initView() {
this.tvBind.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
MobclickAgent.onEvent(ScaleIntroActivity.this, Event.bingo_clickBindingScalse);
ScaleBindActivity.startActivity(ScaleIntroActivity.this);
}
});
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
this.webView.getSettings().setPluginState(PluginState.ON);
this.webView.getSettings().setUserAgentString(this.webView.getSettings()
.getUserAgentString() + " App/boohee");
this.webView.getSettings().setDomStorageEnabled(true);
this.webView.setWebViewClient(createWebViewClient());
this.webView.loadUrl(UrlUtils.handleUrl(URL));
}
示例2: setUpWebViewSetting
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
private void setUpWebViewSetting() {
WebSettings webSettings = web.getSettings();
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);// 根據cache-control決定是否從網絡上取數據
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);// 顯示放大縮小
webSettings.setJavaScriptEnabled(true);
// webSettings.setPluginsEnabled(true);
webSettings.setPluginState(PluginState.ON);
webSettings.setUserAgentString(webSettings.getUserAgentString());
webSettings.setDomStorageEnabled(true);
webSettings.setAppCacheEnabled(true);
webSettings.setAppCachePath(getCacheDir().getPath());
webSettings.setUseWideViewPort(true);// 影響默認滿屏和雙擊縮放
webSettings.setLoadWithOverviewMode(true);// 影響默認滿屏和手勢縮放
}
示例3: setupWebView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
/* Configure the Webview for usage as the application's window. */
private void setupWebView(WebView webView) {
Log.i(className, "setupWebView");
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN) {
webSettings.setMediaPlaybackRequiresUserGesture(false);
}
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setUseWideViewPort(true);
webSettings.setAllowFileAccess(true);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
webSettings.setAllowUniversalAccessFromFileURLs(true);
}
webSettings.setBuiltInZoomControls(false);
webSettings.setSupportZoom(false);
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
webSettings.setPluginState(PluginState.ON);
}
}
示例4: initWebViewSettings
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
/**
* 初始化webview配置
*/
private void initWebViewSettings() {
WebSettings webSettings = mWebview.getSettings();
// 打開h5 localstorage
webSettings.setDomStorageEnabled(true);
// 不設置setDatabasePath,html5數據隻會保存在內存
webSettings.setDatabaseEnabled(true);
webSettings.setJavaScriptEnabled(true);
webSettings.setPluginState(PluginState.ON);
// 禁止window open
webSettings.setJavaScriptCanOpenWindowsAutomatically(false);
// 支持viewport meta tag
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setSupportZoom(false);
mWebview.setVerticalScrollBarEnabled(false);
mWebview.setHorizontalScrollBarEnabled(false);
// 滾動條風格,為0就是不給滾動條留空間,滾動條覆蓋在網頁上
mWebview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
mWebview.setWebChromeClient(mWebChromeClient);
mWebview.setWebViewClient(mWebViewClient);
}
示例5: setPluginState
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
public static void setPluginState(WebSettings settings, PluginStateCompat state) {
switch (state) {
case ON: {
settings.setPluginState(PluginState.ON);
break;
}
case ON_DEMAND: {
settings.setPluginState(PluginState.ON_DEMAND);
break;
}
case OFF: {
settings.setPluginState(PluginState.OFF);
break;
}
default: {
break;
}
}
}
示例6: initBaseSetting
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
public void initBaseSetting(boolean webApp) {
super.initBaseSetting(webApp);
mWebSetting.setAppCacheEnabled(true);
mWebSetting.setAppCachePath(mBrwView.getContext().getDir("cache", 0).getPath());
mWebSetting.setDatabaseEnabled(true);
mWebSetting.setDomStorageEnabled(true);
mWebSetting.setLoadWithOverviewMode(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mWebSetting.setAllowFileAccessFromFileURLs(true);
mWebSetting.setAllowUniversalAccessFromFileURLs(true);
}
mWebSetting.setDatabasePath(mBrwView.getContext().getDir("database", 0).getPath());
if (Build.VERSION.SDK_INT >= 8) {
try {
mWebSetting.setPluginState(PluginState.ON);
} catch (Exception e) {
e.printStackTrace();
}
}
if (Build.VERSION.SDK_INT > 10) {
invoke();
}
}
示例7: init
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void init(Context context) {
this.setVerticalScrollBarEnabled(false);
this.setHorizontalScrollBarEnabled(false);
if (Build.VERSION.SDK_INT < 19) {
removeJavascriptInterface("searchBoxJavaBridge_");
}
WebSettings localWebSettings = this.getSettings();
try {
// 禁用file協議,http://www.tuicool.com/articles/Q36ZfuF, 防止Android WebView File域攻擊
localWebSettings.setAllowFileAccess(false);
localWebSettings.setSupportZoom(false);
localWebSettings.setBuiltInZoomControls(false);
localWebSettings.setUseWideViewPort(true);
localWebSettings.setDomStorageEnabled(true);
localWebSettings.setLoadWithOverviewMode(true);
localWebSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
localWebSettings.setPluginState(PluginState.ON);
// 啟用數據庫
localWebSettings.setDatabaseEnabled(true);
// 設置定位的數據庫路徑
String dir = context.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
localWebSettings.setGeolocationDatabasePath(dir);
localWebSettings.setGeolocationEnabled(true);
localWebSettings.setJavaScriptEnabled(true);
localWebSettings.setSavePassword(false);
String agent = localWebSettings.getUserAgentString();
localWebSettings.setUserAgentString(agent);
// setCookie(context, ".baidu.com", bdussCookie);
} catch (Exception e1) {
e1.printStackTrace();
}
this.setWebViewClient(new BridgeWebViewClient());
}
示例8: initWebView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
/**
* 初始化瀏覽器設置信息
*/
private void initWebView() {
cookie = CookieManager.getInstance();
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true); // 啟用支持javascript
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);// 優先使用緩存
webSettings.setAllowFileAccess(true);// 可以訪問文件
webSettings.setBuiltInZoomControls(true);// 支持縮放
if (android.os.Build.VERSION.SDK_INT >= 11) {
webSettings.setPluginState(PluginState.ON);
webSettings.setDisplayZoomControls(false);// 支持縮放
}
mWebView.setWebViewClient(new MyWebViewClient());
mWebView.setWebChromeClient(new MyWebChromeClient());
}
示例9: initView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
private void initView() {
this.mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
this.webView = (WebView) findViewById(R.id.wv_content);
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
this.webView.getSettings().setPluginState(PluginState.ON);
this.webView.getSettings().setUserAgentString(this.webView.getSettings()
.getUserAgentString() + " App/boohee");
this.webView.getSettings().setDomStorageEnabled(true);
this.webView.addJavascriptInterface(new JSInterface(), "jsObj");
this.webView.setWebViewClient(createChromeClient());
this.webView.setWebChromeClient(new MyWebClient());
}
示例10: NewsstandArticleRenderer
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
private NewsstandArticleRenderer(Context paramContext, byte paramByte)
{
super(paramContext, null, 0);
setWebChromeClient(new WebChromeClient());
setWebViewClient(new NewsstandWebViewClient((byte)0));
WebSettings localWebSettings = getSettings();
localWebSettings.setAllowFileAccess(false);
localWebSettings.setAppCacheEnabled(false);
localWebSettings.setCacheMode(2);
localWebSettings.setDatabaseEnabled(false);
localWebSettings.setDomStorageEnabled(true);
localWebSettings.setJavaScriptEnabled(true);
localWebSettings.setPluginState(WebSettings.PluginState.OFF);
localWebSettings.setSupportZoom(true);
localWebSettings.setUseWideViewPort(true);
localWebSettings.setLoadWithOverviewMode(false);
localWebSettings.setUserAgentString(localWebSettings.getUserAgentString() + " OnyxArticleView/1.0");
if (!sDidSetRenderPriority)
{
sDidSetRenderPriority = true;
localWebSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
}
setOnLongClickListener(new View.OnLongClickListener()
{
public final boolean onLongClick(View paramAnonymousView)
{
return true;
}
});
}
示例11: initWebView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
/**
* 初始化瀏覽器設置信息
*/
private void initWebView() {
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true); // 啟用支持javascript
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);// 優先使用緩存
webSettings.setAllowFileAccess(true);// 可以訪問文件
webSettings.setBuiltInZoomControls(true);// 支持縮放
if (android.os.Build.VERSION.SDK_INT >= 11) {
webSettings.setPluginState(PluginState.ON);
webSettings.setDisplayZoomControls(false);// 支持縮放
}
mWebView.setWebViewClient(new MyWebViewClient());
mWebView.setWebChromeClient(new MyWebChromeClient());
}
示例12: displayArticle
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
public static void displayArticle(WebView webView, Article article, Context context) {
String styles = "iframe, img { width: 100%; }";
if (isDarkTheme(context)) {
webView.setBackgroundColor(Color.BLACK);
styles += "body { background-color: #000000; color: #F6F6F6; } a { color: #0099FF; }";
}
String html = String.format("<html><head><meta charset=\"utf-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://cdn.uservoice.com/stylesheets/vendor/typeset.css\"/><style>%s</style></head><body class=\"typeset\" style=\"font-family: sans-serif; margin: 1em\"><h3>%s</h3>%s</body></html>", styles, article.getTitle(), article.getHtml());
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
}
示例13: initWebView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
private void initWebView()
{
mWebView.clearHistory();
mWebView.requestFocus();
mWebView.setClickable(true);
mWebView.getSettings().setJavaScriptEnabled(true);// 可用JS
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.getSettings().setSupportZoom(true);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.setInitialScale(100);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.getSettings().setGeolocationEnabled(true);
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.getSettings().setAppCacheEnabled(true);
mWebView.getSettings().setDatabaseEnabled(true);
mWebView.getSettings().setDisplayZoomControls(false);
mWebView.getSettings().setDomStorageEnabled(true);
if (!mUrl.startsWith("http://m.weathercn.com"))
{
mWebView.getSettings().setCacheMode(
WebSettings.LOAD_CACHE_ELSE_NETWORK);
}
else
{
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
}
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.setScrollBarStyle(0);
mWebView.cancelLongPress();
mWebView.getSettings().setSavePassword(false);// 設置不需要 彈出“是否保存密碼” 對話框
mWebView.setWebViewClient(getWebViewClient());
mWebView.setWebChromeClient(getWebChromeClient());
}
示例14: initView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void initView()
{
Intent intent = getIntent();
String url = intent.getStringExtra(URL);
webView = (WebView) findViewById(R.id.webView);
webView.clearHistory();
webView.loadUrl(url);
webView.setWebViewClient(new BrowserClient());
webView.setInitialScale(0);
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(false);
settings.setPluginState(PluginState.ON);
settings.setLoadWithOverviewMode(true);
settings.setSupportMultipleWindows(false);
settings.setDefaultZoom(ZoomDensity.FAR);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setUseWideViewPort(true);
settings.setDomStorageEnabled(true);
Button btnDone = (Button) findViewById(R.id.btnDone);
btnDone.setOnClickListener(this);
imgBack = (ImageView) findViewById(R.id.imgBack);
imgForward = (ImageView) findViewById(R.id.imgForward);
imgBack.setOnClickListener(this);
imgForward.setOnClickListener(this);
checkButtonState();
}
示例15: showBrowserView
import android.webkit.WebSettings.PluginState; //導入依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void showBrowserView()
{
switchToLayout(R.layout.browse_web_screen);
WebView webView = (WebView) findViewById(R.id.webView);
// webView.setWebViewClient(new BrowserClient());
actionBar.setWebView(webView);
if (webViewClient == null) {
webViewClient = new ParrotWebViewClient();
}
if (webChromeClient == null) {
webChromeClient = new ParrotWebChromeClient();
}
webView.setWebViewClient(webViewClient);
webView.setWebChromeClient(webChromeClient);
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(false);
settings.setPluginState(PluginState.ON);
settings.setLoadWithOverviewMode(true);
settings.setSupportMultipleWindows(false);
settings.setDefaultZoom(ZoomDensity.FAR);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setUseWideViewPort(true);
webView.setInitialScale(0);
}