private void SetupTable() { _source = new GenericTableViewSource <IManageItem>(ItemTable) { GetIdentifierFunc = (item, path) => { NSString identifier; if (item is ManageUser) { identifier = ManageUserCell.Identifier; } else if (item is ManageLabel) { identifier = ManageLabelCell.Identifier; } else { identifier = ManageItemCell.Identifier; } return(identifier); }, RowSelectionFunc = (view, path, item) => { ViewModel.ItemSelected(item); }, ModifyCellFunc = (cell, path, arg3) => { if (cell is ManageItemCell && ItemTable.CheckIfLastRow(path)) { ((ManageItemCell)cell).SetBottomRuler(true); } else if (cell is ManageItemCell) { ((ManageItemCell)cell).SetBottomRuler(false); } }, AutoDeselect = true, }; ItemTable.RegisterClassForCellReuse(typeof(ManageUserCell), ManageUserCell.Identifier); ItemTable.RegisterClassForCellReuse(typeof(ManageLabelCell), ManageLabelCell.Identifier); ItemTable.RegisterClassForCellReuse(typeof(ManageItemCell), ManageItemCell.Identifier); ItemTable.Bounces = true; ItemTable.ContentInset = new UIEdgeInsets(5, 0, 0, 0); ItemTable.BackgroundColor = Appearance.Colors.BackgroundColor; ItemTable.EstimatedRowHeight = 50; ItemTable.RowHeight = UITableView.AutomaticDimension; ItemTable.Source = _source; }
private void SetupTable() { _source = new GenericTableViewSource <IUser>(ContactTable) { GetIdentifierFunc = (model, path) => ContactCell.Identifier, RowSelectionFunc = (view, path, user) => { NavigationController.PopViewController(false); ViewModel.ItemSelectCommand.Execute(user); }, AutoDeselect = true, }; ContactTable.Source = _source; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { _mentionsTable.Dispose(); _mentionsTable = null; _source.Dispose(); _source = null; _mentionsTableTopConstraint.Dispose(); _mentionsTable = null; } }
private void SetupTable() { _source = new GenericTableviewSourceWithHeight <IItemBase>(TableView) { GetIdentifierFunc = (item, path) => { if (item is IEvent) { return(EventDetailCell.Identifier); } return(CommentCell.Identifier); }, ModifyCellFunc = (cell, path, item) => { ModifyCommentCell(cell, item, path); ModifyEventDetailCell(cell, item); }, GetCellHeightFunc = (view, path, item) => { if (item is IComment) { return(GetCommentCellHeight(item as IComment)); } return(GetEventCellHeight(item as IEvent)); }, GetEstimatedHeightFunc = (view, path, item) => { if (item is IComment) { return(GetCommentCellHeight(item as IComment)); } return(GetEventCellHeight(item as IEvent)); } }; TableView.BackgroundColor = Appearance.Colors.BackgroundColor; TableView.AllowsSelection = false; TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; TableView.RegisterClassForCellReuse(typeof(CommentCell), CommentCell.Identifier); TableView.RegisterClassForCellReuse(typeof(EventDetailCell), EventDetailCell.Identifier); TableView.Source = _source; }
private void SetupTable() { _source = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable) { GetIdentifierFunc = (item, path) => { if (item is IEvent) { return(EventCell.Identifier); } return(HeaderImageCell.Identifier); }, RowSelectionFunc = (view, path, item) => { if (item is IEvent) { ViewModel.EventSelected(item.Id); } }, AutoDeselect = true, GetCellHeightFunc = (view, path, arg3) => { return(UIScreen.MainScreen.Bounds.Width * 0.5f + 2); }, GetEstimatedHeightFunc = (view, path, item) => { return(UIScreen.MainScreen.Bounds.Width * 0.5f + 2); }, }; _refreshControl = new MvxUIRefreshControl(); ItemsTable.AddSubview(_refreshControl); ItemsTable.AllowsSelection = true; ItemsTable.RegisterClassForCellReuse(typeof(EventCell), EventCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(HeaderImageCell), HeaderImageCell.Identifier); ItemsTable.Source = _source; }
private void SetupTable() { _source = new GenericTableViewSource <INotification>(ItemsTable) { GetIdentifierFunc = (item, path) => NotificationCell.Identifier, RowSelectionFunc = (view, path, arg3) => ViewModel.SelectedCommand.Execute(arg3), AutoDeselect = true, UseAnimations = true, AddAnimation = UITableViewRowAnimation.Top, RemoveAnimation = UITableViewRowAnimation.Bottom, ReplaceAnimation = UITableViewRowAnimation.Middle, }; _refreshControl = new MvxUIRefreshControl(); ItemsTable.RegisterClassForCellReuse(typeof(NotificationCell), NotificationCell.Identifier); ItemsTable.AddSubview(_refreshControl); ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor; ItemsTable.RowHeight = UITableView.AutomaticDimension; ItemsTable.EstimatedRowHeight = 44; ItemsTable.Source = _source; }
private void SetupTable() { _mentionsTable = new UITableView(); _mentionsTable.RegisterClassForCellReuse(typeof(MentionCell), MentionCell.Identifier); _mentionsTable.EstimatedRowHeight = 58; _mentionsTable.RowHeight = UITableView.AutomaticDimension; _mentionsTable.SeparatorStyle = UITableViewCellSeparatorStyle.None; _mentionsTable.Bounces = false; _source = new GenericTableViewSource <MentionUser>(_mentionsTable) { GetIdentifierFunc = (user, path) => MentionCell.Identifier, RowSelectionFunc = (view, path, arg3) => { MentionViewModel.MentionSelected(arg3); }, }; _mentionsTable.Source = _source; _mentionsTable.Frame = new CGRect(0, 0, 100, 100); View.AddSubviews(_mentionsTable); }
private void SetupTable() { _source = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable) { GetIdentifierFunc = (item, path) => { if (item is HeaderImage) { return(HeaderImageCell.Identifier); } if (item is Event) { return(EventCell.Identifier); } if (item is EventCategoryDouble) { return(EventCategoryDoubleCell.Identifier); } if (item is IEventCategory) { return(EventCategoryCell.Identifier); } return(AllEventsCell.Identifier); }, GetCellHeightFunc = (view, path, item) => { return(GetCellHeight(item)); }, GetEstimatedHeightFunc = (view, path, item) => { return(GetCellHeight(item)); } // TODO: Vanwege de double image header cell kan row selectie niet want we weten niet op welke plaats er is getapped in de cell, later verbeteren met tap gestures : http://stackoverflow.com/questions/11070874/how-can-i-distinguish-which-part-of-uitableviewcell-has-been-clicked //RowSelectionFunc = (view, path, item) => //{ // if (item is DoubleHeaderImage) // { // ViewModel.CategorySelected(); // } // ViewModel.CategorySelected(item.Id); // ItemsTable.DeselectRow(path, true); //} }; foreach (var subview in ItemsTable.Subviews) { if (subview is UIScrollView) { ((UIScrollView)subview).DelaysContentTouches = false; } } _refreshControl = new MvxUIRefreshControl(); ItemsTable.AddSubview(_refreshControl); ItemsTable.ContentInset = new UIEdgeInsets(0, 0, 5, 0); ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor; // The image header is only shown when there is only 1 category in the platform ItemsTable.RegisterClassForCellReuse(typeof(HeaderImageCell), HeaderImageCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(EventCell), EventCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(EventCategoryCell), EventCategoryCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(AllEventsCell), AllEventsCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(EventCategoryDoubleCell), EventCategoryDoubleCell.Identifier); ItemsTable.Source = _source; }
private void SetupTable() { // Main feed needs top offset //if (ViewModel.FeedId == Guid.Empty) //{ // FeedTable.ContentInset = new UIEdgeInsets(5, 0, 0, 0); //} _source = new GenericTableviewSourceWithHeight <IFeedItem>(FeedTable) { GetIdentifierFunc = (item, path) => { if (item is CompanyFeedItem) { return(CompanyFeedCell.Identifier); } if (item is GroupFeedItem) { return(GroupFeedCell.Identifier); } return(FeedPostCell.Identifier); }, GetCellHeightFunc = (view, path, item) => { if (item is CompanyFeedItem) { return(GetCompanyCellHeight()); } if (item is GroupFeedItem) { return(470); } return(GetPostCellHeight(item as IFeedPost)); }, GetEstimatedHeightFunc = (view, path, item) => { if (item is CompanyFeedItem) { return(547); } if (item is GroupFeedItem) { return(470); } nfloat imageHeight = 0; var post = item as IFeedPost; if (post != null) { if (post.NumberOfImages == 1) { // 8 spacing below image imageHeight += UIScreen.MainScreen.Bounds.Width * 0.6f + 8; } else if (post.NumberOfImages == 2) { // 8 spacing below image imageHeight += (UIScreen.MainScreen.Bounds.Width - 3) / 2 * 0.6f + 8; } else if (post.NumberOfImages > 2) { // 8 spacing below image imageHeight += UIScreen.MainScreen.Bounds.Width * 0.6f + 8; imageHeight += (UIScreen.MainScreen.Bounds.Width - 3) / 2 * 0.6f + 3; } var finalHeight = 133 + imageHeight; if (_textHeights.ContainsKey(post.Id)) { finalHeight += _textHeights[post.Id]; } return(finalHeight); } throw new Exception("FEED ----- UNKOWN ITEM TYPE IN LIST"); }, ModifyCellFunc = (cell, path, item) => { if (item is CompanyFeedItem) { CalculateCompanyTextHeightCombined(item as CompanyFeedItem, cell as CompanyFeedCell); } var post = item as IFeedPost; if (post != null) { SetCellText(post, cell); var postCell = cell as FeedPostCell; if (postCell != null) { if (post.NumberOfImages == 1) { postCell.SetMainImageVisible(); } else if (post.NumberOfImages == 2) { postCell.SetSubImagesVisible(); } else if (post.NumberOfImages > 2) { postCell.SetAllImagesVisible(); } else { postCell.SetNoImagesVisible(); } postCell.SetInformationVisible(post.Title != null); } } }, AutoDeselect = true, }; _refreshControl = new MvxUIRefreshControl(); FeedTable.RegisterClassForCellReuse(typeof(CompanyFeedCell), CompanyFeedCell.Identifier); FeedTable.RegisterClassForCellReuse(typeof(GroupFeedCell), GroupFeedCell.Identifier); FeedTable.RegisterClassForCellReuse(typeof(FeedPostCell), FeedPostCell.Identifier); //_bottomActivityIndicatorView = new MvxUiRefreshControl //{ // Frame = new CGRect(0, 0, 320, 66) //}; //FeedTable.TableFooterView = _bottomActivityIndicatorView; FeedTable.Source = _source; FeedTable.AddSubview(_refreshControl); FeedTable.ReloadData(); }
private void SetupTable() { _source = new GenericTableviewSourceWithHeight <IChatItem>(MessageTable) { GetIdentifierFunc = (item, path) => { if (item is IChatMessage) { return(ChatMessageCell.Identifier); } // If not a message has to be a label cell return(ChatLabelCell.Identifier); }, GetCellHeightFunc = (view, path, item) => { if (item is IChatLabel) { return(20); } // 10 spacing // Disp name height // 5 spacing // Message height // 10 spacing nfloat finalHeight = 25; if (_textHeights.ContainsKey(item.Id)) { finalHeight += _textHeights[item.Id]; } else { finalHeight += CalculateTextHeight(item); } return(finalHeight); }, GetEstimatedHeightFunc = (view, path, item) => { if (item is IChatLabel) { return(20); } // 10 spacing // Disp name height // 5 spacing // Message height // 10 spacing nfloat finalHeight = 25; if (_textHeights.ContainsKey(item.Id)) { finalHeight += _textHeights[item.Id]; } else { finalHeight += CalculateTextHeight(item); } return(finalHeight); }, UseAnimations = false, }; MessageTable.RegisterClassForCellReuse(typeof(ChatLabelCell), ChatLabelCell.Identifier); MessageTable.Source = _source; }
private void SetupTable() { _membersSource = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable) { GetIdentifierFunc = (item, path) => { if (item is MemberSearchItem) { return(MembersSearchCell.Identifier); } if (item is MembersButtonItem) { return(MembersButtonCell.Identifier); } if (item is ICompany) { return(MembersCompanyCell.Identifier); } return(MemberCell.Identifier); }, RowSelectionFunc = (view, path, baseItem) => { ViewModel.MemberSelected(baseItem); }, GetCellHeightFunc = (view, path, item) => { if (item is MembersButtonItem) { Debug.WriteLine("BUTTON ITEM AT ROW : {0}", path.Row); } if (item is IUser || item is ICompany) { return(68); } return(62); }, GetEstimatedHeightFunc = (view, path, item) => { if (item is IUser || item is ICompany) { return(68); } return(62); }, //ViewToMove = SearchContainer, //ConstraintToChange = SearchContainerTopConstraint, UseAnimations = true, AddAnimation = UITableViewRowAnimation.Left, RemoveAnimation = UITableViewRowAnimation.Right, ReplaceAnimation = UITableViewRowAnimation.Middle, AutoDeselect = true, }; ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor; ItemsTable.RegisterClassForCellReuse(typeof(MembersCompanyCell), MembersCompanyCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(MembersButtonCell), MembersButtonCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(MembersSearchCell), MembersSearchCell.Identifier); ItemsTable.RegisterClassForCellReuse(typeof(MemberCell), MemberCell.Identifier); ItemsTable.Source = _membersSource; _refreshControl = new MvxUIRefreshControl(); ItemsTable.AddSubviews(_refreshControl); }