예제 #1
0
 public void UpdateCell(Tweet tweet)
 {
     UserName.Text = tweet.FromUserName;
     TweetText.Text = tweet.Text;
     UserAvatar.Image = tweet.UserAvatar ?? Tweet.Placeholder;
     Time.Text = tweet.TimeDiff;
 }
예제 #2
0
        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);
                }
            });
        }
예제 #3
0
 protected virtual void RaiseDownloadAvatarEvent(Tweet updatedTweet)
 {
     if (OnDownloadAvatar != null)
     {
         OnDownloadAvatar(updatedTweet);
     }
 }
예제 #4
0
 public void DownloadAvatar(Tweet tweet)
 {
     _tweetData.DownloadImage(tweet);
 }
예제 #5
0
        private void ShowDetailedTweet(Tweet tweetToDetail)
        {
            if (_tweetDetail == null)
            {
                _tweetDetail = new TweetDetailViewController(tweetToDetail);
            }
            else
            {
                _tweetDetail.SetDetailedTweet(tweetToDetail);
            }

            _showingDetailedTweet = true;
            NavigationController.PushViewController(_tweetDetail, true);
        }
예제 #6
0
 private void HandleOnDownloadAvatar(Tweet updatedTweet)
 {
     InvokeOnMainThread(() => {
         if (_showingDetailedTweet)
         {
             _tweetDetail.UpdateAvatar();
         }
         else
         {
             _tableSource.UpdateTweet(updatedTweet);
         }
     });
 }
예제 #7
0
 protected void RaiseTweetRowSelected(Tweet tweet)
 {
     if (OnTweetRowSelected != null && tweet != null)
     {
         OnTweetRowSelected(tweet);
     }
 }
예제 #8
0
 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());
     }
 }
예제 #9
0
 public override void ViewWillDisappear(bool animated)
 {
     _detailedTweet = null;
     base.ViewWillDisappear(animated);
 }
예제 #10
0
 public void SetDetailedTweet(Tweet newDetailedTweet)
 {
     _detailedTweet =  newDetailedTweet;
 }
예제 #11
0
 public TweetDetailViewController(Tweet tweetToDetail)
     : base("TweetScreen", null)
 {
     _detailedTweet = tweetToDetail;
     HidesBottomBarWhenPushed = true;
 }