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


Java WebView.setWebContentsDebuggingEnabled方法代碼示例

本文整理匯總了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();
    }
 
開發者ID:BloomBooks,項目名稱:BloomReader,代碼行數:17,代碼來源:ReaderActivity.java

示例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();
    }
}
 
開發者ID:Andy-Ta,項目名稱:COB,代碼行數:10,代碼來源:SystemWebViewEngine.java

示例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);
    }
}
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:16,代碼來源:TubiVPAID.java

示例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;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:36,代碼來源:ReactWebViewManager.java

示例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();
    }
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:10,代碼來源:CordovaWebView.java

示例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());
}
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:10,代碼來源:BridgeWebView.java

示例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);
        }
    }
}
 
開發者ID:yosriz,項目名稱:android-datamaps,代碼行數:8,代碼來源:DataMapsView.java

示例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();
}
 
開發者ID:Webtrekk,項目名稱:webtrekk-android-sdk,代碼行數:39,代碼來源:MainActivity.java

示例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;
}
 
開發者ID:TryGhost,項目名稱:Ghost-Android,代碼行數:32,代碼來源:WebViewFragment.java

示例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);
}
 
開發者ID:luffyjet,項目名稱:WebViewJavaScriptBridge,代碼行數:16,代碼來源:WebViewJavaScriptBridge.java

示例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);


}
 
開發者ID:zhao-mingjian,項目名稱:qvod,代碼行數:52,代碼來源:WebViewPresenter.java

示例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();
}
 
開發者ID:smartmobilefactory,項目名稱:EpubReaderAndroid,代碼行數:43,代碼來源:MainActivity.java

示例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);
    }
}
 
開發者ID:yale8848,項目名稱:CacheWebView,代碼行數:50,代碼來源:TestWebView.java


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