当前位置: 首页>>代码示例>>C#>>正文


C# WebView.AddJavascriptInterface方法代码示例

本文整理汇总了C#中WebView.AddJavascriptInterface方法的典型用法代码示例。如果您正苦于以下问题:C# WebView.AddJavascriptInterface方法的具体用法?C# WebView.AddJavascriptInterface怎么用?C# WebView.AddJavascriptInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebView的用法示例。


在下文中一共展示了WebView.AddJavascriptInterface方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreateView

		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			
			ViewGroup root = (ViewGroup)inflater.Inflate (Resource.Layout.fragment_webview_with_spinner, null);

			// For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
			// FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
			root.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
	
			loadingSpinner = root.FindViewById (Resource.Id.loading_spinner);
			webView = root.FindViewById<WebView> (Resource.Id.webview);
			webView.SetWebChromeClient (webChromeClient);
			webView.SetWebViewClient (webViewClient);
	
			webView.Post (() => {
				if (CLEAR_CACHE_ON_LOAD) {
					webView.ClearCache (true);	
				}
				webView.Settings.JavaScriptEnabled = true;
				webView.Settings.JavaScriptCanOpenWindowsAutomatically = false;
				webView.LoadUrl (MAP_URL);
				webView.AddJavascriptInterface (new MyMapJsi (Activity, savedInstanceState), MAP_JSI_NAME);
			});
			
			return root;
			
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:27,代码来源:MapFragment.cs

示例2: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _messageHub = Mvx.Resolve<IMvxMessenger>();

            var url = Intent.GetStringExtra("cheesebaron.mvxplugins.azureaccesscontrol.droid.Url");

            Window.RequestFeature(WindowFeatures.Progress);

            _webView = new WebView(this)
            {
                VerticalScrollBarEnabled = true,
                HorizontalScrollBarEnabled = true,
                ScrollBarStyle = ScrollbarStyles.OutsideOverlay,
                ScrollbarFadingEnabled = true
            };

            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);
            _webView.Settings.BuiltInZoomControls = true;
            _webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            
            var notify = new AccessControlJavascriptNotify();
            notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            _webView.AddJavascriptInterface(notify, "external");
            _webView.SetWebViewClient(new AuthWebViewClient());
            _webView.SetWebChromeClient(new AuthWebChromeClient(this));

            _webView.LoadUrl(url);

            AddContentView(_webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
        }
开发者ID:kstreet,项目名称:Cheesebaron.MvxPlugins,代码行数:34,代码来源:AccessControlWebAuthActivity.cs

示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var url = Intent.GetStringExtra("monodroid.watoolkit.library.login.url");

            System.Diagnostics.Debug.WriteLine(url);

            Window.RequestFeature(WindowFeatures.Progress);

            var webView = new WebView(this);

            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            var notify = new AccessControlJavascriptNotify();
            notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            webView.AddJavascriptInterface(notify, "external");
            webView.SetWebViewClient(new AuthWebViewClient());
            webView.SetWebChromeClient(new AuthWebChromeClient(this));
            
            webView.LoadUrl(url);

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));
        }
开发者ID:Cheesebaron,项目名称:MonoDroid.WAToolkit,代码行数:33,代码来源:AccessControlWebAuthActivity.cs

示例4: GAEChannelClient

 /// <summary>
 /// Asynchronously open an AppEngine channel. </summary>
 public GAEChannelClient(Activity activity, string token, MessageHandler handler)
 {
     webView = new WebView(activity);
     webView.Settings.JavaScriptEnabled = true;
     webView.SetWebChromeClient(new WebChromeClientAnonymousInnerClassHelper(this)); // Purely for debugging.
     webView.SetWebViewClient(new WebViewClientAnonymousInnerClassHelper(this)); // Purely for debugging.
     Log.Debug(TAG,string.Format("token:{0}", token));
     _androidMessageHandler = new androidMessageHandler(activity, handler, token);
     webView.AddJavascriptInterface(_androidMessageHandler, "androidMessageHandler");
     webView.LoadUrl("file:///android_asset/channel.html");
 }
开发者ID:kenneththorman,项目名称:appspotdemo-mono,代码行数:13,代码来源:GAEChannelClient.cs

示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

#if __APPCOMPAT__
            ActionBar.SetDisplayHomeAsUpEnabled(true);
#elif __ANDROID_14__
            Window.RequestFeature(WindowFeatures.ActionBar | WindowFeatures.Progress);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
#else
            Window.RequestFeature(WindowFeatures.Progress);
