예제 #1
0
        public void UpdateData(Post post, Context context, int cellSize)
        {
            _post    = post;
            _context = context;

            _mediaModel = post.Media[0];

            if (_mediaModel != null)
            {
                Picasso.With(_context).Load(_mediaModel.GetImageProxy(cellSize))
                .Placeholder(Resource.Color.rgb244_244_246)
                .NoFade()
                .Priority(Picasso.Priority.High)
                .Into(_photo, null, OnError);
            }

            _gallery.Visibility = post.Media.Length > 1 ? ViewStates.Visible : ViewStates.Gone;

            if (_post.ShowMask && (_post.IsNsfw || _post.IsLowRated) && _post.Author != AppSettings.User.Login)
            {
                _nsfwMaskMessage.Text = AppSettings.LocalizationManager.GetText(_post.IsLowRated ? LocalizationKeys.LowRated : LocalizationKeys.Nsfw);
                _nsfwMask.Visibility  = ViewStates.Visible;
            }
            else
            {
                _nsfwMask.Visibility = ViewStates.Gone;
            }
        }
예제 #2
0
 public void Init(MediaModel media)
 {
     _media = media;
     Picasso.With(_context)
     .Load(_media.GetImageProxy(Style.ScreenWidth))
     .Placeholder(new ColorDrawable(Style.R245G245B245))
     .NoFade()
     .Priority(Picasso.Priority.High)
     .Into(this);
 }
        private void LoadMedia(MediaModel mediaModel, ImageView mediaView)
        {
            if (mediaModel != null)
            {
                var parent = (View)mediaView.Parent;
                mediaView.LayoutParameters.Height = parent.LayoutParameters.Height;
                mediaView.LayoutParameters.Width  = parent.LayoutParameters.Width;

                Picasso.With(_context).Load(mediaModel.GetImageProxy(Style.ScreenWidth))
                .Placeholder(new ColorDrawable(Style.R245G245B245))
                .NoFade()
                .Priority(Picasso.Priority.High)
                .Into(mediaView, null, () =>
                {
                    Picasso.With(_context).Load(mediaModel.Url).Placeholder(new ColorDrawable(Style.R245G245B245)).NoFade().Priority(Picasso.Priority.High).Into(mediaView);
                });
            }
        }