public override void OnClick(Android.App.Fragment source, int buttonId, object context = null) { // only handle input if the springboard is closed if (NavbarFragment.ShouldTaskAllowInput( )) { // if the main page had a VALID news item clicked, go to it if (source == MainPage && buttonId < News.Count) { // mark that they tapped this item. NewsAnalytic.Instance.Trigger(NewsAnalytic.Read, MainPage.News[buttonId].News.Title); // either take them to the details page, or skip it and go straight to Learn More. if (MainPage.News[buttonId].News.SkipDetailsPage == true && string.IsNullOrEmpty(MainPage.News[buttonId].News.ReferenceURL) == false) { if (Springboard.IsAppURL(MainPage.News[buttonId].News.ReferenceURL) == true) { NavbarFragment.HandleAppURL(MainPage.News[buttonId].News.ReferenceURL); } else { // copy the news item's relevant members. That way, if we're running in debug, // and they want to override the news item, we can do that below. string newsUrl = MainPage.News[buttonId].News.ReferenceURL; bool newsImpersonation = MainPage.News[buttonId].News.IncludeImpersonationToken; bool newsExternalBrowser = MainPage.News[buttonId].News.ReferenceUrlLaunchesBrowser; // If we're running a debug build, see if we should override the news #if DEBUG if (DebugConfig.News_Override_Item == true) { newsUrl = DebugConfig.News_Override_ReferenceURL; newsImpersonation = DebugConfig.News_Override_IncludeImpersonationToken; newsExternalBrowser = DebugConfig.News_Override_ReferenceUrlLaunchesBrowser; } #endif TaskWebFragment.HandleUrl(newsExternalBrowser, newsImpersonation, newsUrl, this, WebFragment); } } else { // store the news index they chose so we can manage the 'tap details' page. DetailsPage.SetNewsInfo(MainPage.News[buttonId].News.Title, MainPage.News[buttonId].News.Description, MainPage.News[buttonId].News.GetDeveloperInfo( ), MainPage.News[buttonId].News.ReferenceURL, MainPage.News[buttonId].News.ReferenceUrlLaunchesBrowser, MainPage.News[buttonId].News.IncludeImpersonationToken, MainPage.News[buttonId].News.ImageName, MainPage.News[buttonId].News.ImageURL); PresentFragment(DetailsPage, true); } } else if (source == DetailsPage) { // otherwise visit the reference URL if (buttonId == Resource.Id.news_details_launch_url || buttonId == Resource.Id.news_details_header_image_button) { // if this is an app url, handle it internally if (Springboard.IsAppURL(DetailsPage.ReferenceURL) == true) { NavbarFragment.HandleAppURL(DetailsPage.ReferenceURL); } else { // copy the news item's relevant members. That way, if we're running in debug, // and they want to override the news item, we can do that below. string newsUrl = DetailsPage.ReferenceURL; bool newsImpersonation = DetailsPage.IncludeImpersonationToken; bool newsExternalBrowser = DetailsPage.ReferenceURLLaunchesBrowser; // If we're running a debug build, see if we should override the news #if DEBUG if (DebugConfig.News_Override_Item == true) { newsUrl = DebugConfig.News_Override_ReferenceURL; newsImpersonation = DebugConfig.News_Override_IncludeImpersonationToken; newsExternalBrowser = DebugConfig.News_Override_ReferenceUrlLaunchesBrowser; } #endif TaskWebFragment.HandleUrl(newsExternalBrowser, newsImpersonation, newsUrl, this, WebFragment); } } } } }
public override void OnClick(Android.App.Fragment source, int buttonId, object context = null) { // only handle input if the springboard is closed if (NavbarFragment.ShouldTaskAllowInput( )) { // decide what to do. if (source == MainPage) { // on the main page, if the buttonId was -1, the user tapped the header, // so we need to either go to the Watch or Take Notes page if (buttonId == -1) { // the context is the button they clicked (watch or take notes) int buttonChoice = (int)context; // 0 is listen if (buttonChoice == 0) { ListenPage.MediaUrl = MainPage.SeriesEntries[0].Series.Messages[0].AudioUrl; ListenPage.ShareUrl = MainPage.SeriesEntries[0].Series.Messages[0].ShareUrl; ListenPage.Name = MainPage.SeriesEntries[0].Series.Messages[0].Name; PresentFragment(ListenPage, true); } // 1 is watch else if (buttonChoice == 1) { WatchPage.MediaUrl = MainPage.SeriesEntries[0].Series.Messages[0].WatchUrl; WatchPage.ShareUrl = MainPage.SeriesEntries[0].Series.Messages[0].ShareUrl; WatchPage.Name = MainPage.SeriesEntries[0].Series.Messages[0].Name; PresentFragment(WatchPage, true); } // 2 is read else if (buttonChoice == 2) { NotesPage.NoteUrl = MainPage.SeriesEntries[0].Series.Messages[0].NoteUrl; NotesPage.NoteName = MainPage.SeriesEntries[0].Series.Messages[0].Name; PresentFragment(NotesPage, true); } // 3 is discussion guide else if (buttonChoice == 3) { DiscGuidePage.DiscGuideURL = MainPage.SeriesEntries[0].Series.Messages[0].DiscussionGuideUrl; PresentFragment(DiscGuidePage, true); } } else { DetailsPage.Series = MainPage.SeriesEntries[buttonId].Series; PresentFragment(DetailsPage, true); } } else if (source == DetailsPage) { // the context is the button they clicked (watch or take notes) int buttonChoice = (int)context; // 0 is listen if (buttonChoice == 0) { ListenPage.MediaUrl = DetailsPage.Series.Messages[buttonId].AudioUrl; ListenPage.ShareUrl = DetailsPage.Series.Messages[buttonId].ShareUrl; ListenPage.Name = DetailsPage.Series.Messages[buttonId].Name; PresentFragment(ListenPage, true); } // 1 is watch else if (buttonChoice == 1) { WatchPage.MediaUrl = DetailsPage.Series.Messages[buttonId].WatchUrl; WatchPage.ShareUrl = DetailsPage.Series.Messages[buttonId].ShareUrl; WatchPage.Name = DetailsPage.Series.Messages[buttonId].Name; PresentFragment(WatchPage, true); } // 2 is read else if (buttonChoice == 2) { NotesPage.NoteUrl = DetailsPage.Series.Messages[buttonId].NoteUrl; NotesPage.NoteName = DetailsPage.Series.Messages[buttonId].Name; PresentFragment(NotesPage, true); } // 3 is discussion guide else if (buttonChoice == 3) { DiscGuidePage.DiscGuideURL = DetailsPage.Series.Messages[buttonId].DiscussionGuideUrl; PresentFragment(DiscGuidePage, true); } } else if (source == NotesPage) { NotesFragment.UrlClickParams clickParams = (NotesFragment.UrlClickParams)context; if (Springboard.IsAppURL(clickParams.Url) == true) { NavbarFragment.HandleAppURL(clickParams.Url); } else if (App.Shared.BibleRenderer.IsBiblePrefix(clickParams.Url)) { BiblePassagePage = new BiblePassageFragment(clickParams.Url); BiblePassagePage.ParentTask = this; PresentFragment(BiblePassagePage, true); } else { // the context is the activeURL to visit. WebViewPage.DisableIdleTimer = true; TaskWebFragment.HandleUrl(clickParams.UseExternalBrowser, clickParams.UseImpersonationToken, clickParams.Url, this, WebViewPage); } } else if (source == DiscGuidePage) { // Discussion Guide page only has one button, so if it was clicked, // let them view the guide. WebViewPage.DisableIdleTimer = true; TaskWebFragment.HandleUrl(true, false, DiscGuidePage.DiscGuideURL, this, WebViewPage); } } }
public void HandleAppURL(string appUrl) { NavbarFragment.HandleAppURL(appUrl); }