#endif

            _messageHub = Mvx.Resolve<IMvxMessenger>();

            var url = Intent.GetStringExtra("cheesebaron.mvxplugins.azureaccesscontrol.droid.Url");

            _webView = new WebView(this)
            {
                VerticalScrollBarEnabled = true,
                HorizontalScrollBarEnabled = true,
                ScrollbarFadingEnabled = false,
                ScrollBarStyle = ScrollbarStyles.OutsideOverlay
            };

            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);
            _webView.Settings.BuiltInZoomControls = true;
            _webView.Settings.LoadWithOverviewMode = true;
            _webView.Settings.UseWideViewPort = true;

            _notify = new external();
            _notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            _webView.AddJavascriptInterface(_notify, "external");
            _webView.SetWebViewClient(new AuthWebViewClient());
            _webView.SetWebChromeClient(new AuthWebChromeClient(this));

            _webView.LoadUrl(url);

            AddContentView(_webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
        }
开发者ID:Everbridge,项目名称:sm-Cheesebaron.MvxPlugins,代码行数:42,代码来源:AccessControlWebAuthActivity.cs

示例6: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			this.RequestWindowFeature (WindowFeatures.NoTitle);

			// Create your application here
			var endpoint = this.Intent.GetStringExtra ("signInUrl");

			var mainLayout = new LinearLayout (this);
			mainLayout.SetPadding (0, 0, 0, 0);

			var webClient = new AuthenticationWebViewClient ();
			
			webView = new WebView(this);
			webView.VerticalScrollBarEnabled=false;
			webView.HorizontalScrollBarEnabled=false;
			webView.SetWebViewClient (webClient);
			webView.Settings.JavaScriptEnabled=true;
			webView.LayoutParameters= new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,ViewGroup.LayoutParams.MatchParent);
			webView.Settings.SavePassword=false;
			webView.LoadUrl (endpoint);
			webView.AddJavascriptInterface(new AuthenticationJavaScriptInterface(this), "HTMLOUT");
			mainLayout.AddView(webView);
			this.SetContentView(mainLayout,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,ViewGroup.LayoutParams.MatchParent));

			if (thisActivity == null) {
				thisActivity = this;
			} 

		}
开发者ID:kidozen,项目名称:kido-xamarin,代码行数:30,代码来源:PassiveAuthActivity.cs

示例7: OnCreate

		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			//
			// Load the state either from a configuration change or from the intent.
			//
			state = LastNonConfigurationInstance as State;
			if (state == null && Intent.HasExtra ("StateKey")) {
				var stateKey = Intent.GetStringExtra ("StateKey");
				state = StateRepo.Remove (stateKey);
			}
			if (state == null) {
				Finish ();
				return;
			}

			Title = state.Authenticator.Title;

			//
			// Watch for completion
			//
			state.Authenticator.Completed += (s, e) => {
				SetResult (e.IsAuthenticated ? Result.Ok : Result.Canceled);
				Finish ();
			};
			state.Authenticator.Error += (s, e) => {
				if (e.Exception != null) {
					this.ShowError ("Authentication Error", e.Exception);
				}
				else {
					this.ShowError ("Authentication Error", e.Message);
				}
				BeginLoadingInitialUrl ();
			};

			//
			// Build the UI
			//
			webView = new WebView (this) {
				Id = 42,
			};

			JavascriptInterceptor jsInterceptor = new JavascriptInterceptor (this);
			webView.AddJavascriptInterface (jsInterceptor, "jsInterceptor");

			webView.Settings.JavaScriptEnabled = true;
			webView.SetWebViewClient (new Client (this));
			webView.SetWebChromeClient (new ChromeClient ());

			SetContentView (webView);

			//
			// Restore the UI state or start over
			//
			if (savedInstanceState != null) {
				webView.RestoreState (savedInstanceState);
			}
			else {
				if (Intent.GetBooleanExtra ("ClearCookies", true))
					WebAuthenticator.ClearCookies();

				BeginLoadingInitialUrl ();
			}
		}
开发者ID:Xipas,项目名称:Symplified.Auth,代码行数:65,代码来源:WebAuthenticatorActivity.cs

