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 void RowClicked(int rowIndex) { if (rowIndex > -1) { ConnectLink linkEntry = null; // is this a getEngaged row? if (rowIndex < GetEngagedEntries.Count) { linkEntry = GetEngagedEntries[rowIndex]; } // did they pick something valid? if (linkEntry != null) { // GroupFinder is unique in that it doesn't use a webView. if (linkEntry.Title == ConnectStrings.Main_Connect_GroupFinder) { TaskUIViewController viewController = Storyboard.InstantiateViewController("GroupFinderViewController") as TaskUIViewController; Task.PerformSegue(this, viewController); } else { TaskWebViewController.HandleUrl(false, true, linkEntry.Url, Task, this, false, false, 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 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]) { // since we're switching to the read notes VC, pop to the main page root and // remove it, because we dont' want back history (where would they go back to?) ParentViewController.ClearViewControllerStack( ); // create and launch the group finder. It's fine to create it here because we always dynamically create this controller. TaskUIViewController viewController = Storyboard.InstantiateViewController("GroupFinderViewController") as TaskUIViewController; ParentViewController.PushViewController(viewController, false); } else { List <ConnectLink> engagedEntries = ConnectLink.BuildGetEngagedList( ); ConnectLink connectLink = engagedEntries.Where(e => e.Command_Keyword == arguments[1]).SingleOrDefault( ); if (connectLink != null) { // clear out the stack and push the main connect page onto the stack ParentViewController.ClearViewControllerStack( ); ParentViewController.PushViewController(MainPageVC, false); // now go to the requested URL (and do not animate it--that could allow a race condition if this action is called rapidly TaskWebViewController.HandleUrl(false, true, connectLink.Url, this, MainPageVC, false, false, false, false); } } } break; } } }
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.Connect_Primary, container, false); view.SetOnTouchListener(this); GetEngagedEntries = ConnectLink.BuildGetEngagedList( ); GetEngagedBillboards = new Bitmap[GetEngagedEntries.Count]; ListView = view.FindViewById <ListView>(Resource.Id.connect_primary_list); ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { // ignore clicks to the top banner if (e.Position > 0) { // get the row index relative to getEngaged int getEngagedRowIndex = e.Position - 1; // if they clicked a non-groupfinder row, get the link they want to visit ParentTask.OnClick(this, getEngagedRowIndex, GetEngagedEntries[getEngagedRowIndex]); } }; ListView.SetOnTouchListener(this); ListView.Adapter = new ArrayAdapter(this); return(view); }
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.Connect_Primary, container, false); view.SetOnTouchListener( this ); LinkEntries = ConnectLink.BuildList( ); // insert group finder into the beginning of the list so it's always the first entry ConnectLink groupFinderLink = new ConnectLink( ); groupFinderLink.Title = ConnectStrings.Main_Connect_GroupFinder; groupFinderLink.ImageName = PrivateConnectConfig.GroupFinder_IconImage; LinkEntries.Insert( 0, groupFinderLink ); LinkBillboards = new Bitmap[ LinkEntries.Count ]; ListView = view.FindViewById<ListView>( Resource.Id.connect_primary_list ); ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e ) => { // ignore clicks to the top banner if( e.Position > 0 ) { if( e.Position == 1 ) { ParentTask.OnClick( this, 0 ); } else { // if they clicked a non-groupfinder row, get the link they want to visit ParentTask.OnClick( this, e.Position - 1, LinkEntries[ e.Position - 1 ].Url ); } } }; ListView.SetOnTouchListener( this ); ListView.Adapter = new ArrayAdapter( this ); if ( ParentTask.TaskReadyForFragmentDisplay == true ) { SetupDisplay( view ); } return view; }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); GetEngagedEntries = ConnectLink.BuildGetEngagedList( ); }
UITableViewCell GetActivityCell(UITableView tableView, ConnectLink link, bool showSeperator) { SeriesCell cell = tableView.DequeueReusableCell(SeriesCell.Identifier) as SeriesCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new SeriesCell(UITableViewCellStyle.Default, SeriesCell.Identifier); cell.Parent = this; // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height); // configure the cell colors cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); cell.SelectionStyle = UITableViewCellSelectionStyle.None; } // Thumbnail Image cell.Image.Image = new UIImage(NSBundle.MainBundle.BundlePath + "/" + link.ImageName); cell.Image.SizeToFit( ); nfloat topPadding = 10; // force the image to be sized according to the height of the cell cell.Image.Frame = new CGRect(0, topPadding, PrivateConnectConfig.MainPage_ThumbnailDimension, PrivateConnectConfig.MainPage_ThumbnailDimension); nfloat availableTextWidth = cell.Bounds.Width - cell.Chevron.Bounds.Width - cell.Image.Bounds.Width - 10; // Chevron nfloat chevronYPos = cell.Image.Frame.Top + ((PrivateConnectConfig.MainPage_ThumbnailDimension - cell.Chevron.Bounds.Height) / 2); cell.Chevron.Layer.Position = new CGPoint(cell.Bounds.Width - cell.Chevron.Bounds.Width - 5, chevronYPos); // Create the title cell.Title.Text = link.Title.ToUpper( ); cell.Title.SizeToFit( ); cell.SubTitle.Text = link.SubTitle; cell.SubTitle.SizeToFit( ); // Position the Title & Date in the center to the right of the image nfloat totalTextHeight = cell.Title.Bounds.Height + cell.SubTitle.Bounds.Height - 6; cell.Title.Frame = new CGRect(cell.Image.Frame.Right + 10, ((PrivateConnectConfig.MainPage_ThumbnailDimension - totalTextHeight) / 2) + topPadding, availableTextWidth - 5, cell.Title.Frame.Height); cell.SubTitle.Frame = new CGRect(cell.Image.Frame.Right + 10, cell.Title.Frame.Bottom - 6, availableTextWidth - 5, cell.Title.Frame.Height); // add the seperator to the bottom if (showSeperator) { cell.Seperator.Hidden = false; cell.Seperator.Frame = new CGRect(0, cell.Image.Frame.Bottom + 10, cell.Bounds.Width, 1); PendingSeriesCellHeight = cell.Seperator.Frame.Bottom; } else { cell.Seperator.Hidden = true; PendingSeriesCellHeight = cell.Image.Frame.Bottom + 10; } return(cell); }