List of usage examples for org.apache.cordova CordovaWebViewClient setWebView
@Deprecated public void setWebView(CordovaWebView view)
From source file:com.AlcaldiaSucre.App.CordovaActivity.java
License:Apache License
/** * Initialize web container with web view objects. * * @param webView//from w w w. jav a 2s . c om * @param webViewClient * @param webChromeClient */ @SuppressLint("NewApi") public void init(CordovaWebView webView, CordovaWebViewClient webViewClient, CordovaChromeClient webChromeClient) { LOG.d(TAG, "CordovaActivity.init()"); // Set up web container this.appView = webView; this.appView.setId(100); this.appView.setWebViewClient(webViewClient); this.appView.setWebChromeClient(webChromeClient); webViewClient.setWebView(this.appView); webChromeClient.setWebView(this.appView); this.appView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.0F)); if (this.getBooleanProperty("DisallowOverscroll", false)) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) { this.appView.setOverScrollMode(CordovaWebView.OVER_SCROLL_NEVER); } } // Add web view but make it invisible while loading URL this.appView.setVisibility(View.INVISIBLE); this.root.addView(this.appView); setContentView(this.root); // Clear cancel flag this.cancelLoadUrl = false; }
From source file:com.djoin.parking.parking.java
License:Apache License
@SuppressLint("NewApi") @Override/*from w w w .j av a 2 s.co m*/ public void init(CordovaWebView webView, CordovaWebViewClient webViewClient, CordovaChromeClient webChromeClient) { LOG.d(TAG, "CordovaActivity.init()"); // Set up web container this.appView = webView; this.appView.setId(100); //js? this.appView.addJavascriptInterface(new JsInterface(), "jsinterface"); this.appView.setWebViewClient(webViewClient); this.appView.setWebChromeClient(webChromeClient); webViewClient.setWebView(this.appView); webChromeClient.setWebView(this.appView); this.appView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.0F)); if (this.getBooleanProperty("disallowOverscroll", false)) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) { this.appView.setOverScrollMode(CordovaWebView.OVER_SCROLL_NEVER); } } // Add web view but make it invisible while loading URL this.appView.setVisibility(View.INVISIBLE); View v = getLayoutInflater().inflate(R.layout.main, null); mDrawerLayout = (DrawerLayout) v.findViewById(R.id.drawer_layout); myroot = (LinearLayout) v.findViewById(R.id.content_frame); mLeftNav = (ListView) v.findViewById(R.id.left_nav); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); myroot.setBackgroundColor(Color.BLACK); setTheme(R.style.gray); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); myroot.addView(this.appView); setContentView(mDrawerLayout); // Clear cancel flag this.cancelLoadUrl = false; }
From source file:com.ft.cordovaFT.java
@Override public void onCreate(Bundle savedInstanceState) { Intent fulladintent = getIntent();/*w w w.java 2s . com*/ String fulladstring = fulladintent.getStringExtra("fulladActivity"); if (null == fulladstring) { Intent adintent = new Intent(cordovaFT.this, FullAdActivity.class); startActivity(adintent); this.finish(); super.onDestroy(); } String index_html = GlobalTool.getResources(this, "index.html"); String base_url = GlobalTool.getResources(this, "base_url.txt"); String indexcont = GlobalTool.getResources(this, "indexcont.txt"); String indexcont2 = GlobalTool.getResources(this, "indexcont2.txt"); super.onCreate(savedInstanceState); super.init(); // super.setBooleanProperty("loadInWebView", true); // super.setIntegerProperty("loadUrlTimeoutValue", 600000000); super.setIntegerProperty("splashscreen", R.drawable.splash); super.appView.getSettings().setJavaScriptEnabled(true); super.appView.getSettings().setSupportMultipleWindows(true); super.appView.getSettings().setPluginState(PluginState.ON); CordovaWebViewClient webViewClient = new CustomCordovaWebViewClient(this); //iframea super.appView.setWebChromeClient(new WebChromeClient() { @Override public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, android.os.Message resultMsg) { WebView newWebView = new WebView(view.getContext()); WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj; transport.setWebView(newWebView); resultMsg.sendToTarget(); return true; } }); JavascriptClient javascriptClient = new JavascriptClient(this); webViewClient.setWebView(this.appView); this.appView.setWebViewClient(webViewClient); this.appView.addJavascriptInterface(javascriptClient, "ftjavacriptapp"); int sdkid = android.os.Build.VERSION.SDK_INT; if (sdkid >= 19) { this.appView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ONLY); if ((GlobalTool.isWiFiActive(this) && !indexcont.equals(indexcont2) || indexcont.equals("0"))) { this.appView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); } super.loadUrl(base_url, 3000); } else { super.loadUrl("file:///android_asset/index.html", 3000); this.appView.loadDataWithBaseURL(base_url, index_html, "text/html", "utf-8", null); } super.appView.setVerticalScrollBarEnabled(true); super.appView.setHorizontalScrollBarEnabled(false); // set scrollbar style super.appView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); pushData pushData = new pushData(this.getBaseContext()); Alldata push_d = pushData.getpush(); if (push_d.getData().equals("0")) { startService(new Intent(cordovaFT.this, ForegroundService.class)); } ProgressBarAsyncTask asyncTask = new ProgressBarAsyncTask(this); asyncTask.execute(); // AppKeyppChannel String appkey = GlobalTool.getResources(this, "appkey.txt"); String channel = GlobalTool.getResources(this, "channel.txt"); StatService.setAppKey(appkey);// appkeymtjAndroidManifest.xml StatService.setAppChannel(channel);// appChannelmtj StatService.setOn(this, StatService.EXCEPTION_LOG); StatService.setLogSenderDelayed(10); StatService.setSendLogStrategy(this, SendStrategyEnum.APP_START, 1, false); DownHomePage downhomepage = new DownHomePage(this); downhomepage.execute(); super.appView.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View v) { return true; } }); // NBSAppAgent.setLicenseKey("95a11b364bfb4fde85e326e5efc76c1c") // .withLocationServiceEnabled(true).start(this); }
From source file:me.ncu.quickgap.QuickGap.java
License:Apache License
private void createCordovaWebview(String id, String url) { CordovaWebView webview = new CordovaWebView(this); CordovaWebViewClient webviewc = null; if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { webviewc = new CordovaWebViewClient(this, webview); } else {/* w w w . j a v a 2s.c o m*/ webviewc = new IceCreamCordovaWebViewClient(this, webview); } webview.setWebViewClient(webviewc); webviewc.setWebView(webview); CordovaChromeClient webviewcc = null; webviewcc = new CordovaChromeClient(this, webview); webview.setWebChromeClient(webviewcc); webviewcc.setWebView(webview); RelativeLayout.LayoutParams webviewLayout = new RelativeLayout.LayoutParams(display.getWidth(), display.getHeight()); webviewLayout.alignWithParent = true; webview.setLayoutParams(webviewLayout); //this.root.addView(webview); webview.loadUrl(url); webview.addJavascriptInterface(new QGJavaScriptInterface(this), "quickgap"); webviewPool.put(id, webview); final String viewId = id; Animation animation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_in_left); animation.setFillAfter(true); animation.setFillEnabled(true); animation.setDuration(animationDuration); animation.setAnimationListener(new AnimationListener() { public void onAnimationEnd(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } }); webviewPool.get(viewId).startAnimation(animation); }