示例8: LoadPublicationReader

        private void LoadPublicationReader()
        {
            webview = View.FindViewById<WebView>(Resource.Id.readerWebView);
            webview2 = View.FindViewById<WebView>(Resource.Id.readerWebView2);

            webview.SetWebViewClient(client);
            webview.Settings.JavaScriptEnabled = true;
            webview.Settings.PluginsEnabled = true;
            //webview.Settings.DisplayZoomControls = true;
            webview.Settings.BuiltInZoomControls = true;
            webview.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
            webview.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
            webview.LoadDataWithBaseURL("file:///android_asset/", html, "text/html", "utf-8", null);

            if (ThisApp.preferences.GetBoolean("dualWebviews", false))
            {
                string lang = ThisApp.preferences.GetString("listSecondLanguage", ThisApp.Language);

                XDocument doc2 = ThisApp.GetNWTFile(lang, ThisApp.selectedPublication.Image);

                List<PublicationArticle> collection2 = doc2.Descendants("article")
                .Select(article => new PublicationArticle
                {
                    ArticleTitle = article.Element("title").Value,
                    Content = article.Element("content").Value,
                    DocumentLocation = article.Element("documentLocation").Value,
                    PublicationTitle = ThisApp.selectedPublication.Image
                }).ToList();

                string html2 = collection2.ElementAt(int.Parse(chapter) - 1).Content;

                ThisApp.selectedPublicationArticle = ThisApp.GetAllPublicationArticles().ElementAt(int.Parse(chapter) - 1);

                webview2.SetWebViewClient(new NWTBibleWebView(Activity, lang, ThisApp.doHighlight, null, ThisApp.selectedPublicationArticle.ArticleTitle));
                webview2.Settings.JavaScriptEnabled = true;
                webview2.Settings.PluginsEnabled = true;
                //webview2.Settings.DisplayZoomControls = true;
                webview2.Settings.BuiltInZoomControls = true;
                webview2.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
                webview2.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
                webview2.LoadDataWithBaseURL("file:///android_asset/", html2, "text/html", "utf-8", null);
            }
        }
开发者ID:GuyMicciche,项目名称:SuperNWTBible,代码行数:43,代码来源:ReaderViewPagerActivity.cs

示例9: LoadBibleReader

        private void LoadBibleReader()
        {
            webview = View.FindViewById<WebView>(Resource.Id.readerWebView);
            webview2 = View.FindViewById<WebView>(Resource.Id.readerWebView2);

            webview.SetWebViewClient(client);
            webview.Settings.JavaScriptEnabled = true;
            webview.Settings.PluginsEnabled = true;
            //webview.Settings.DisplayZoomControls = true;
            webview.Settings.BuiltInZoomControls = true;
            webview.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
            webview.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
            webview.LoadDataWithBaseURL("file:///android_asset/", html, "text/html", "utf-8", null);

            if (ThisApp.preferences.GetBoolean("dualWebviews", false))
            {
                string lang = ThisApp.preferences.GetString("listSecondLanguage", ThisApp.Language);

                XDocument doc = ThisApp.GetNWTFile(ThisApp.preferences.GetString("listSecondLanguage", ThisApp.Language), ThisApp.selectedBook.Name.ToUpper());
                string html2 = doc.Descendants("c").ElementAt(int.Parse(chapter) - 1).Value;

                webview2.SetWebViewClient(new NWTBibleWebView(Activity, lang, ThisApp.doHighlight, null, ThisApp.selectedChapter.ChapterNumber));
                webview2.Settings.JavaScriptEnabled = true;
                webview2.Settings.PluginsEnabled = true;
                //webview2.Settings.DisplayZoomControls = true;
                webview2.Settings.BuiltInZoomControls = true;
                webview2.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
                webview2.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
                webview2.LoadDataWithBaseURL("file:///android_asset/", html2, "text/html", "utf-8", null);
            }
        }
开发者ID:GuyMicciche,项目名称:SuperNWTBible,代码行数:31,代码来源:ReaderViewPagerActivity.cs

