public DetailTweetViewController(Tweet partialTweet) : base(UITableViewStyle.Grouped, null, true) { bool isMine = false; if (partialTweet.IsSearchResult) { Tweet.LoadFullTweet(partialTweet.Id, fullTweet => SetTweet(fullTweet)); } else { isMine = partialTweet.UserId == TwitterAccount.CurrentAccount.AccountId; // Hack until we figure out why DELETE is not working with OAuth // and making the server return 401 Unauthorized isMine = false; } var handlers = new EventHandler [] { Reply, Retweet, Direct, Delete }; var profileRect = new RectangleF(PadX, 0, View.Bounds.Width - PadX, 100); var detailRect = new RectangleF(PadX, 0, View.Bounds.Width - 30 - PadX * 2, 0); shortProfileView = new ShortProfileView(profileRect, partialTweet, true); profileRect.Height += 8; var triangle = new TriangleView(UIColor.White, UIColor.FromRGB(171, 171, 171)) { Frame = new RectangleF(43, shortProfileView.Bounds.Height + 1, 16, 8) }; var containerView = new UIView(profileRect); containerView.Add(shortProfileView); containerView.Add(triangle); main = new Section(containerView) { new UIViewElement(null, new DetailTweetView(detailRect, partialTweet, TapHandler, TapAndHoldHandler, this), false) { Flags = UIViewElement.CellFlags.DisableSelection } }; Section replySection = new Section(); if (partialTweet.Kind == TweetKind.Direct) { replySection.Add(new StringElement(Locale.GetText("Direct Reply"), delegate { Direct(this, EventArgs.Empty); })); } else { replySection.Add(new UIViewElement(null, new ButtonsView(isMine ? 4 : 3, buttons, handlers), true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent }); } userTimeline = TimelineRootElement.MakeTimeline(partialTweet.Screename, Locale.GetText("User's timeline"), "http://api.twitter.com/1/statuses/user_timeline.json?skip_user=true&screen_name=" + partialTweet.Screename, User.FromTweet(partialTweet)); tweet = partialTweet; if (!partialTweet.IsSearchResult) { SetTweet(partialTweet); } Root = new RootElement(partialTweet.Screename) { main, replySection, new Section() { userTimeline } }; }
public DetailTweetViewController(Tweet partialTweet) : base(UITableViewStyle.Grouped, null, true) { bool isMine = false; if (partialTweet.IsSearchResult) Tweet.LoadFullTweet (partialTweet.Id, fullTweet => SetTweet (fullTweet)); else { isMine = partialTweet.UserId == TwitterAccount.CurrentAccount.AccountId; // Hack until we figure out why DELETE is not working with OAuth // and making the server return 401 Unauthorized isMine = false; } var handlers = new EventHandler [] { Reply, Retweet, Direct, Delete }; var profileRect = new RectangleF (PadX, 0, View.Bounds.Width-PadX, 100); var detailRect = new RectangleF (PadX, 0, View.Bounds.Width-30-PadX*2, 0); shortProfileView = new ShortProfileView (profileRect, partialTweet, true); profileRect.Height += 8; var triangle = new TriangleView (UIColor.White, UIColor.FromRGB (171, 171, 171)) { Frame = new RectangleF (43, shortProfileView.Bounds.Height+1, 16, 8) }; var containerView = new UIView (profileRect); containerView.Add (shortProfileView); containerView.Add (triangle); main = new Section (containerView){ new UIViewElement (null, new DetailTweetView (detailRect, partialTweet, TapHandler, TapAndHoldHandler, this), false) { Flags = UIViewElement.CellFlags.DisableSelection } }; Section replySection = new Section (); if (partialTweet.Kind == TweetKind.Direct) replySection.Add (new StringElement (Locale.GetText ("Direct Reply"), delegate { Direct (this, EventArgs.Empty); })); else replySection.Add (new UIViewElement (null, new ButtonsView (isMine ? 4 : 3, buttons, handlers), true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent }); userTimeline = TimelineRootElement.MakeTimeline (partialTweet.Screename, Locale.GetText ("User's timeline"), "http://api.twitter.com/1/statuses/user_timeline.json?skip_user=true&screen_name=" + partialTweet.Screename, User.FromTweet (partialTweet)); tweet = partialTweet; if (!partialTweet.IsSearchResult) SetTweet (partialTweet); Root = new RootElement (partialTweet.Screename){ main, replySection, new Section () { userTimeline } }; }