public void UpdateCard(AccountHistoryResponse transaction, bool isFirst, bool isLast) { _topLine.Hidden = isFirst; _bottomLine.Hidden = isLast; _action.Text = transaction.Type.ToString(); _amount.Text = transaction.Amount; var _noLinkAttribute = new UIStringAttributes { Font = Constants.Regular12, ForegroundColor = Constants.R151G155B158, }; var at = new NSMutableAttributedString(); at.Append(new NSAttributedString(transaction.From.Equals(AppSettings.User.Login) ? $"to " : $"from ", _noLinkAttribute)); var login = transaction.From.Equals(AppSettings.User.Login) ? transaction.To : transaction.From; var linkAttribute = new UIStringAttributes { Font = Constants.Semibold12, ForegroundColor = Constants.R255G34B5, Link = new NSUrl(login), }; at.Append(new NSAttributedString($"@{login}", linkAttribute)); _to.SetText(at);; }
public static CellSizeHelper Calculate(Post post) { var photoHeight = (int)(OptimalPhotoSize.Get(new Size() { Height = post.Media[0].Size.Height, Width = post.Media[0].Size.Width }, (float)UIScreen.MainScreen.Bounds.Width, 180, (float)UIScreen.MainScreen.Bounds.Width + 50)); var attributedLabel = new TTTAttributedLabel(); var at = new NSMutableAttributedString(); at.Append(new NSAttributedString(post.Title, _noLinkAttribute)); if (!string.IsNullOrEmpty(post.Description)) { at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(post.Description, _noLinkAttribute)); } foreach (var tag in post.Tags) { if (tag == "steepshot") { continue; } NSUrl tagUrlWithoutWhitespaces = null; try { tagUrlWithoutWhitespaces = new NSUrl(tag.Replace(' ', '#')); } catch (Exception ex) { AppSettings.Reporter.SendCrash(ex); } var linkAttribute = new UIStringAttributes { Link = tagUrlWithoutWhitespaces, Font = Constants.Regular14, ForegroundColor = Constants.R231G72B0, }; at.Append(new NSAttributedString($" #{tag}", linkAttribute)); } attributedLabel.Lines = 0; attributedLabel.SetText(at); var textHeight = attributedLabel.SizeThatFits(new CGSize(UIScreen.MainScreen.Bounds.Width - 15 * 2, 0)).Height; return(new CellSizeHelper(photoHeight, textHeight, at)); }
private void SetAgreementDecoration() { var tsAttribute = new UIStringAttributes { Link = new NSUrl(Pp), Font = Constants.Regular12, ForegroundColor = Constants.R15G24B30, }; var ppAttribute = new UIStringAttributes { Link = new NSUrl(Tos), Font = Constants.Regular12, ForegroundColor = Constants.R15G24B30, }; var noLinkAttribute = new UIStringAttributes { Font = Constants.Regular12, ForegroundColor = Constants.R151G155B158, }; var attributedLabel = new TTTAttributedLabel(); attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link; attributedLabel.Lines = 2; var prop = new NSDictionary(); attributedLabel.LinkAttributes = prop; attributedLabel.ActiveLinkAttributes = prop; attributedLabel.Delegate = new TTTAttributedLabelCustomDelegate(); agreementView.AddSubview(attributedLabel); var at = new NSMutableAttributedString(); at.Append(new NSAttributedString("I agree with ", noLinkAttribute)); at.Append(new NSAttributedString("Terms of Service", tsAttribute)); at.Append(new NSAttributedString(" & ", noLinkAttribute)); at.Append(new NSAttributedString("Privacy Policy", ppAttribute)); attributedLabel.SetText(at); attributedLabel.AutoAlignAxis(axis: ALAxis.Horizontal, otherView: termsSwitcher); attributedLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15f); termsSwitcher.AutoPinEdge(ALEdge.Left, ALEdge.Right, attributedLabel, 5f); termsSwitcher.Layer.CornerRadius = 16; }
public static CellSizeHelper Calculate(Post post) { var attributedLabel = new TTTAttributedLabel(); var at = new NSMutableAttributedString(); var photoHeight = PhotoHeight.Get(post.Media[0].Size); at.Append(new NSAttributedString(post.Title, _noLinkAttribute)); if (!string.IsNullOrEmpty(post.Description)) { at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(post.Description, _noLinkAttribute)); } foreach (var tag in post.Tags) { if (tag == "steepshot") { continue; } var linkAttribute = new UIStringAttributes { Link = new NSUrl(tag), Font = Constants.Regular14, ForegroundColor = Constants.R231G72B0, }; at.Append(new NSAttributedString($" #{tag}", linkAttribute)); } attributedLabel.Lines = 0; attributedLabel.SetText(at); var textHeight = attributedLabel.SizeThatFits(new CGSize(UIScreen.MainScreen.Bounds.Width - 15 * 2, 0)).Height; return(new CellSizeHelper(photoHeight, textHeight, at)); }
public nfloat UpdateProfile(UserProfileResponse userData) { if (userData == null && _userData == null) { return(0); } descriptionY = topViewHeight + mainMargin + verticalSpacing; if (userData != null) { _userData = userData; } if (!string.IsNullOrEmpty(_userData.ProfileImage)) { ImageLoader.Load(_userData.ProfileImage, avatar, size: new CGSize(300, 300)); } else { avatar.Image = UIImage.FromBundle("ic_noavatar"); } if (_userData.Username == AppSettings.User.Login) { powerFrame.ChangePercents((int)_userData.VotingPower); } else { powerFrame.ChangePercents(0); } if (string.IsNullOrEmpty(_userData.Name)) { userName.Hidden = true; } else { userName.Hidden = false; userName.Text = _userData.Name; } if (string.IsNullOrEmpty(_userData.Location)) { userLocation.Hidden = true; } else { userLocation.Hidden = false; userLocation.Text = _userData.Location; } if (AppSettings.User.HasPostingPermission && _userData.Username != AppSettings.User.Login) { followButton.Frame = new CGRect(new CGPoint(mainMargin, descriptionY), new CGSize(UIScreen.MainScreen.Bounds.Width - mainMargin * 2, 40)); descriptionY += verticalSpacing + 40; DecorateFollowButton(); } else { followButton.Hidden = true; followProgress.Hidden = true; } at.SetString(new NSAttributedString(string.Empty)); var noLinkAttribute = new UIStringAttributes { Font = Helpers.Constants.Regular14, ForegroundColor = Helpers.Constants.R15G24B30 }; if (!string.IsNullOrEmpty(_userData.About)) { at.Append(new NSAttributedString(_userData.About, noLinkAttribute)); } if (!string.IsNullOrEmpty(_userData.Website)) { var linkAttribute = new UIStringAttributes { Link = new NSUrl(_userData.Website.Replace(" ", string.Empty)), Font = Helpers.Constants.Semibold14, ForegroundColor = Helpers.Constants.R255G34B5 }; at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(_userData.Website, linkAttribute)); } attributedLabel.SetText(at); var textHeight = attributedLabel.SizeThatFits(new CGSize(UIScreen.MainScreen.Bounds.Width - mainMargin * 2, 0)).Height; attributedLabel.Frame = new CGRect(new CGPoint(mainMargin, descriptionY), new CGSize(UIScreen.MainScreen.Bounds.Width - mainMargin * 2, textHeight)); AddSubview(attributedLabel); //originalityContainer.Frame = new CGRect(new CGPoint(extraMargin, attributedLabel.Frame.Bottom + verticalSpacing), //new CGSize(UIScreen.MainScreen.Bounds.Width - extraMargin * 2, 50)); statsContainer.Frame = new CGRect(new CGPoint(mainMargin, attributedLabel.Frame.Bottom + verticalSpacing),//originalityContainer.Frame.Bottom + verticalSpacing), new CGSize(UIScreen.MainScreen.Bounds.Width - mainMargin * 2, 45)); SetupStats(); //#if DEBUG balanceContainer.Frame = new CGRect(new CGPoint(0, statsContainer.Frame.Bottom + verticalSpacing), new CGSize(UIScreen.MainScreen.Bounds.Width, 70)); balance.Text = $"$ {_userData.EstimatedBalance}"; Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, balanceContainer.Frame.Bottom); return(balanceContainer.Frame.Bottom); //#else //Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, statsContainer.Frame.Bottom + verticalSpacing); //return statsContainer.Frame.Bottom + verticalSpacing; //#endif }
public void UpdateCell(Post post, Action <string> TagAction) { var attributedLabel = new TTTAttributedLabel(); attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link; var prop = new NSDictionary(); attributedLabel.LinkAttributes = prop; attributedLabel.ActiveLinkAttributes = prop; DescriptionView.AddSubview(attributedLabel); attributedLabel.Font = Helpers.Constants.Regular14; attributedLabel.Lines = 0; attributedLabel.UserInteractionEnabled = true; attributedLabel.Enabled = true; attributedLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left); attributedLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Right); attributedLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 15f); attributedLabel.Delegate = new TTTAttributedLabelFeedDelegate(TagAction); var separator = new UIView(); separator.BackgroundColor = iOS.Helpers.Constants.R245G245B245; DescriptionView.AddSubview(separator); separator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, attributedLabel, 15f); separator.AutoPinEdgeToSuperviewEdge(ALEdge.Left); separator.AutoPinEdgeToSuperviewEdge(ALEdge.Right); separator.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom); separator.AutoSetDimension(ALDimension.Height, 1); var noLinkAttribute = new UIStringAttributes { Font = Helpers.Constants.Regular14, ForegroundColor = Helpers.Constants.R15G24B30, }; var at = new NSMutableAttributedString(); at.Append(new NSAttributedString(post.Title, noLinkAttribute)); if (!string.IsNullOrEmpty(post.Description)) { at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(post.Description, noLinkAttribute)); } foreach (var tag in post.Tags) { if (tag == "steepshot") { continue; } var linkAttribute = new UIStringAttributes { Link = new NSUrl(tag), Font = Helpers.Constants.Regular14, ForegroundColor = Helpers.Constants.R231G72B0, }; at.Append(new NSAttributedString($" #{tag}", linkAttribute)); } attributedLabel.SetText(at); }
public override void UpdateCell(Post post) { _currentPost = post; avatarImage.Image = null; _scheduledWorkAvatar?.Cancel(); bodyImage.Image = null; _scheduledWorkBody?.Cancel(); var media = _currentPost.Media[0]; _scheduledWorkBody = ImageService.Instance.LoadUrl(media.Url, Helpers.Constants.ImageCacheDuration) //.Retry(5) .FadeAnimation(false) .WithCache(FFImageLoading.Cache.CacheType.All) .DownSample((int)UIScreen.MainScreen.Bounds.Width) .WithPriority(LoadingPriority.Highest) .Into(bodyImage); if (!string.IsNullOrEmpty(_currentPost.Avatar)) { _scheduledWorkAvatar = ImageService.Instance.LoadUrl(_currentPost.Avatar, TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .FadeAnimation(false) .DownSample(200) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Normal) .Into(avatarImage); } else { avatarImage.Image = UIImage.FromBundle("ic_noavatar"); } topLikers.Hidden = true; if (_currentPost.TopLikersAvatars.Count() >= 1 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[0])) { _scheduledWorkfirst?.Cancel(); firstLiker.Image = null; topLikers.Hidden = false; firstLiker.Hidden = false; _scheduledWorkfirst = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[0], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .DownSample(width: 100) .WithPriority(LoadingPriority.Lowest) .Into(firstLiker); } else { firstLiker.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 2 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[1])) { _scheduledWorksecond?.Cancel(); secondLiker.Image = null; secondLiker.Hidden = false; _scheduledWorksecond = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[1], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .Into(secondLiker); } else { secondLiker.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 3 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[2])) { _scheduledWorkthird?.Cancel(); thirdLiker.Image = null; thirdLiker.Hidden = false; _scheduledWorkthird = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[2], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .Into(thirdLiker); } else { thirdLiker.Hidden = true; } cellText.Text = _currentPost.Author; rewards.Hidden = !BasePresenter.User.IsNeedRewards; //rewards.Text = BaseViewController.ToFormatedCurrencyString(_currentPost.TotalPayoutReward); netVotes.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Like, _currentPost.NetVotes); if (_currentPost.VoteChanging) { Animate(); } else { likeButton.Transform = CGAffineTransform.MakeScale(1f, 1f); likeButton.Selected = _currentPost.Vote; } flagButton.Selected = _currentPost.Flag; viewCommentText.Text = _currentPost.Children == 0 ? AppSettings.LocalizationManager.GetText(LocalizationKeys.PostFirstComment) : AppSettings.LocalizationManager.GetText(LocalizationKeys.ViewComments, _currentPost.Children); likeButton.Enabled = true; flagButton.Enabled = true; postTimeStamp.Text = _currentPost.Created.ToPostTime(); imageHeight.Constant = PhotoHeight.Get(media.Size); contentViewWidth.Constant = UIScreen.MainScreen.Bounds.Width; if (!_isButtonBinded) { cellText.Font = Helpers.Constants.Semibold14; postTimeStamp.Font = Helpers.Constants.Regular12; netVotes.Font = Helpers.Constants.Semibold14; rewards.Font = Helpers.Constants.Semibold14; viewCommentText.Font = Helpers.Constants.Regular14; avatarImage.Layer.CornerRadius = avatarImage.Frame.Size.Width / 2; firstLiker.Layer.CornerRadius = firstLiker.Frame.Size.Width / 2; secondLiker.Layer.CornerRadius = secondLiker.Frame.Size.Width / 2; thirdLiker.Layer.CornerRadius = thirdLiker.Frame.Size.Width / 2; attributedLabel = new TTTAttributedLabel(); attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link; var prop = new NSDictionary(); attributedLabel.LinkAttributes = prop; attributedLabel.ActiveLinkAttributes = prop; commentView.AddSubview(attributedLabel); attributedLabel.Font = Helpers.Constants.Regular14; attributedLabel.Lines = 0; attributedLabel.UserInteractionEnabled = true; attributedLabel.Enabled = true; attributedLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15f); attributedLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15f); attributedLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 15f); viewCommentText.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, attributedLabel, 5f); attributedLabel.Delegate = new TTTAttributedLabelFeedDelegate(TagAction); UITapGestureRecognizer tap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Preview, _currentPost); }); bodyImage.AddGestureRecognizer(tap); UITapGestureRecognizer imageTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Profile, _currentPost); }); UITapGestureRecognizer textTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Profile, _currentPost); }); UITapGestureRecognizer moneyTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Profile, _currentPost); }); avatarImage.AddGestureRecognizer(imageTap); cellText.AddGestureRecognizer(textTap); rewards.AddGestureRecognizer(moneyTap); UITapGestureRecognizer commentTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Comments, _currentPost); }); viewCommentText.AddGestureRecognizer(commentTap); UITapGestureRecognizer netVotesTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Voters, _currentPost); }); netVotes.AddGestureRecognizer(netVotesTap); flagButton.TouchDown += FlagButton_TouchDown; likeButton.TouchDown += LikeTap; _isButtonBinded = true; Debug.WriteLine("Cell created"); } var noLinkAttribute = new UIStringAttributes { Font = Helpers.Constants.Regular14, ForegroundColor = Helpers.Constants.R15G24B30, }; var at = new NSMutableAttributedString(); at.Append(new NSAttributedString(_currentPost.Title, noLinkAttribute)); if (!string.IsNullOrEmpty(_currentPost.Description)) { at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(_currentPost.Description, noLinkAttribute)); } foreach (var tag in _currentPost.Tags) { if (tag == "steepshot") { continue; } var linkAttribute = new UIStringAttributes { Link = new NSUrl(tag), Font = Helpers.Constants.Regular14, ForegroundColor = Helpers.Constants.R231G72B0, }; at.Append(new NSAttributedString($" #{tag}", linkAttribute)); } attributedLabel.SetText(at); }
public nfloat UpdateCell(Post post, CellSizeHelper variables) { _currentPost = post; likesMargin = leftMargin; _avatarImage?.RemoveFromSuperview(); _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30)); _avatarImage.Layer.CornerRadius = _avatarImage.Frame.Size.Width / 2; _avatarImage.ClipsToBounds = true; _avatarImage.ContentMode = UIViewContentMode.ScaleAspectFill; _contentView.AddSubview(_avatarImage); _scheduledWorkAvatar?.Cancel(); if (!string.IsNullOrEmpty(_currentPost.Avatar)) { _scheduledWorkAvatar = ImageService.Instance.LoadUrl(_currentPost.Avatar, TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .FadeAnimation(false) .DownSample(200) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Normal) .Into(_avatarImage); } else { _avatarImage.Image = UIImage.FromBundle("ic_noavatar"); } _author.Text = _currentPost.Author; _timestamp.Text = _currentPost.Created.ToPostTime(); _photoScroll.Frame = new CGRect(0, _avatarImage.Frame.Bottom + 20, UIScreen.MainScreen.Bounds.Width, variables.PhotoHeight); _photoScroll.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width * _currentPost.Media.Length, variables.PhotoHeight); foreach (var subview in _photoScroll.Subviews) { subview.RemoveFromSuperview(); } for (int i = 0; i < _scheduledWorkBody.Length; i++) { _scheduledWorkBody[i]?.Cancel(); } _scheduledWorkBody = new IScheduledWork[_currentPost.Media.Length]; _bodyImage = new UIImageView[_currentPost.Media.Length]; for (int i = 0; i < _currentPost.Media.Length; i++) { _bodyImage[i] = new UIImageView(); _bodyImage[i].ClipsToBounds = true; _bodyImage[i].UserInteractionEnabled = true; _bodyImage[i].ContentMode = UIViewContentMode.ScaleAspectFill; _bodyImage[i].Frame = new CGRect(UIScreen.MainScreen.Bounds.Width * i, 0, UIScreen.MainScreen.Bounds.Width, variables.PhotoHeight); _photoScroll.AddSubview(_bodyImage[i]); _scheduledWorkBody[i] = ImageService.Instance.LoadUrl(_currentPost.Media[i].Url) .Retry(2) .FadeAnimation(false) .WithCache(FFImageLoading.Cache.CacheType.All) .WithPriority(LoadingPriority.Highest) /* .DownloadProgress((f)=> * { * })*/ .Into(_bodyImage[i]); } if (_currentPost.TopLikersAvatars.Any() && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[0])) { _firstLikerImage?.RemoveFromSuperview(); _firstLikerImage = new UIImageView(); _contentView.AddSubview(_firstLikerImage); _firstLikerImage.Layer.CornerRadius = likersCornerRadius; _firstLikerImage.ClipsToBounds = true; _firstLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _firstLikerImage.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkfirst?.Cancel(); _scheduledWorkfirst = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[0], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .DownSample(width: 100) .FadeAnimation(false) .WithPriority(LoadingPriority.Lowest) .Into(_firstLikerImage); likesMargin = _firstLikerImage.Frame.Right + likesMarginConst; } else if (_firstLikerImage != null) { _firstLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 2 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[1])) { _secondLikerImage?.RemoveFromSuperview(); _secondLikerImage = new UIImageView(); _contentView.AddSubview(_secondLikerImage); _secondLikerImage.Layer.CornerRadius = likersCornerRadius; _secondLikerImage.ClipsToBounds = true; _secondLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _secondLikerImage.Frame = new CGRect(_firstLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorksecond?.Cancel(); _scheduledWorksecond = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[1], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .FadeAnimation(false) .Into(_secondLikerImage); likesMargin = _secondLikerImage.Frame.Right + likesMarginConst; } else if (_secondLikerImage != null) { _secondLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 3 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[2])) { _thirdLikerImage?.RemoveFromSuperview(); _thirdLikerImage = new UIImageView(); _contentView.AddSubview(_thirdLikerImage); _thirdLikerImage.Layer.CornerRadius = likersCornerRadius; _thirdLikerImage.ClipsToBounds = true; _thirdLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _thirdLikerImage.Frame = new CGRect(_secondLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkthird?.Cancel(); _scheduledWorkthird = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[2], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .FadeAnimation(false) .Into(_thirdLikerImage); likesMargin = _thirdLikerImage.Frame.Right + likesMarginConst; } else if (_thirdLikerImage != null) { _thirdLikerImage.Hidden = true; } nfloat flagMargin = 0; if (_currentPost.NetLikes != 0) { _likes.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Likes, _currentPost.NetLikes); var likesWidth = _likes.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, likesWidth.Width, underPhotoPanelHeight); flagMargin = flagsMarginConst; } else { _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0); } _likersTapView.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom, _likes.Frame.Right - leftMargin, _likes.Frame.Height); if (_currentPost.NetFlags != 0) { _flags.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Flags, _currentPost.NetFlags); var flagsWidth = _flags.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _flags.Frame = new CGRect(likesMargin + _likes.Frame.Width + flagMargin, _photoScroll.Frame.Bottom, flagsWidth.Width, underPhotoPanelHeight); } else { _flags.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0); } _like.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst, _photoScroll.Frame.Bottom, likeButtonWidthConst, underPhotoPanelHeight); _like.Transform = CGAffineTransform.MakeScale(1f, 1f); if (_currentPost.VoteChanging) { Animate(); } else { _like.Layer.RemoveAllAnimations(); _like.LayoutIfNeeded(); _like.Image = _currentPost.Vote ? UIImage.FromBundle("ic_like_active") : UIImage.FromBundle("ic_like"); _like.UserInteractionEnabled = true; } _verticalSeparator.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst - 1, _photoScroll.Frame.Bottom + underPhotoPanelHeight / 2 - verticalSeparatorHeight / 2, 1, verticalSeparatorHeight); /* * _rewards.Text = BaseViewController.ToFormatedCurrencyString(_currentPost.TotalPayoutReward); * var rewardWidth = _rewards.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); * _rewards.Frame = new CGRect(_verticalSeparator.Frame.Left - rewardWidth.Width, _photoScroll.Frame.Bottom, rewardWidth.Width, underPhotoPanelHeight); */ _topSeparator.Frame = new CGRect(0, _photoScroll.Frame.Bottom + underPhotoPanelHeight, UIScreen.MainScreen.Bounds.Width, 1); _attributedLabel.SetText(variables.Text); _attributedLabel.Frame = new CGRect(new CGPoint(leftMargin, _topSeparator.Frame.Bottom + 15), new CGSize(UIScreen.MainScreen.Bounds.Width - leftMargin * 2, variables.TextHeight)); _comments.Text = _currentPost.Children == 0 ? AppSettings.LocalizationManager.GetText(LocalizationKeys.PostFirstComment) : AppSettings.LocalizationManager.GetText(LocalizationKeys.ViewComments, _currentPost.Children); _comments.Frame = new CGRect(leftMargin - 5, _attributedLabel.Frame.Bottom + 5, _comments.SizeThatFits(new CGSize(10, 20)).Width + 10, 20 + 10); _bottomSeparator.Frame = new CGRect(0, _comments.Frame.Bottom + 10, UIScreen.MainScreen.Bounds.Width, 1); return(_bottomSeparator.Frame.Bottom); //for constant size checking //var constantsSize = _bottomSeparator.Frame.Bottom - _attributedLabel.Frame.Height - _bodyImage.Frame.Height; }
public nfloat UpdateCell(Post post, CellSizeHelper variables, nfloat direction) { _currentPost = post; if (direction == 0) { leftMargin = 0; } else if (direction > 0) { leftMargin = 5; } else { leftMargin = -5; } likesMargin = leftMargin; _avatarImage?.RemoveFromSuperview(); _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30)); _avatarImage.Layer.CornerRadius = _avatarImage.Frame.Size.Width / 2; _avatarImage.ClipsToBounds = true; _avatarImage.ContentMode = UIViewContentMode.ScaleAspectFill; _contentView.AddSubview(_avatarImage); _scheduledWorkAvatar?.Cancel(); if (!string.IsNullOrEmpty(_currentPost.Avatar)) { _scheduledWorkAvatar = ImageService.Instance.LoadUrl(_currentPost.Avatar, TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .FadeAnimation(false) .DownSample(200) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Normal) .Into(_avatarImage); } else { _avatarImage.Image = UIImage.FromBundle("ic_noavatar"); } _author.Text = _currentPost.Author; _timestamp.Text = _currentPost.Created.ToPostTime(); _contentScroll.SetContentOffset(new CGPoint(0, 0), false); _photoScroll.Frame = new CGRect(0, 0, _contentScroll.Frame.Width, variables.PhotoHeight); _photoScroll.ContentSize = new CGSize(_contentScroll.Frame.Width /* * _currentPost.Media.Length*/, variables.PhotoHeight); _photoScroll.SetContentOffset(new CGPoint(0, 0), false); foreach (var subview in _photoScroll.Subviews) { subview.RemoveFromSuperview(); } for (int i = 0; i < _scheduledWorkBody.Length; i++) { _scheduledWorkBody[i]?.Cancel(); } _scheduledWorkBody = new IScheduledWork[1 /*_currentPost.Media.Length*/]; _bodyImage = new UIImageView[1 /*_currentPost.Media.Length*/]; for (int i = 0; i < 1 /*_currentPost.Media.Length*/; i++) { _bodyImage[i] = new UIImageView(); _bodyImage[i].Layer.CornerRadius = 10; _bodyImage[i].ClipsToBounds = true; _bodyImage[i].UserInteractionEnabled = true; _bodyImage[i].ContentMode = UIViewContentMode.ScaleAspectFill; _bodyImage[i].Frame = new CGRect(_contentScroll.Frame.Width * i, 0, _contentScroll.Frame.Width, variables.PhotoHeight); _photoScroll.AddSubview(_bodyImage[i]); _scheduledWorkBody[i] = ImageService.Instance.LoadUrl(_currentPost.Media[0].Url) .Retry(2) .FadeAnimation(false) .WithCache(FFImageLoading.Cache.CacheType.All) .WithPriority(LoadingPriority.Highest) //.DownloadProgress((f)=> //{ //}) .Into(_bodyImage[i]); } if (_currentPost.TopLikersAvatars.Any() && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[0])) { _firstLikerImage?.RemoveFromSuperview(); _firstLikerImage = new UIImageView(); _contentScroll.AddSubview(_firstLikerImage); _firstLikerImage.BackgroundColor = UIColor.White; _firstLikerImage.Layer.CornerRadius = likersCornerRadius; _firstLikerImage.ClipsToBounds = true; _firstLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _firstLikerImage.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkfirst?.Cancel(); _scheduledWorkfirst = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[0], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .DownSample(width: 100) .FadeAnimation(false) .WithPriority(LoadingPriority.Lowest) .Into(_firstLikerImage); likesMargin = _firstLikerImage.Frame.Right + likesMarginConst; } else if (_firstLikerImage != null) { _firstLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 2 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[1])) { _secondLikerImage?.RemoveFromSuperview(); _secondLikerImage = new UIImageView(); _contentScroll.AddSubview(_secondLikerImage); _secondLikerImage.BackgroundColor = UIColor.White; _secondLikerImage.Layer.CornerRadius = likersCornerRadius; _secondLikerImage.ClipsToBounds = true; _secondLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _secondLikerImage.Frame = new CGRect(_firstLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorksecond?.Cancel(); _scheduledWorksecond = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[1], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .FadeAnimation(false) .Into(_secondLikerImage); likesMargin = _secondLikerImage.Frame.Right + likesMarginConst; } else if (_secondLikerImage != null) { _secondLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 3 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[2])) { _thirdLikerImage?.RemoveFromSuperview(); _thirdLikerImage = new UIImageView(); _contentScroll.AddSubview(_thirdLikerImage); _thirdLikerImage.BackgroundColor = UIColor.White; _thirdLikerImage.Layer.CornerRadius = likersCornerRadius; _thirdLikerImage.ClipsToBounds = true; _thirdLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _thirdLikerImage.Frame = new CGRect(_secondLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkthird?.Cancel(); _scheduledWorkthird = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[2], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .FadeAnimation(false) .Into(_thirdLikerImage); likesMargin = _thirdLikerImage.Frame.Right + likesMarginConst; } else if (_thirdLikerImage != null) { _thirdLikerImage.Hidden = true; } nfloat flagMargin = 0; if (_currentPost.NetLikes != 0) { _likes.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Likes, _currentPost.NetLikes); var likesWidth = _likes.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, likesWidth.Width, underPhotoPanelHeight); flagMargin = flagsMarginConst; } else { _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0); } _likersTapView.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom, _likes.Frame.Right - leftMargin, _likes.Frame.Height); if (_currentPost.NetFlags != 0) { _flags.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Flags, _currentPost.NetFlags); var flagsWidth = _flags.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _flags.Frame = new CGRect(likesMargin + _likes.Frame.Width + flagMargin, _photoScroll.Frame.Bottom, flagsWidth.Width, underPhotoPanelHeight); } else { _flags.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0); } _like.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst, _photoScroll.Frame.Bottom, likeButtonWidthConst, underPhotoPanelHeight); _like.Transform = CGAffineTransform.MakeScale(1f, 1f); if (_currentPost.VoteChanging) { Animate(); } else { _like.Layer.RemoveAllAnimations(); _like.LayoutIfNeeded(); _like.Image = _currentPost.Vote ? UIImage.FromBundle("ic_like_active") : UIImage.FromBundle("ic_like"); _like.UserInteractionEnabled = true; } _verticalSeparator.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst - 1, _photoScroll.Frame.Bottom + underPhotoPanelHeight / 2 - verticalSeparatorHeight / 2, 1, verticalSeparatorHeight); /* * _rewards.Text = BaseViewController.ToFormatedCurrencyString(_currentPost.TotalPayoutReward); * var rewardWidth = _rewards.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); * _rewards.Frame = new CGRect(_verticalSeparator.Frame.Left - rewardWidth.Width, _photoScroll.Frame.Bottom, rewardWidth.Width, underPhotoPanelHeight); */ _topSeparator.Frame = new CGRect(0, _photoScroll.Frame.Bottom + underPhotoPanelHeight, _contentScroll.Frame.Width, 1); var at = new NSMutableAttributedString(); var _noLinkAttribute = new UIStringAttributes { Font = Constants.Regular14, ForegroundColor = Constants.R15G24B30, }; at.Append(new NSAttributedString(_currentPost.Title, _noLinkAttribute)); if (!string.IsNullOrEmpty(_currentPost.Description)) { at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(post.Description, _noLinkAttribute)); } foreach (var tag in _currentPost.Tags) { if (tag == "steepshot") { continue; } NSUrl tagUrlWithoutWhitespaces = null; try { tagUrlWithoutWhitespaces = new NSUrl(tag.Replace(' ', '#')); } catch (Exception ex) { AppSettings.Reporter.SendCrash(ex); } var linkAttribute = new UIStringAttributes { Link = tagUrlWithoutWhitespaces, Font = Constants.Regular14, ForegroundColor = Constants.R231G72B0, }; at.Append(new NSAttributedString($" ", _noLinkAttribute)); at.Append(new NSAttributedString($"#{tag}", linkAttribute)); } _attributedLabel?.RemoveFromSuperview(); _attributedLabel = new TTTAttributedLabel(); _attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link; var prop = new NSDictionary(); _attributedLabel.LinkAttributes = prop; _attributedLabel.ActiveLinkAttributes = prop; _attributedLabel.Font = Constants.Regular14; _attributedLabel.Lines = 0; _attributedLabel.UserInteractionEnabled = true; _attributedLabel.Enabled = true; //_attributedLabel.BackgroundColor = UIColor.Blue; _contentScroll.AddSubview(_attributedLabel); _attributedLabel.Delegate = new TTTAttributedLabelFeedDelegate(_tagAction); _attributedLabel.SetText(at); var textHeight = _attributedLabel.SizeThatFits(new CGSize(_contentScroll.Frame.Width, 0)).Height; _attributedLabel.Frame = new CGRect(new CGPoint(leftMargin, _topSeparator.Frame.Bottom + 15), new CGSize(_contentScroll.Frame.Width, textHeight)); _comments.Text = _currentPost.Children == 0 ? AppSettings.LocalizationManager.GetText(LocalizationKeys.PostFirstComment) : AppSettings.LocalizationManager.GetText(LocalizationKeys.ViewComments, _currentPost.Children); _comments.Frame = new CGRect(leftMargin - 5, _attributedLabel.Frame.Bottom + 5, _comments.SizeThatFits(new CGSize(10, 20)).Width + 10, 20 + 10); _bottomSeparator.Frame = new CGRect(0, _comments.Frame.Bottom + 10, _contentScroll.Frame.Width, 1); _contentScroll.ContentSize = new CGSize(_contentScroll.Frame.Width, _bottomSeparator.Frame.Bottom); return(_bottomSeparator.Frame.Bottom); //for constant size checking //var constantsSize = _bottomSeparator.Frame.Bottom - _attributedLabel.Frame.Height - _bodyImage.Frame.Height; }
public void UpdateCell(Post post, CellSizeHelper variables) { _currentPost = post; likesMargin = leftMargin; nfloat likersY = underPhotoPanelHeight / 2 - likersImageSide / 2; _bodyImage.Image = null; _scheduledWorkBody?.Cancel(); _scheduledWorkBody = ImageService.Instance.LoadUrl(_currentPost.Media[0].Url, Constants.ImageCacheDuration) .Retry(5) .FadeAnimation(false) .WithCache(FFImageLoading.Cache.CacheType.All) .DownSample((int)UIScreen.MainScreen.Bounds.Width) .WithPriority(LoadingPriority.Highest) .Into(_bodyImage); _avatarImage.Image = null; _scheduledWorkAvatar?.Cancel(); if (!string.IsNullOrEmpty(_currentPost.Avatar)) { _scheduledWorkAvatar = ImageService.Instance.LoadUrl(_currentPost.Avatar, TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .FadeAnimation(false) .DownSample(200) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Normal) .Into(_avatarImage); } else { _avatarImage.Image = UIImage.FromBundle("ic_noavatar"); } _author.Text = _currentPost.Author; _timestamp.Text = _currentPost.Created.ToPostTime(); _bodyImage.Frame = new CGRect(0, _avatarImage.Frame.Bottom + 20, UIScreen.MainScreen.Bounds.Width, variables.PhotoHeight); /*_bodyImage.Image = null; * _scheduledWorkBody?.Cancel(); * _scheduledWorkBody = ImageService.Instance.LoadUrl(_currentPost.Media[0].Url, Constants.ImageCacheDuration) * .Retry(5) * .FadeAnimation(false) * .WithCache(FFImageLoading.Cache.CacheType.All) * .DownSample((int)UIScreen.MainScreen.Bounds.Width) * .WithPriority(LoadingPriority.Highest) * .Into(_bodyImage);*/ if (_currentPost.TopLikersAvatars.Count() >= 1 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[0])) { _firstLikerImage.Frame = new CGRect(leftMargin, _bodyImage.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkfirst?.Cancel(); _firstLikerImage.Image = null; _firstLikerImage.Hidden = false; _scheduledWorkfirst = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[0], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .DownSample(width: 100) .FadeAnimation(false) .WithPriority(LoadingPriority.Lowest) .Into(_firstLikerImage); likesMargin = _firstLikerImage.Frame.Right + likesMarginConst; } else { _firstLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 2 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[1])) { _secondLikerImage.Frame = new CGRect(_firstLikerImage.Frame.Right - likersMargin, _bodyImage.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorksecond?.Cancel(); _secondLikerImage.Image = null; _secondLikerImage.Hidden = false; _scheduledWorksecond = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[1], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .FadeAnimation(false) .Into(_secondLikerImage); likesMargin = _secondLikerImage.Frame.Right + likesMarginConst; } else { _secondLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 3 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[2])) { _thirdLikerImage.Frame = new CGRect(_secondLikerImage.Frame.Right - likersMargin, _bodyImage.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkthird?.Cancel(); _thirdLikerImage.Image = null; _thirdLikerImage.Hidden = false; _scheduledWorkthird = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[2], TimeSpan.FromDays(30)) .WithCache(FFImageLoading.Cache.CacheType.All) .LoadingPlaceholder("ic_noavatar.png") .ErrorPlaceholder("ic_noavatar.png") .WithPriority(LoadingPriority.Lowest) .DownSample(width: 100) .FadeAnimation(false) .Into(_thirdLikerImage); likesMargin = _thirdLikerImage.Frame.Right + likesMarginConst; } else { _thirdLikerImage.Hidden = true; } nfloat flagMargin = 0; if (_currentPost.NetLikes != 0) { _likes.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Likes, _currentPost.NetLikes); var likesWidth = _likes.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _likes.Frame = new CGRect(likesMargin, _bodyImage.Frame.Bottom, likesWidth.Width, underPhotoPanelHeight); flagMargin = flagsMarginConst; } else { _likes.Frame = new CGRect(likesMargin, _bodyImage.Frame.Bottom, 0, 0); } _likersTapView.Frame = new CGRect(leftMargin, _bodyImage.Frame.Bottom, _likes.Frame.Right - leftMargin, _likes.Frame.Height); if (_currentPost.NetFlags != 0) { _flags.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Flags, _currentPost.NetFlags); var flagsWidth = _flags.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _flags.Frame = new CGRect(likesMargin + _likes.Frame.Width + flagMargin, _bodyImage.Frame.Bottom, flagsWidth.Width, underPhotoPanelHeight); } else { _flags.Frame = new CGRect(likesMargin, _bodyImage.Frame.Bottom, 0, 0); } _like.Frame = new CGRect(ContentView.Frame.Width - likeButtonWidthConst, _bodyImage.Frame.Bottom, likeButtonWidthConst, underPhotoPanelHeight); _like.Transform = CGAffineTransform.MakeScale(1f, 1f); if (_currentPost.VoteChanging) { Animate(); } else { _like.Image = _currentPost.Vote ? UIImage.FromBundle("ic_like_active") : UIImage.FromBundle("ic_like"); _like.UserInteractionEnabled = true; } _verticalSeparator.Frame = new CGRect(ContentView.Frame.Width - likeButtonWidthConst - 1, _bodyImage.Frame.Bottom + underPhotoPanelHeight / 2 - verticalSeparatorHeight / 2, 1, verticalSeparatorHeight); /* * _rewards.Text = BaseViewController.ToFormatedCurrencyString(_currentPost.TotalPayoutReward); * var rewardWidth = _rewards.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); * _rewards.Frame = new CGRect(_verticalSeparator.Frame.Left - rewardWidth.Width, _bodyImage.Frame.Bottom, rewardWidth.Width, underPhotoPanelHeight); */ _topSeparator.Frame = new CGRect(0, _bodyImage.Frame.Bottom + underPhotoPanelHeight, UIScreen.MainScreen.Bounds.Width, 1); _attributedLabel.SetText(variables.Text); _attributedLabel.Frame = new CGRect(new CGPoint(leftMargin, _topSeparator.Frame.Bottom + 15), new CGSize(UIScreen.MainScreen.Bounds.Width - leftMargin * 2, variables.TextHeight)); _comments.Text = _currentPost.Children == 0 ? AppSettings.LocalizationManager.GetText(LocalizationKeys.PostFirstComment) : AppSettings.LocalizationManager.GetText(LocalizationKeys.ViewComments, _currentPost.Children); _comments.Frame = new CGRect(leftMargin - 5, _attributedLabel.Frame.Bottom + 5, _comments.SizeThatFits(new CGSize(10, 20)).Width + 10, 20 + 10); _bottomSeparator.Frame = new CGRect(0, _comments.Frame.Bottom + 10, UIScreen.MainScreen.Bounds.Width, 1); //for constant size checking //var constantsSize = _bottomSeparator.Frame.Bottom - _attributedLabel.Frame.Height - _bodyImage.Frame.Height; }