public override void PerformAction(string command, string[] arguments) { base.PerformAction(command, arguments); switch (command) { // is this a goto command? case PrivateGeneralConfig.App_URL_Commands_Goto: { // make sure the argument is for us if (arguments[0] == Command_Keyword( ) && arguments.Length > 1) { // check for groupfinder, because we support that one. if (PrivateGeneralConfig.App_URL_Page_GroupFinder == arguments[1]) { PresentFragment(GroupFinder, true); } else { List <ConnectLink> engagedEntries = ConnectLink.BuildGetEngagedList( ); ConnectLink connectLink = engagedEntries.Where(e => e.Command_Keyword == arguments[1]).SingleOrDefault( ); if (connectLink != null) { // now go to the requested URL TaskWebFragment.HandleUrl(false, true, connectLink.Url, this, WebFragment); } } } break; } } }
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 Activate(bool forResume) { base.Activate(forResume); if (forResume == false) { string fullUrl = Rock.Mobile.Util.Strings.Parsers.AddParamToURL(AboutConfig.Url, string.Format(PrivateGeneralConfig.RockCampusContext, MobileApp.Shared.Network.RockMobileUser.Instance.GetRelevantCampus( ))); TaskWebFragment.HandleUrl(false, true, fullUrl, this, MainPage); } }
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); } } } } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } View view = inflater.Inflate(Resource.Layout.Login, container, false); view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); view.SetOnTouchListener(this); RelativeLayout navBar = view.FindViewById <RelativeLayout>(Resource.Id.navbar_relative_layout); navBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); RectangleF bounds = new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels); BlockerView = new UIBlockerView(view, bounds); LoginResultLayer = view.FindViewById <View>(Resource.Id.result_background); ControlStyling.StyleBGLayer(LoginResultLayer); LoginResultLayer.Alpha = 0.0f; LoginButton = view.FindViewById <Button>(Resource.Id.loginButton); ControlStyling.StyleButton(LoginButton, LoginStrings.LoginButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LoginButton.Click += (object sender, EventArgs e) => { TryRockBind( ); }; CancelButton = view.FindViewById <Button>(Resource.Id.cancelButton); ControlStyling.StyleButton(CancelButton, GeneralStrings.Cancel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); CancelButton.Background = null; CancelButton.Click += (object sender, EventArgs e) => { SpringboardParent.ModalFragmentDone(null); }; TextView additionalOptions = view.FindViewById <TextView>(Resource.Id.additionalOptions); ControlStyling.StyleUILabel(additionalOptions, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); additionalOptions.Text = LoginStrings.AdditionalOptions; TextView orTextView = view.FindViewById <TextView>(Resource.Id.orTextView); ControlStyling.StyleUILabel(orTextView, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); orTextView.Text = LoginStrings.OrString; RegisterButton = view.FindViewById <Button>(Resource.Id.registerButton); ControlStyling.StyleButton(RegisterButton, LoginStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); RegisterButton.Click += (object sender, EventArgs e) => { SpringboardParent.ModalFragmentDone(null); SpringboardParent.RegisterNewUser( ); }; ForgotPasswordButton = view.FindViewById <Button>(Resource.Id.forgotPasswordButton); ControlStyling.StyleButton(ForgotPasswordButton, LoginStrings.ForgotPasswordButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); ForgotPasswordButton.Click += (object sender, EventArgs e) => { TaskWebFragment.HandleUrl(true, true, LoginConfig.ForgotPassword_Url, null, null); }; // get the username field and background UsernameLayer = view.FindViewById <View>(Resource.Id.login_background); ControlStyling.StyleBGLayer(UsernameLayer); UsernameField = view.FindViewById <EditText>(Resource.Id.usernameText); UserNameBGColor = ControlStylingConfig.BG_Layer_Color; ControlStyling.StyleTextField(UsernameField, LoginStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); View borderView = UsernameLayer.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // get the password field and background PasswordLayer = view.FindViewById <View>(Resource.Id.password_background); ControlStyling.StyleBGLayer(PasswordLayer); PasswordField = view.FindViewById <EditText>(Resource.Id.passwordText); PasswordBGColor = ControlStylingConfig.BG_Layer_Color; ControlStyling.StyleTextField(PasswordField, LoginStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); LoginResultLabel = view.FindViewById <TextView>(Resource.Id.loginResult); ControlStyling.StyleUILabel(LoginResultLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); // Setup the facebook button FacebookButton = view.FindViewById <ImageButton>(Resource.Id.facebookButton); FacebookButton.Background = null; FacebookButton.Click += (object sender, EventArgs e) => { TryFacebookBind( ); }; // invoke a webview WebLayout = new WebLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); WebLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); WebLayout.SetBackgroundColor(Android.Graphics.Color.Black); return(view); }