Exemplo n.º 1
0
        void InitializeWhatNewView()
        {
            if (BookInfo == null)
            {
                return;
            }
            WhatNewLabel.StringValue    = "What's New";
            CurrentDayLabel.StringValue = BookInfo.LastUpdatedDate.Value.ToString("dd MMM yyyy");
            nfloat height = HeightOfWhatNewInfoView();

            if (height > TEXTVIEW_SIXLINE_HEIGHT)
            {
                NSButton moreButton = CreateMoreButton();
                DescriptionView.WantsLayer = true;
                moreButton.Action          = new Selector("WhatNewViewShowAll:");
                moreButton.Target          = this;
                DescriptionView.AddSubview(moreButton);

                isDescripExpand = false;
            }
            else
            {
                nfloat orgHeight = DespTextField.Frame.Size.Height;
                nfloat offset    = height - orgHeight;
                var    oldSize   = DescriptionView.Frame.Size;
                var    newSize   = new CGSize(oldSize.Width, descriptionViewHeight + offset);
                DescriptionView.SetFrameSize(newSize);
                //LayoutSubViews ();
            }
        }
Exemplo n.º 2
0
        void InitializeDescriptionView()
        {
            if (BookInfo == null)
            {
                return;
            }

            float fontSize = 13.0f;

            string description = "3. Verify return to filter option page for Subscription " +
                                 "Given successful login with navigation to My Publications page, " +
                                 "When filtering books by 'Subscription' option \n" +
                                 "and selecting a Subscription title using TOC icon, " +
                                 "Then returning back to My Publications screen will maintain the list of filtered titles.338\n" +
                                 "When clicking the download icon on the subscribed download book, " +
                                 "showing the download progress and a cancel icon at end of progress bar\n" +
                                 "3. Cancel download progress this is";

            DespTextField.StringValue = description;
            if (BookInfo.Description != null)
            {
                DespTextField.StringValue = BookInfo.Description;
            }

            descriptionViewHeight = DescriptionView.Frame.Size.Height;

            var height = HeightWrappedToWidth(DespTextField, fontSize);

            if (height > TEXTVIEW_SIXLINE_HEIGHT)
            {
                NSButton moreButton = CreateMoreButton();
                DescriptionView.WantsLayer = true;
                moreButton.Action          = new Selector("DescriptionShowAll:");
                moreButton.Target          = this;
                DescriptionView.AddSubview(moreButton);

                isDescripExpand = false;
            }
            else
            {
                nfloat orgHeight = DespTextField.Frame.Size.Height;
                nfloat offset    = height - orgHeight;
                var    oldSize   = DescriptionView.Frame.Size;
                var    newSize   = new CGSize(oldSize.Width, descriptionViewHeight + offset);
                DescriptionView.SetFrameSize(newSize);
                //LayoutSubViews ();
            }
        }
        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);
        }