示例10: LoadBibleReader

        private void LoadBibleReader()
        {
            // Number of chapters in the selected book
            int chapterNum = int.Parse(ThisApp.selectedChapter.ChapterNumber);

            offset = chapterNum;

            // Load xml document of the book
            XDocument doc = ThisApp.GetNWTFile(ThisApp.Language, ThisApp.selectedBook.Name.ToUpper());

            // Load each chapter
            var query = from node in doc.Descendants("c")
                        select new
                        {
                            Data = node.Value
                        };

            numOfChapters = query.Count();

            // Get the CDATA of the selected chapter
            html = query.ElementAt(chapterNum - 1).Data;

            webview = FindViewById<WebView>(Resource.Id.readerWebView);
            webview2 = FindViewById<WebView>(Resource.Id.readerWebView2);

            webview.SetWebViewClient(new NWTBibleWebView(this, ThisApp.Language, ThisApp.doHighlight));
            webview.Settings.JavaScriptEnabled = true;
            webview.Settings.PluginsEnabled = true;
            //webview.Settings.DisplayZoomControls = true;
            webview.Settings.BuiltInZoomControls = true;
            webview.AddJavascriptInterface(new ReaderMenu.VerseSelection(this, webview, webview2), "VerseSelection");
            webview.LoadDataWithBaseURL("file:///android_asset/", html, "text/html", "utf-8", null);

            if (ThisApp.preferences.GetBoolean("dualWebviews", false))
            {
                XDocument doc2 = ThisApp.GetNWTFile(ThisApp.preferences.GetString("listSecondLanguage", ThisApp.Language), ThisApp.selectedBook.Name.ToUpper());

                string html2 = "<html><body><h1>" + offset.ToString() + "</h1></body></html>";
                html2 += doc2.Descendants("c").ElementAt(offset - 1);

                webview2 = FindViewById<WebView>(Resource.Id.readerWebView);
                webview2.SetWebViewClient(new NWTBibleWebView(this, ThisApp.Language, ThisApp.doHighlight));
                webview2.Settings.JavaScriptEnabled = true;
                webview2.Settings.PluginsEnabled = true;
                //webview2.Settings.DisplayZoomControls = true;
                webview2.Settings.BuiltInZoomControls = true;
                webview2.AddJavascriptInterface(new ReaderMenu.VerseSelection(this, webview, webview2), "VerseSelection");
                webview2.LoadDataWithBaseURL("file:///android_asset/", html2, "text/html", "utf-8", null);
            }
        }
开发者ID:GuyMicciche,项目名称:SuperNWTBible,代码行数:50,代码来源:OldReaderActivity.cs

示例11: LoadBibleReader

        private void LoadBibleReader()
        {
            // Load xml document of the book
            XDocument doc = ThisApp.GetNWTFile(ThisApp.Language, ThisApp.selectedBook.Name.ToUpper());

            int chapterNum = int.Parse(ThisApp.selectedChapter.ChapterNumber);

            List<string> collection = doc.Descendants("c").Select((element) => element.Value).ToList();
            ThisApp.allBookChapters = collection;

            numOfChapters = collection.Count();

            // Get the CDATA of the selected chapter
            html = "<html><body><h1>" + chapterNum + "</h1></body></html>";
            html += collection.ElementAt(chapterNum - 1);

            // References
            if (ThisApp.preferences.GetBoolean("bibleReferences", true))
            {
                html = html.Replace("display: none", "display: inline");
            }

            // Add highlight nodes
            html = Regex.Replace(html, @"(\d+.)(</a></span>|</span>)(.*?)((?=<span)|(?=\d+.</a></span>)|(?=</p>))", delegate(Match match)
            {
                string m = "";

                if (match.Groups[2].Value == "</a></span>")
                {
                    m = match.Groups[1].Value + "</a>" + match.Groups[3].Value + "</span>";
                }
                else if (match.Groups[2].Value == "</span>")
                {
                    m = match.Groups[1].Value + match.Groups[3].Value + "</span>";
                }

                return m;
            });
            html = Regex.Replace(html, @"dcv_\d+_", "");

            webview = View.FindViewById<WebView>(Resource.Id.readerWebView);
            webview2 = View.FindViewById<WebView>(Resource.Id.readerWebView2);

            client = new NWTBibleWebView(Activity, ThisApp.Language, ThisApp.doHighlight, null, ThisApp.selectedChapter.ChapterNumber);
            webview.SetWebViewClient(client);
            webview.Settings.JavaScriptEnabled = true;
            webview.Settings.PluginsEnabled = true;
            webview.Settings.BuiltInZoomControls = true;
            webview.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
            webview.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
            webview.LoadDataWithBaseURL("file:///android_asset/", html, "text/html", "utf-8", null);

            if (ThisApp.preferences.GetBoolean("dualWebviews", false))
            {
                string lang = ThisApp.preferences.GetString("listSecondLanguage", ThisApp.Language);

                string html2 = "<html><body><h1>" + chapterNum + "</h1></body></html>";

                XDocument doc2 = ThisApp.GetNWTFile(lang, ThisApp.selectedBook.Name.ToUpper());
                html2 += doc2.Descendants("c").ElementAt(chapterNum - 1);

                // References
                if (ThisApp.preferences.GetBoolean("bibleReferences", true))
                {
                    html2 = html2.Replace("display: none", "display: inline");
                }

                // Add highlight nodes
                html2 = Regex.Replace(html2, @"(\d+.)(</a></span>|</span>)(.*?)((?=<span)|(?=\d+.</a></span>)|(?=</p>))", delegate(Match match)
                {
                    string m = "";

                    if (match.Groups[2].Value == "</a></span>")
                    {
                        m = match.Groups[1].Value + "</a>" + match.Groups[3].Value + "</span>";
                    }
                    else if (match.Groups[2].Value == "</span>")
                    {
                        m = match.Groups[1].Value + match.Groups[3].Value + "</span>";
                    }

                    return m;
                });
                html2 = Regex.Replace(html2, @"dcv_\d+_", "");

                webview2.SetWebViewClient(new NWTBibleWebView(Activity, lang, ThisApp.doHighlight, null, ThisApp.selectedChapter.ChapterNumber));
                webview2.Settings.JavaScriptEnabled = true;
                webview2.Settings.PluginsEnabled = true;
                webview2.Settings.BuiltInZoomControls = true;
                webview2.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
                webview2.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
                webview2.LoadDataWithBaseURL("file:///android_asset/", html2, "text/html", "utf-8", null);
            }
        }
