本文整理汇总了Java中android.webkit.WebView.setWebContentsDebuggingEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.setWebContentsDebuggingEnabled方法的具体用法?Java WebView.setWebContentsDebuggingEnabled怎么用?Java WebView.setWebContentsDebuggingEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.setWebContentsDebuggingEnabled方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
//}
setContentView(R.layout.activity_reader);
// Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
// setSupportActionBar(toolbar);
mBrandingProjectName = getIntent().getStringExtra("brandingProjectName");
new Loader().execute();
}
示例2: enableRemoteDebugging
import android.webkit.WebView; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
private void enableRemoteDebugging() {
try {
WebView.setWebContentsDebuggingEnabled(true);
} catch (IllegalArgumentException e) {
LOG.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
e.printStackTrace();
}
}
示例3: init
import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@TargetApi(21)
public void init(@Nullable MediaModel mediaModel) {
mVPAIDWebView.loadUrl(VpaidClient.EMPTY_URL);
mVPAIDWebView.clearHistory();
// setup the webview we need if we want to load vpaid
mVPAIDWebView.setWebViewClient(new VPAidWebViewClient());
mVPAIDWebView.setWebChromeClient(new VPAIDWebChromeClient());
mVPAIDWebView.getSettings().setJavaScriptEnabled(true);
mVPAIDWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
mVPAIDWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
if (BuildConfig.DEBUG) {
WebView.setWebContentsDebuggingEnabled(true);
}
}
示例4: createViewInstance
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
ReactWebView webView = new ReactWebView(reactContext);
webView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onConsoleMessage(ConsoleMessage message) {
if (ReactBuildConfig.DEBUG) {
return super.onConsoleMessage(message);
}
// Ignore console logs in non debug builds.
return true;
}
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
}
});
reactContext.addLifecycleEventListener(webView);
mWebViewConfig.configWebView(webView);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);
webView.getSettings().setDomStorageEnabled(true);
// Fixes broken full-screen modals/galleries due to body height being 0.
webView.setLayoutParams(
new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
return webView;
}
示例5: enableRemoteDebugging
import android.webkit.WebView; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
private void enableRemoteDebugging() {
try {
WebView.setWebContentsDebuggingEnabled(true);
} catch (IllegalArgumentException e) {
Log.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
e.printStackTrace();
}
}
示例6: init
import android.webkit.WebView; //导入方法依赖的package包/类
private void init() {
this.setVerticalScrollBarEnabled(false);
this.setHorizontalScrollBarEnabled(false);
this.getSettings().setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
this.setWebViewClient(generateBridgeWebViewClient());
}
示例7: enableDebuggingIfNecessary
import android.webkit.WebView; //导入方法依赖的package包/类
private void enableDebuggingIfNecessary(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) {
WebView.setWebContentsDebuggingEnabled(true);
}
}
}
示例8: onCreate
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState != null){
mAdClearOn = savedInstanceState.getBoolean(ADCLEAR_SIGN);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
mediaCodeReceiverRegister();
final String permissions[] = {"android.permission.READ_CONTACTS", "android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_EXTERNAL_STORAGE"};
final String permissionsUI[] = {"Permission Read Contact Granted", "Permission Read External Storage Granted",
"Permission Write External Storage Granted"};
final Runnable runnables[] = {new Runnable() {
@Override
public void run() {
webtrekk = initWithNormalParameter();
webtrekk.getCustomParameter().put("own_para", "my-value");
}
}, null, null};
permissionRequest(permissions, permissionsUI, runnables);
((TextView)findViewById(R.id.main_version)).setText(getString(R.string.hello_world) + "\nLibrary Version:" + Webtrekk.mTrackingLibraryVersionUI);
MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, "9e956a2e5169ddb44eb87b6acb0eee95");
updateAdClearCaption();
}
示例9: onCreateView
import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@NonNull @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@LayoutRes int layoutId = getArguments().getInt(KEY_LAYOUT_ID);
View view = inflater.inflate(layoutId, container, false);
// not using ButterKnife to ensure WebView is private
// but still need to call bindView() to maintain base class contract
bindView(view);
mWebView = (WebView) view.findViewById(R.id.web_view);
mUrl = getArguments().getString(BundleKeys.URL);
if (TextUtils.isEmpty(mUrl)) {
throw new IllegalArgumentException("Empty URL passed to WebViewFragment!");
}
Log.i(TAG, "Loading URL: %s", mUrl);
WebSettings settings = mWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
// enable remote debugging
if (0 != (getActivity().getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
mWebView.setWebViewClient(new DefaultWebViewClient());
mWebView.loadUrl(mUrl);
return view;
}
示例10: platformSpecificSetup
import android.webkit.WebView; //导入方法依赖的package包/类
private void platformSpecificSetup(Context activity, WebView webView) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
webView.setWebViewClient(this);
ConfigXmlParser parser = new ConfigXmlParser();
parser.parse(activity);
_webView = new WeakReference<>(webView);
_base = new WebViewJavaScriptBridgeBase();
_base.init(activity, parser.getHandlerEntries());
_base.setDelegate(this);
}
示例11: setUpWebViewDefaults
import android.webkit.WebView; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setUpWebViewDefaults(WebView webView) {
WebSettings settings = webView.getSettings();
// 网页内容的宽度是否可大于WebView控件的宽度
settings.setLoadWithOverviewMode(false);
// 保存表单数据
settings.setSaveFormData(true);
// 是否应该支持使用其屏幕缩放控件和手势缩放
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
// 启动应用缓存
settings.setAppCacheEnabled(true);
// 设置缓存模式
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
// setDefaultZoom api19被弃用
// 设置此属性,可任意比例缩放。
settings.setUseWideViewPort(true);
// 缩放比例 1
webView.setInitialScale(1);
// 告诉WebView启用JavaScript执行。默认的是false。
settings.setJavaScriptEnabled(true);
// 页面加载好以后,再放开图片
settings.setBlockNetworkImage(false);
// 使用localStorage则必须打开
settings.setDomStorageEnabled(true);
// 排版适应屏幕
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
// WebView是否支持多个窗口。
settings.setSupportMultipleWindows(true);
// webview从5.0开始默认不允许混合模式,https中不能加载http资源,需要设置开启。
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
/** 设置字体默认缩放大小(改变网页字体大小,setTextSize api14被弃用)*/
settings.setTextZoom(100);
// Enable remote debugging via chrome://inspect
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
// AppRTC requires third party cookies to work
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptThirdPartyCookies(webView, true);
}
示例12: onCreate
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
enableStrictMode();
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG);
}
initToolbar();
initSettingsContainer();
ChapterJavaScriptBridge bridge = new ChapterJavaScriptBridge();
binding.epubView.getSettings().setJavascriptBridge(bridge);
binding.epubView.getSettings().setCustomChapterScript(bridge.getCustomChapterScripts());
binding.epubView.getSettings().setFont(EpubFont.fromFontFamily("Monospace"));
binding.epubView.setScrollDirection(EpubScrollDirection.HORIZONTAL_WITH_VERTICAL_CONTENT);
tableOfContentsAdapter = new TableOfContentsAdapter();
tableOfContentsAdapter.bindToEpubView(binding.epubView);
binding.contentsRecyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.contentsRecyclerView.setAdapter(tableOfContentsAdapter);
tableOfContentsAdapter.jumpToChapter()
.doOnNext(chapter -> {
binding.drawerLayout.closeDrawer(Gravity.START);
binding.epubView.gotoLocation(EpubLocation.fromChapter(chapter));
})
.subscribe();
loadEpub().doOnSuccess(epub -> {
binding.epubView.setEpub(epub);
tableOfContentsAdapter.setEpub(epub);
if (savedInstanceState == null) {
binding.epubView.gotoLocation(EpubLocation.fromChapter(10));
}
}).subscribe();
observeEpub();
}
示例13: initSettings
import android.webkit.WebView; //导入方法依赖的package包/类
private void initSettings() {
WebSettings webSettings = mDXHWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= 16) {
webSettings.setAllowFileAccessFromFileURLs(true);
}
webSettings.setDomStorageEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
if (NetworkUtils.isConnected(mContext) ){
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
} else {
webSettings.setCacheMode(
WebSettings.LOAD_CACHE_ELSE_NETWORK);
}
webSettings.setDatabaseEnabled(true);
webSettings.setAppCacheMaxSize(1024 * 1024 * 8);
webSettings.setAppCacheEnabled(true);
//File fDatabase = new File(mContext.getCacheDir().getAbsolutePath(),"webview_db");
//webSettings.setDatabasePath(fDatabase.getAbsolutePath());
File fAppCache = new File(mContext.getCacheDir().getAbsolutePath(),"webview_cache");
webSettings.setAppCachePath(fAppCache.getAbsolutePath());
webSettings.setBuiltInZoomControls(true);// api-3
webSettings.setPluginState(WebSettings.PluginState.ON);
webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
if (Build.VERSION.SDK_INT >= 11) {
webSettings.setDisplayZoomControls(false);// api-11
}
//http://wiki.jikexueyuan.com/project/chrome-devtools/remote-debugging-on-android.html
if (Build.VERSION.SDK_INT >= 19) {//for chrome debug
WebView.setWebContentsDebuggingEnabled(true);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
webSettings.setMixedContentMode(
WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
}