public void UpdateCell(Tweet tweet) { UserName.Text = tweet.FromUserName; TweetText.Text = tweet.Text; UserAvatar.Image = tweet.UserAvatar ?? Tweet.Placeholder; Time.Text = tweet.TimeDiff; }
public void DownloadImage(Tweet tweetWithNoAvatar) { Task.Factory.StartNew(() => { UIImage image = null; NSUrl nsUrl = new NSUrl(tweetWithNoAvatar.ProfileImageUrl); NSData data = NSData.FromUrl(nsUrl); if (data != null) { image = new UIImage(data); } if (image != null) { tweetWithNoAvatar.UserAvatar = image; RaiseDownloadAvatarEvent(tweetWithNoAvatar); } }); }
protected virtual void RaiseDownloadAvatarEvent(Tweet updatedTweet) { if (OnDownloadAvatar != null) { OnDownloadAvatar(updatedTweet); } }
public void DownloadAvatar(Tweet tweet) { _tweetData.DownloadImage(tweet); }
private void ShowDetailedTweet(Tweet tweetToDetail) { if (_tweetDetail == null) { _tweetDetail = new TweetDetailViewController(tweetToDetail); } else { _tweetDetail.SetDetailedTweet(tweetToDetail); } _showingDetailedTweet = true; NavigationController.PushViewController(_tweetDetail, true); }
private void HandleOnDownloadAvatar(Tweet updatedTweet) { InvokeOnMainThread(() => { if (_showingDetailedTweet) { _tweetDetail.UpdateAvatar(); } else { _tableSource.UpdateTweet(updatedTweet); } }); }
protected void RaiseTweetRowSelected(Tweet tweet) { if (OnTweetRowSelected != null && tweet != null) { OnTweetRowSelected(tweet); } }
public void UpdateTweet(Tweet tweetWithAvatar) { int index = _data.IndexOf(tweetWithAvatar); if (index < 0) { return; } TweetTableCell cell = _table.VisibleCells.FirstOrDefault(c => c.Tag == index) as TweetTableCell; if (cell != null) { cell.SetAvatar(tweetWithAvatar.GetMaskedAvatar()); } }
public override void ViewWillDisappear(bool animated) { _detailedTweet = null; base.ViewWillDisappear(animated); }
public void SetDetailedTweet(Tweet newDetailedTweet) { _detailedTweet = newDetailedTweet; }
public TweetDetailViewController(Tweet tweetToDetail) : base("TweetScreen", null) { _detailedTweet = tweetToDetail; HidesBottomBarWhenPushed = true; }