public void UpdateData(PostPagerType type, Post post) { _type = type; _post = post; //_photos = Array.FindAll(_post.Photos, ph => ph.Contains("steepshot")).ToArray(); _photo = _post.Media[0]; NotifyDataSetChanged(); var cardView = _photoHolders[0]; if (cardView != null) { LoadPhoto(_post.Media[0], cardView); } }
public void UpdateData(PostPagerType type, Post post) { _type = type; _post = post; NotifyDataSetChanged(); }
public FeedViewHolder(View itemView, Action <ActionType, Post> postAction, Action <string> tagAction, int height) : base(itemView) { Context = itemView.Context; PhotoPagerType = PostPagerType.Feed; _avatar = itemView.FindViewById <CircleImageView>(Resource.Id.profile_image); _author = itemView.FindViewById <TextView>(Resource.Id.author_name); _gallery = itemView.FindViewById <ImageView>(Resource.Id.gallery); _photosViewPager = itemView.FindViewById <ViewPager>(Resource.Id.post_photos_pager); _pagerTabLayout = ItemView.FindViewById <TabLayout>(Resource.Id.dot_selector); _pagerTabLayout.SetupWithViewPager(_photosViewPager, true); var parameters = _photosViewPager.LayoutParameters; parameters.Height = height; _photosViewPager.LayoutParameters = parameters; _photosViewPager.Adapter = new PostPhotosPagerAdapter(Context, _photosViewPager.LayoutParameters, (post) => postAction.Invoke(PhotoPagerType == PostPagerType.Feed ? ActionType.Photo : ActionType.Preview, post)); _title = itemView.FindViewById <PostCustomTextView>(Resource.Id.first_comment); _commentSubtitle = itemView.FindViewById <TextView>(Resource.Id.comment_subtitle); _time = itemView.FindViewById <TextView>(Resource.Id.time); _likes = itemView.FindViewById <TextView>(Resource.Id.likes); _flags = itemView.FindViewById <TextView>(Resource.Id.flags); _flagsIcon = itemView.FindViewById <ImageView>(Resource.Id.flagIcon); _cost = itemView.FindViewById <TextView>(Resource.Id.cost); _likeOrFlag = itemView.FindViewById <ImageButton>(Resource.Id.btn_like); More = itemView.FindViewById <ImageButton>(Resource.Id.more); _topLikers = itemView.FindViewById <LinearLayout>(Resource.Id.top_likers); NsfwMask = itemView.FindViewById <RelativeLayout>(Resource.Id.nsfw_mask); _nsfwMaskMessage = NsfwMask.FindViewById <TextView>(Resource.Id.mask_message); NsfwMaskSubMessage = NsfwMask.FindViewById <TextView>(Resource.Id.mask_submessage); _nsfwMaskCloseButton = NsfwMask.FindViewById <ImageButton>(Resource.Id.mask_close); _nsfwMaskActionButton = NsfwMask.FindViewById <Button>(Resource.Id.nsfw_mask_button); _author.Typeface = Style.Semibold; _time.Typeface = Style.Regular; _likes.Typeface = Style.Semibold; _flags.Typeface = Style.Semibold; _cost.Typeface = Style.Semibold; _title.Typeface = Style.Regular; _commentSubtitle.Typeface = Style.Regular; _nsfwMaskMessage.Typeface = Style.Light; NsfwMaskSubMessage.Typeface = Style.Light; _moreActionsDialog = new BottomSheetDialog(Context); _moreActionsDialog.Window.RequestFeature(WindowFeatures.NoTitle); _title.MovementMethod = new LinkMovementMethod(); _title.SetHighlightColor(Color.Transparent); _postAction = postAction; _tagAction = tagAction; _likeOrFlag.Click += DoLikeAction; _avatar.Click += DoUserAction; _author.Click += DoUserAction; _cost.Click += DoUserAction; _commentSubtitle.Click += DoCommentAction; _likes.Click += DoLikersAction; _topLikers.Click += DoLikersAction; _flags.Click += DoFlagersAction; _flagsIcon.Click += DoFlagersAction; _nsfwMaskCloseButton.Click += NsfwMaskCloseButtonOnClick; _nsfwMaskActionButton.Click += NsfwMaskActionButtonOnClick; More.Click += DoMoreAction; More.Visibility = BasePresenter.User.IsAuthenticated ? ViewStates.Visible : ViewStates.Invisible; _title.Click += OnTitleOnClick; _title.TagAction += _tagAction; if (_title.OnMeasureInvoked == null) { _title.OnMeasureInvoked += OnTitleOnMeasureInvoked; } }
public FeedViewHolder(View itemView, Action <ActionType, Post> postAction, Action <AutoLinkType, string> autoLinkAction, int height, int width) : base(itemView) { Context = itemView.Context; PhotoPagerType = PostPagerType.Feed; _avatar = itemView.FindViewById <CircleImageView>(Resource.Id.profile_image); _author = itemView.FindViewById <TextView>(Resource.Id.author_name); itemView.FindViewById <ImageView>(Resource.Id.gallery); PhotosViewPager = itemView.FindViewById <ViewPager>(Resource.Id.post_photos_pager); _pagerTabLayout = ItemView.FindViewById <TabLayout>(Resource.Id.dot_selector); _pagerTabLayout.SetupWithViewPager(PhotosViewPager, true); _title = itemView.FindViewById <PostCustomTextView>(Resource.Id.first_comment); _commentSubtitle = itemView.FindViewById <TextView>(Resource.Id.comment_subtitle); _time = itemView.FindViewById <TextView>(Resource.Id.time); _likes = itemView.FindViewById <TextView>(Resource.Id.likes); _flags = itemView.FindViewById <TextView>(Resource.Id.flags); _flagsIcon = itemView.FindViewById <ImageView>(Resource.Id.flagIcon); _cost = itemView.FindViewById <TextView>(Resource.Id.cost); _likeOrFlag = itemView.FindViewById <ImageButton>(Resource.Id.btn_like); _more = itemView.FindViewById <ImageButton>(Resource.Id.more); _topLikers = itemView.FindViewById <LinearLayout>(Resource.Id.top_likers); NsfwMask = itemView.FindViewById <RelativeLayout>(Resource.Id.nsfw_mask); _nsfwMaskMessage = NsfwMask.FindViewById <TextView>(Resource.Id.mask_message); NsfwMaskSubMessage = NsfwMask.FindViewById <TextView>(Resource.Id.mask_submessage); _nsfwMaskCloseButton = NsfwMask.FindViewById <ImageButton>(Resource.Id.mask_close); _nsfwMaskActionButton = NsfwMask.FindViewById <Button>(Resource.Id.nsfw_mask_button); _likeScaleContainer = itemView.FindViewById <RelativeLayout>(Resource.Id.like_scale_container); _likeScaleBar = itemView.FindViewById <LikeScaleBar>(Resource.Id.like_scale); _likeScalePower = itemView.FindViewById <TextView>(Resource.Id.like_scale_power); _likeScale = itemView.FindViewById <ImageButton>(Resource.Id.btn_like_scale); _author.Typeface = Style.Semibold; _time.Typeface = Style.Regular; _likes.Typeface = Style.Semibold; _flags.Typeface = Style.Semibold; _cost.Typeface = Style.Semibold; _likeScalePower.Typeface = Style.Semibold; _title.Typeface = Style.Regular; _commentSubtitle.Typeface = Style.Regular; _nsfwMaskMessage.Typeface = Style.Light; NsfwMaskSubMessage.Typeface = Style.Light; var parameters = PhotosViewPager.LayoutParameters; parameters.Height = height; parameters.Width = width; PhotosViewPager.LayoutParameters = parameters; PhotosViewPager.Adapter = new PostPhotosPagerAdapter(Context, PhotoAction); _moreActionsDialog = new BottomSheetDialog(Context); _moreActionsDialog.Window.RequestFeature(WindowFeatures.NoTitle); _title.MovementMethod = new LinkMovementMethod(); _title.SetHighlightColor(Color.Transparent); _postAction = postAction; _likeOrFlag.Click += DoLikeAction; _likeOrFlag.LongClick += DoLikeScaleAction; _avatar.Click += DoUserAction; _author.Click += DoUserAction; _commentSubtitle.Click += DoCommentAction; _likes.Click += DoLikersAction; _topLikers.Click += DoLikersAction; _flags.Click += DoFlagersAction; _flagsIcon.Click += DoFlagersAction; _nsfwMaskCloseButton.Click += NsfwMaskCloseButtonOnClick; _nsfwMaskActionButton.Click += NsfwMaskActionButtonOnClick; _more.Click += DoMoreAction; _title.LinkClick += autoLinkAction; _more.Visibility = AppSettings.User.HasPostingPermission ? ViewStates.Visible : ViewStates.Invisible; _title.Click += OnTitleOnClick; }