开发者ID:GuyMicciche,项目名称:SuperNWTBible,代码行数:94,代码来源:ReaderFragment.cs

示例12: LoadPublicationReader

        public void LoadPublicationReader(int chapter = 1)
        {
            ThisApp.allPublicationArticles = ThisApp.GetAllPublicationArticles();

            ThisApp.selectedPublicationArticle = ThisApp.allPublicationArticles.ElementAt(chapter - 1);

            numOfChapters = ThisApp.allPublicationArticles.Count();

            // Get the CDATA of the selected chapter
            html = "<html><body><h1>" + ThisApp.selectedPublicationArticle.ArticleTitle + "</h1></body></html>";
            html += ThisApp.allPublicationArticles.ElementAt(chapter - 1).Content.Replace("PageOnLoad", "PubOnLoad");

            webview = View.FindViewById<WebView>(Resource.Id.readerWebView);
            webview2 = View.FindViewById<WebView>(Resource.Id.readerWebView2);

            client = new NWTBibleWebView(Activity, ThisApp.Language, ThisApp.doHighlight, null, ThisApp.selectedPublicationArticle.ArticleTitle);
            webview.SetWebViewClient(client);
            webview.Settings.JavaScriptEnabled = true;
            webview.Settings.PluginsEnabled = true;
            webview.Settings.BuiltInZoomControls = true;
            webview.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
            webview.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
            webview.LoadDataWithBaseURL("file:///android_asset/", html, "text/html", "utf-8", null);

            if (ThisApp.preferences.GetBoolean("dualWebviews", false))
            {
                string lang = ThisApp.preferences.GetString("listSecondLanguage", ThisApp.Language);

                XDocument doc2;
                if (ThisApp.GetAllPublications(lang).Any(p => p.Image == ThisApp.selectedPublication.Image))
                {
                    doc2 = ThisApp.GetNWTFile(lang, ThisApp.selectedPublication.Image);
                }
                else
                {
                    doc2 = ThisApp.GetNWTFile(ThisApp.Language, ThisApp.selectedPublication.Image);
                    ThisApp.AlertBox(Activity, "REMINDER", "This document does not exist in " + lang + ".");
                }

                List<PublicationArticle> collection2 = doc2.Descendants("article")
                .Select(article => new PublicationArticle
                {
                    ArticleTitle = article.Element("title").Value,
                    Content = article.Element("content").Value,
                    DocumentLocation = article.Element("documentLocation").Value,
                    PublicationTitle = ThisApp.selectedPublication.Image
                }).ToList();

                string html2 = "<html><body><h1>" + collection2.ElementAt(chapter - 1).ArticleTitle + "</h1></body></html>";
                html2 += collection2.ElementAt(chapter - 1).Content.Replace("PageOnLoad", "PubOnLoad");

                webview2.SetWebViewClient(new NWTBibleWebView(Activity, lang, ThisApp.doHighlight, null, ThisApp.selectedPublicationArticle.ArticleTitle));
                webview2.Settings.JavaScriptEnabled = true;
                webview2.Settings.PluginsEnabled = true;
                webview2.Settings.BuiltInZoomControls = true;
                webview2.Settings.DefaultFontSize = ThisApp.UserFontSize(Activity);
                webview2.AddJavascriptInterface(new VerseSelection(Activity, webview, webview2), "VerseSelection");
                webview2.LoadDataWithBaseURL("file:///android_asset/", html2, "text/html", "utf-8", null);
            }

            // Highlighting a publication paragraph.
            //webview.SetOnLongClickListener(new PublicationLongClickListener(this));
        }
开发者ID:GuyMicciche,项目名称:SuperNWTBible,代码行数:63,代码来源:ReaderFragment.cs


注:本文中的WebView.AddJavascriptInterface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。