Ejemplo n.º 1
0
        private void CreateTweetView(string tweet)
        {
            var boxWidth  = View.Bounds.Width - 30 - PadX * 2;
            var tweetRect = new RectangleF(PadX, 0, boxWidth, 100);

            var tweetView = new TweetView(tweetRect, tweet, (t) =>
            {
                string url = t.Value;
                switch (t.Type)
                {
                case TweetView.TweetType.Url:
                    break;

                case TweetView.TweetType.Mention:
                    url = "http://twitter.com/" + t.Value;
                    break;

                case TweetView.TweetType.Hashtag:
                    url = "http://twitter.com/search/" + Uri.EscapeDataString(t.Value);
                    break;
                }
                WebViewController.OpenUrl(this, url, true /* enableTitle */);
            }, null);

            _tweetBox = new UIViewElement("Twitter", tweetView, false);
        }
Ejemplo n.º 2
0
        public RootElement GetRoot()
        {
            CreateTweetView("...");

            var width = View.Bounds.Width - 30 - PadX * 2;
            var frame = new RectangleF(PadX, 0, width, 100);

            var headerView = new UIView(frame);

            _view = new BioView(_bio, frame, true);
            headerView.Add(_view);

            // Speech bubble triangle
            var triangleFrame = new RectangleF(Util.IsPad() ? 63 : 43, _view.Bounds.Height - 7, 16, 8);
            var triangle      = new TriangleView(UIColor.FromRGB(247, 247, 247), UIColor.FromRGB(171, 171, 171))
            {
                Frame = triangleFrame
            };

            headerView.Add(triangle);

            _view.UrlTapped += delegate
            {
                WebViewController.OpenUrl(this, _bio.Url);
            };

            _main = new Section(headerView)
            {
                _tweetBox
            };

            var text = new StyledMultilineElement(AppManifest.Current.Biography);

            text.TextColor      = UIColor.DarkGray;
            text.LineBreakMode  = UILineBreakMode.WordWrap;
            text.Font           = UIFont.ItalicSystemFontOfSize(15);
            text.DetailColor    = text.TextColor;
            text.SelectionStyle = UITableViewCellSelectionStyle.None;

            var secondary = new Section("About " + AppManifest.Current.FirstName)
            {
                text
            };

            var root = new RootElement("Bio")
            {
                _main,
                secondary
            };

            // Required for resizing bubble for new tweets
            root.UnevenRows = true;

            return(root);
        }