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 is the source if (source == MainPage) { // and it's button id 0, goto the create page if (buttonId == 0) { PresentFragment(CreatePage, true); } } else if (source == CreatePage) { if (buttonId == 0) { PostPage.PrayerRequest = (Rock.Client.PrayerRequest)context; PresentFragment(PostPage, true); } } else if (source == PostPage) { // this is our first / only "circular" navigation, as we're returning to the main page after // having posted a prayer. In which case, clear the back stack. NavbarFragment.FragmentManager.PopBackStack(null, PopBackStackFlags.Inclusive); PresentFragment(MainPage, false); } } }
public virtual void Activate(bool forResume) { // if we're simply resuming, we dont need to reset the fragment, the task is already setup. if (forResume == false) { Rock.Mobile.Util.Debug.WriteLine("Popping back stack"); NavbarFragment.FragmentManager.PopBackStack(null, PopBackStackFlags.Inclusive); // present our starting fragment, and don't allow back navigation PresentFragment(StartingFragment( ), false); } // if the springboard is already closed, set ourselves as ready. // This is always called before any fragment methods, so the fragment // will be able to know if it can display or not. // alternatively, if we're simply resuming from a pause, it's ok to allow the note to show. if (NavbarFragment.ShouldTaskAllowInput( ) || forResume == true) { TaskReadyForFragmentDisplay = true; } else { TaskReadyForFragmentDisplay = false; } }
public override void OnClick(Fragment source, int buttonId, object context) { base.OnClick(source, buttonId, context); // only handle input if the springboard is closed if (NavbarFragment.ShouldTaskAllowInput( )) { // decide what to do. if (source == MainPage) { ConnectLink linkEntry = (ConnectLink)context; // group finder is the only connect link that doesn't use an embedded webView. if (linkEntry.Title == ConnectStrings.Main_Connect_GroupFinder) { // launch group finder (and have it auto-show the search) GroupFinder.ShowSearchOnAppear = true; // if we're logged in, give it a starting address if (MobileApp.Shared.Network.RockMobileUser.Instance.LoggedIn == true && MobileApp.Shared.Network.RockMobileUser.Instance.HasFullAddress( )) { GroupFinder.SetSearchAddress(MobileApp.Shared.Network.RockMobileUser.Instance.Street1( ), MobileApp.Shared.Network.RockMobileUser.Instance.City( ), MobileApp.Shared.Network.RockMobileUser.Instance.State( ), MobileApp.Shared.Network.RockMobileUser.Instance.Zip( )); } PresentFragment(GroupFinder, true); } else { // launch the ConnectWebFragment. TaskWebFragment.HandleUrl(false, true, linkEntry.Url, this, WebFragment); } } else if (source == GroupFinder) { // turn off auto-show search so that if the user presses 'back', we don't pop it up again. GroupFinder.ShowSearchOnAppear = false; MobileAppApi.GroupSearchResult entry = (MobileAppApi.GroupSearchResult)context; GroupInfo.GroupEntry = entry; PresentFragment(GroupInfo, true); } else if (source == GroupInfo) { MobileAppApi.GroupSearchResult entry = (MobileAppApi.GroupSearchResult)context; JoinGroup.GroupTitle = entry.Name; JoinGroup.Distance = string.Format("{0:##.0} {1}", entry.DistanceFromSource, ConnectStrings.GroupFinder_MilesSuffix); JoinGroup.GroupID = entry.Id; JoinGroup.MeetingTime = string.IsNullOrEmpty(entry.MeetingTime) == false ? entry.MeetingTime : ConnectStrings.GroupFinder_ContactForTime; PresentFragment(JoinGroup, true); } } }
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 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); } } } } }