public override void ViewDidLoad() { base.ViewDidLoad(); TableView.RegisterNibForCellReuse(UINib.FromName(NotificationTableViewCell.Identifier, NSBundle.MainBundle), NotificationTableViewCell.Identifier); TableView.TableFooterView = new UIView(); TableView.BackgroundView = ViewUtils.GetBackgroundView("Loading Notifications", true); TableView.EstimatedRowHeight = 150; NotificationFeedTableViewSource = new NotificationFeedTableViewSource(this); TableView.DataSource = NotificationFeedTableViewSource; TableView.Delegate = new BaseTableViewDelegate(this); }
public void BindDataToCell (Notification notification, FeedTypeEnum.FeedType target, List<Notification> underlyingDataSource, NSIndexPath indexPath, UITableView tableView, NotificationFeedTableViewSource source) { CellCaptionLabel.AttributedText = NativeStringUtils.ParseStringForKeywords (notification, notification.message); CellCaptionLabel.TextContainer.LineFragmentPadding = 0; CellCaptionLabel.TextContainerInset = UIEdgeInsets.Zero; CellCaptionLabel.ContentInset = new UIEdgeInsets (5, 0, 5, 0); CellCaptionLabel.SizeToFit (); CellTimeElapsedLabel.Text = StringUtils.GetPrettyDateAbs (notification.datestamp); CellTimeRemaining.ClipsToBounds = true; CellTimeRemaining.Layer.CornerRadius = 4; SetCommentImage (notification); SetTimeRemaining (notification); SetPostUserImageAndUsername (notification); SetUserAction (notification, target); SetButtonListeners (notification, underlyingDataSource, indexPath, tableView, source, target); SetPostImage (notification); }
private void SetButtonListeners (Notification notification, List<Notification> underlyingDataSource, NSIndexPath indexPath, UITableView tableView, NotificationFeedTableViewSource source, FeedTypeEnum.FeedType target) { UITapGestureRecognizer tapGesture = new UITapGestureRecognizer (delegate(UITapGestureRecognizer obj) { TenServiceHelper.ParseForMentionOrHash(obj, indexPath, tableView); }); CellCaptionLabel.AddGestureRecognizer (tapGesture); CellCaptionLabel.Selectable = true; CellCaptionLabel.DataDetectorTypes = UIDataDetectorType.Link; CellUserImageButton.RemoveTarget (null, null, UIControlEvent.TouchUpInside); CellUserImageButton.TouchUpInside += (sender, e) => { if (target == FeedTypeEnum.FeedType.StatusFeed) { ((HomeViewController)((UINavigationController)((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController.ViewControllers [0]).ViewControllers [0]).DismissModalViewController (false); } if (notification.post == null) { TenServiceHelper.GoToGuestProfile (notification.user); } else { TenServiceHelper.GoToGuestProfile (notification.post.userPoster); } }; CellUsernameLabel.RemoveTarget (null, null, UIControlEvent.TouchUpInside); CellUsernameLabel.TouchUpInside += (sender, e) => { if (target == FeedTypeEnum.FeedType.StatusFeed) { ((HomeViewController)((UINavigationController)((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController.ViewControllers [0]).ViewControllers [0]).DismissModalViewController (false); } if (notification.post == null) { TenServiceHelper.GoToGuestProfile (notification.user); } else { if(notification.user != null && (notification.user.idUser != Globe.SharedInstance.User.idUser) || target == FeedTypeEnum.FeedType.StatusFeed){ TenServiceHelper.GoToGuestProfile (notification.user); } else { TenServiceHelper.GoToGuestProfile (notification.post.userPoster); } } }; CellClockImage.RemoveTarget (null, null, UIControlEvent.TouchUpInside); CellClockImage.TouchUpInside += (sender, e) => { if (target == FeedTypeEnum.FeedType.StatusFeed) { ((HomeViewController)((UINavigationController)((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController.ViewControllers [0]).ViewControllers [0]).DismissModalViewController (false); } TenServiceHelper.GoToListOf (FeedTypeEnum.FeedType.LikersListOfFeed, notification.post.idPost); }; CellTimeRemaining.RemoveTarget (null, null, UIControlEvent.TouchUpInside); CellTimeRemaining.TouchUpInside += (sender, e) => { if (target == FeedTypeEnum.FeedType.StatusFeed) { ((HomeViewController)((UINavigationController)((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController.ViewControllers [0]).ViewControllers [0]).DismissModalViewController (false); } TenServiceHelper.GoToListOf (FeedTypeEnum.FeedType.LikersListOfFeed, notification.post.idPost); }; }