public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(PublicationSortingCell.Key) as PublicationSortingCell; if (cell == null) { cell = new PublicationSortingCell(); } // TODO: populate the cell with the appropriate data based on the indexPath int publicationIndex = (int)indexPath.LongRow; Publication curPublication = cachedPublications[publicationIndex]; cell.TextLabel.Text = curPublication.Name; cell.TextLabel.Font = UIFont.SystemFontOfSize(14); cell.PublicationId = curPublication.BookId; cell.TextLabel.Lines = 0; CGSize expectedLableSize = TextDisplayUtil.GetStringBoundRect(curPublication.Name, UIFont.SystemFontOfSize(14), new CGSize(200, 600)); if (expectedLableSize.Height > 21) { cell.TextLabel.Frame = new CGRect(cell.TextLabel.Frame.X, cell.TextLabel.Frame.Y, 200, expectedLableSize.Height); } return(cell); }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { var annotation = AnnoListDict [SectionTitleArr [indexPath.Section]] [indexPath.Row]; CGSize TocHeight = TextDisplayUtil.GetStringBoundRect(annotation.TOCTitle, UIFont.SystemFontOfSize(14), new CGSize(tableView.Frame.Size.Width - 30, 80)); string text = annotation.HighlightText; CGSize ContentHeight = TextDisplayUtil.GetStringBoundRect(text, UIFont.SystemFontOfSize(14), new CGSize(tableView.Frame.Size.Width - 30, 80)); CGSize NoteHeight = TextDisplayUtil.GetStringBoundRect(annotation.NoteText, UIFont.SystemFontOfSize(14), new CGSize(tableView.Frame.Size.Width - 30, 80)); getGuidList = annotation.CategoryTags; if (getGuidList.Count > 4) { heightBgView = 60; } else if (getGuidList.Count == 0) { heightBgView = 30; } else if (getGuidList.Count < 4) { heightBgView = 40; } return(TocHeight.Height + ContentHeight.Height + NoteHeight.Height + 70 + heightBgView); }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { TOCNode node = this.DisplayedTocList[indexPath.Row]; CGSize expectedLableSize = TextDisplayUtil.GetStringBoundRect(node.Title, UIFont.SystemFontOfSize(14), new CGSize(260, 600)); return(((expectedLableSize.Height + 24) > 44) ? (expectedLableSize.Height + 24) : 44); }
/// <summary> /// Shows the publication description info. /// </summary> private void ShowPublicationDescriptionInfo() { DescriptionContentLabel.Text = curPublication.Description; CGSize labelSize = TextDisplayUtil.GetStringBoundRect(curPublication.Description, UIFont.SystemFontOfSize(12), new CGSize(600, 6000)); if (labelSize.Height > 56) // 4 *14 { DescriptionContentLabel.UserInteractionEnabled = true; UITapGestureRecognizer tapContentRecoginzer = new UITapGestureRecognizer(); tapContentRecoginzer.AddTarget(this.ShowAllDescription); DescriptionContentLabel.AddGestureRecognizer(tapContentRecoginzer); MoreDescriptionLabel.UserInteractionEnabled = true; UITapGestureRecognizer tapMoreRecoginzer = new UITapGestureRecognizer(); tapMoreRecoginzer.AddTarget(this.ShowAllDescription); MoreDescriptionLabel.AddGestureRecognizer(tapMoreRecoginzer); ChangeViewHeightConstraint(MoreDescriptionLabel, 20); ChangeViewHeightConstraint(DescriptionInfoContainerView, 145); } else { ChangeViewHeightConstraint(MoreDescriptionLabel, 0); ChangeViewHeightConstraint(DescriptionInfoContainerView, labelSize.Height + 67); } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { CustomizedPopoverHisoryTableViewCell cell = tableView.DequeueReusableCell(CustomizedPopoverHisoryTableViewCell.Key) as CustomizedPopoverHisoryTableViewCell; if (cell == null) { cell = CustomizedPopoverHisoryTableViewCell.Create(); } RecentHistoryItem item = HistoryList [indexPath.Row]; cell.TitleLabel.Text = item.PublicationTitle; cell.GuideCardNameLabel.Text = item.TOCTitle; cell.TimeLabel.Text = ((DateTime)item.LastReadDate).ToString("hh:mm t\\M, dd MMM yyyy"); if (cell.TitleLabel.Constraints.Length > 0) { CGSize expectedTitleLabelSize = TextDisplayUtil.GetStringBoundRect(item.PublicationTitle, UIFont.BoldSystemFontOfSize(14), new CGSize(295, 600)); for (int i = 0; i < cell.TitleLabel.Constraints.Length; i++) { if (cell.TitleLabel.Constraints [i].FirstAttribute == NSLayoutAttribute.Height && expectedTitleLabelSize.Height > 20) { cell.TitleLabel.Constraints [i].Constant = expectedTitleLabelSize.Height; } } } cell.CellColorHintView.BackgroundColor = ColorUtil.ConvertFromHexColorCode(item.ColorPrimary); return(cell); }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { int publicationIndex = (int)indexPath.LongRow; Publication curPublication = cachedPublications[publicationIndex]; CGSize expectedLableSize = TextDisplayUtil.GetStringBoundRect(curPublication.Name, UIFont.SystemFontOfSize(14), new CGSize(200, 600)); return(((expectedLableSize.Height + 24) > 44) ? (expectedLableSize.Height + 24) : 44); }
void ShowAllDescription() { ChangeViewHeightConstraint(MoreDescriptionLabel, 0); CGSize labelSize = TextDisplayUtil.GetStringBoundRect(curPublication.Description, UIFont.SystemFontOfSize(12), new CGSize(600, 6000)); ChangeViewHeightConstraint(DescriptionInfoContainerView, labelSize.Height + 67); }
private void ShowPublicationWhatsNewInfo() { //What's new WhatsNewDateLabel.Text = ((DateTime)curPublication.LastUpdatedDate).ToString("dd MMM yyyy"); if (curPublication.AddedGuideCard != null && curPublication.AddedGuideCard.Count > 0) { string addedGuideCardStr = ""; AddedGuideCardLabel.Lines = curPublication.AddedGuideCard.Count; foreach (GuideCard curGuideCard in curPublication.AddedGuideCard) { addedGuideCardStr += curGuideCard.Name; addedGuideCardStr += Environment.NewLine; } addedGuideCardStr = addedGuideCardStr.TrimEnd(Environment.NewLine.ToCharArray()); CGSize addedGuideCardLabelSize = TextDisplayUtil.GetStringBoundRect(addedGuideCardStr, UIFont.SystemFontOfSize(12), new CGSize(600, 6000)); ChangeViewHeightConstraint(AddedGuideCardLabel, new nfloat(addedGuideCardLabelSize.Height)); AddedGuideCardLabel.Text = addedGuideCardStr; } //InfoScrollView.AddSubview (AddedGuideCardLabel); if (curPublication.DeletedGuideCard != null && curPublication.DeletedGuideCard.Count > 0) { string deletedGuideCardStr = ""; DeletedGuideCardLabel.Lines = curPublication.DeletedGuideCard.Count; foreach (GuideCard curGuideCard in curPublication.DeletedGuideCard) { deletedGuideCardStr += curGuideCard.Name; deletedGuideCardStr += Environment.NewLine; } deletedGuideCardStr = deletedGuideCardStr.TrimEnd(Environment.NewLine.ToCharArray()); CGSize deletedGuideCardLabelSize = TextDisplayUtil.GetStringBoundRect(deletedGuideCardStr, UIFont.SystemFontOfSize(12), new CGSize(600, 6000)); ChangeViewHeightConstraint(DeletedGuideCardLabel, new nfloat(deletedGuideCardLabelSize.Height)); DeletedGuideCardLabel.Text = deletedGuideCardStr; } if (curPublication.UpdatedGuideCard != null && curPublication.UpdatedGuideCard.Count > 0) { string updatedGuideCardStr = ""; UpdateGuideCardLabel.Lines = curPublication.UpdatedGuideCard.Count; foreach (GuideCard curGuideCard in curPublication.UpdatedGuideCard) { updatedGuideCardStr += curGuideCard.Name; updatedGuideCardStr += Environment.NewLine; } updatedGuideCardStr = updatedGuideCardStr.TrimEnd(Environment.NewLine.ToCharArray()); CGSize updateGuideCardLabelSize = TextDisplayUtil.GetStringBoundRect(updatedGuideCardStr, UIFont.SystemFontOfSize(12), new CGSize(600, 6000)); ChangeViewHeightConstraint(UpdateGuideCardLabel, new nfloat(updateGuideCardLabelSize.Height)); UpdateGuideCardLabel.Text = updatedGuideCardStr; } }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { RecentHistoryItem item = HistoryList [indexPath.Row]; CGSize expectedTitleLabelSize = TextDisplayUtil.GetStringBoundRect(item.PublicationTitle, UIFont.BoldSystemFontOfSize(14), new CGSize(295, 600)); CGSize expectedTOCTitleLabelSize = TextDisplayUtil.GetStringBoundRect(item.TOCTitle, UIFont.SystemFontOfSize(14), new CGSize(295, 600)); float expectedTOCTitleHeight = (float)expectedTOCTitleLabelSize.Height; if (expectedTOCTitleHeight < 20) { expectedTOCTitleHeight = 20; } else if (expectedTOCTitleHeight > 50) { expectedTOCTitleHeight = 50; } return((expectedTitleLabelSize.Height > 20 ? expectedTitleLabelSize.Height : 20) + expectedTOCTitleHeight + 32); }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { var annotation = AnnotationList[indexPath.Row]; string guidCardTitle = annotation.GuideCardName + ">" + annotation.TOCTitle; CGSize guidCardHeight = TextDisplayUtil.GetStringBoundRect(guidCardTitle, UIFont.SystemFontOfSize(14), new CGSize(tableView.Frame.Size.Width - 30, 80)); CGSize TocHeight = TextDisplayUtil.GetStringBoundRect(annotation.TOCTitle, UIFont.SystemFontOfSize(14), new CGSize(tableView.Frame.Size.Width - 30, 80)); CGSize ContentHeight = TextDisplayUtil.GetStringBoundRect(annotation.HighlightText, UIFont.SystemFontOfSize(14), new CGSize(tableView.Frame.Size.Width - 30, 80)); CGSize NoteHeight = TextDisplayUtil.GetStringBoundRect(annotation.NoteText, UIFont.SystemFontOfSize(14), new CGSize(tableView.Frame.Size.Width - 30, 80)); getGuidList = annotation.CategoryTags; if (getGuidList.Count > 8) { heightBgView = 40; } else if (getGuidList.Count < 4) { heightBgView = 15; } return(guidCardHeight.Height + TocHeight.Height + ContentHeight.Height + NoteHeight.Height + 70 + heightBgView); }
private void ShowPublicationCoverAndActionButton() { var pvInList = AppDisplayUtil.Instance.AppDelegateInstance.PublicationViewList.Find(item => item.P.BookId == curPublication.BookId); PublicationView pv = PublicationViewFactory.CreatePublicationView(curPublication, pvInList.StartDownload, pvInList.ShowDownloadAlert, 0.85f); pv.ZoomInOrOut(0.85f); PublicationCoverContainer.AddSubview(pv); PublicationNameLabel.Text = curPublication.Name; CGSize publicationNameLabelSize = TextDisplayUtil.GetStringBoundRect(curPublication.Name, UIFont.SystemFontOfSize(ViewConstant.INFO_NAME_LABEL_FONT_SIZE), new CGSize(ViewConstant.INFO_AUTHOR_LABEL_WIDTH, 600)); nfloat expectedNameLabelHeight = publicationNameLabelSize.Height > 26 ? publicationNameLabelSize.Height : 26; ChangeViewHeightConstraint(PublicationNameLabel, expectedNameLabelHeight); PublicationAuthorLabel.Text = curPublication.Author; CGSize publicationAuthorLabelSize = TextDisplayUtil.GetStringBoundRect(curPublication.Author, UIFont.SystemFontOfSize(ViewConstant.INFO_AUTHOR_LABEL_FONT_SIZE), new CGSize(ViewConstant.INFO_AUTHOR_LABEL_WIDTH, 600)); nfloat expectedAuthorLabelHeight = publicationAuthorLabelSize.Height < ViewConstant.INFO_AUTHOR_LABEL_MIN_HEIGHT ? ViewConstant.INFO_AUTHOR_LABEL_MIN_HEIGHT : publicationAuthorLabelSize.Height; ChangeViewHeightConstraint(PublicationAuthorLabel, expectedAuthorLabelHeight); ActionButton.Layer.BorderWidth = 1.0f; ActionButton.Layer.CornerRadius = 5; if (curPublication.DaysRemaining < 0) { ActionButton.Layer.BorderColor = UIColor.Red.CGColor; ActionButton.SetTitleColor(UIColor.Red, UIControlState.Normal); } else { ActionButton.Layer.BorderColor = UIColor.FromRGB(22, 132, 250).CGColor; ActionButton.SetTitleColor(UIColor.FromRGB(22, 132, 250), UIControlState.Normal); } if (curPublication.IsLoan) { LoanTagLabel.Layer.CornerRadius = 8; LoanTagLabel.Layer.MasksToBounds = true; ChangeViewWidthConstraint(LoanTagLabel, ViewConstant.INFO_LOAN_TAG_LABEL_WIDTH); ChangeViewWidthConstraint(TagSpaceLabel, 10); } else { ChangeViewWidthConstraint(LoanTagLabel, 0); ChangeViewWidthConstraint(TagSpaceLabel, 0); } if (curPublication.IsFTC) { PlusCaseTagLabel.Layer.CornerRadius = 8; PlusCaseTagLabel.Layer.MasksToBounds = true; PlusCaseTagLabel.Hidden = false; } else { PlusCaseTagLabel.Hidden = true; } nfloat expectedTitleAuthorScrollViewContentHeight = expectedAuthorLabelHeight + expectedNameLabelHeight + 34; if (expectedTitleAuthorScrollViewContentHeight > ViewConstant.INFO_NAME_AUTHOR_SCROLL_VIEW_MAX_HEIGHT) { ChangeViewHeightConstraint(TitleAuthorScrollView, ViewConstant.INFO_NAME_AUTHOR_SCROLL_VIEW_MAX_HEIGHT); TitleAuthorScrollView.ScrollEnabled = true; } else { ChangeViewHeightConstraint(TitleAuthorScrollView, expectedTitleAuthorScrollViewContentHeight); TitleAuthorScrollView.ScrollEnabled = false; } TitleAuthorScrollView.ContentSize = new CGSize(ViewConstant.INFO_AUTHOR_LABEL_WIDTH, expectedTitleAuthorScrollViewContentHeight); TitleAuthorScrollView.SetContentOffset(new CGPoint(0, 0), false); }