public static List<ConnectLink> BuildGetEngagedList( ) { List<ConnectLink> linkEntries = new List<ConnectLink>(); // parse the config and see how many additional links we need. for ( int i = 0; i < App.Shared.Config.ConnectConfig.GetEngagedList.Length; i += 4 ) { ConnectLink link = new ConnectLink(); linkEntries.Add( link ); link.Title = App.Shared.Config.ConnectConfig.GetEngagedList[ i ]; link.SubTitle = App.Shared.Config.ConnectConfig.GetEngagedList[ i + 1 ]; link.Url = App.Shared.Config.ConnectConfig.GetEngagedList[ i + 2 ]; link.ImageName = App.Shared.Config.ConnectConfig.GetEngagedList[ i + 3 ]; } return linkEntries; }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( App.Shared.Config.ControlStylingConfig.BackgroundColor ); LinkEntries = ConnectLink.BuildList( ); // ensure the first link entry is always group finder. ConnectLink link = new ConnectLink( ); link.Title = ConnectStrings.Main_Connect_GroupFinder; link.ImageName = PrivateConnectConfig.GroupFinder_IconImage; LinkEntries.Insert( 0, link ); ConnectTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; ConnectTableView.Source = new TableSource( this ); }
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; }