// Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is RowSoundLiteAdapterViewHolder holder)
                {
                    var item = SoundsList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Thumbnail, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                        holder.TxtTitle.Text        = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.Title), 25);
                        holder.TxtSeconderText.Text = item.CategoryName + " " + ActivityContext.GetText(Resource.String.Lbl_Music) + " - " + DeepSoundTools.GetNameFinal(item.Publisher);

                        holder.IconHeart.Tag = item.IsLiked != null && item.IsLiked.Value ? "Like" : "Liked";
                        //SetLike(holder.IconHeart);

                        //if (!holder.IconHeart.HasOnClickListeners)
                        //    holder.IconHeart.Click += (sender, e) => ClickListeners.OnLikeSongsClick(new LikeSongsClickEventArgs { View = holder.MainView, SongsClass = item, LikeButton = holder.IconHeart }, NamePage);

                        if (!holder.MoreButton.HasOnClickListeners)
                        {
                            holder.MoreButton.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreSongClickEventArgs {
                                View = holder.MainView, SongsClass = item
                            }, NamePage);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (!(viewHolder is RowSoundAdapterViewHolder holder))
                {
                    return;
                }

                var item = SoundsList[position];

                if (item == null)
                {
                    return;
                }

                GlideImageLoader.LoadImage(ActivityContext, item.Thumbnail, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                holder.TxtSongName.Text   = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.Title), 25);
                holder.TxtGenresName.Text = item.CategoryName + " " + ActivityContext.GetText(Resource.String.Lbl_Music) + " - " + Methods.FunString.FormatPriceValue(Convert.ToInt32(item.CountViews.Replace("K", "").Replace("M", "")));

                holder.CountLike.Text  = item.CountLikes.ToString();
                holder.CountStars.Text = item.CountFavorite.ToString();

                holder.CountViews.Text   = item.CountViews;
                holder.CountShare.Text   = item.CountShares.ToString();
                holder.CountComment.Text = item.CountComment.ToString();

                holder.TxtSongDuration.Text = item.Duration;

                if (item.IsPlay)
                {
                    holder.Image.Visibility         = ViewStates.Gone;
                    holder.CardViewImage.Visibility = ViewStates.Gone;
                    holder.Equalizer.Visibility     = ViewStates.Visible;
                    holder.Equalizer.AnimateBars();
                }
                else
                {
                    holder.Image.Visibility         = ViewStates.Visible;
                    holder.CardViewImage.Visibility = ViewStates.Visible;
                    holder.Equalizer.Visibility     = ViewStates.Gone;
                    holder.Equalizer.StopBars();
                }

                if (!holder.MoreButton.HasOnClickListeners)
                {
                    holder.MoreButton.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreSongClickEventArgs {
                        View = holder.MainView, SongsClass = item
                    }, NamePage);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Esempio n. 3
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is ActivitiesAdapterViewHolder holder)
                {
                    var item = ActivityList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                        GlideImageLoader.LoadImage(ActivityContext, item.SThumbnail, holder.ImageSong, ImageStyle.RoundedCrop, ImagePlaceholders.Drawable);

                        holder.TxtName.Text  = DeepSoundTools.GetNameFinal(item.UserData);
                        holder.TxtTitle.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.ActivityText) + " " + item.ActivityTimeFormatted, 35);

                        holder.TxtTitleSong.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.TrackData.Title), 80);

                        if (!holder.TxtTitle.HasOnClickListeners)
                        {
                            holder.TxtTitle.Click += (sender, e) =>
                            {
                                GlobalContext?.OpenProfile(item.UserData.Id, item.UserData);
                            }
                        }
                        ;

                        if (!holder.MoreButton.HasOnClickListeners)
                        {
                            holder.MoreButton.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreSongClickEventArgs {
                                View = holder.MainView, SongsClass = item.TrackData
                            });
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 4
0
        private void AddOrRemoveEvent(bool addEvent)
        {
            try
            {
                // true +=  // false -=
                if (addEvent)
                {
                    CommentsAdapter.AvatarClick += CommentsAdapter_AvatarClick;

                    if (!string.IsNullOrEmpty(Json))
                    {
                        var item = JsonConvert.DeserializeObject <PostsObject>(Json);

                        ClickListeners = new SocialIoClickListeners(Activity);

                        if (!CommentCount.HasOnClickListeners)
                        {
                            CommentCount.Click += (sender, e) => ClickListeners.OnCommentPostClick(new CommentFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview
                            }, "YoutubePost");
                        }

                        if (!LikeCount.HasOnClickListeners)
                        {
                            LikeCount.Click += (sender, e) => ClickListeners.OnLikedPostClick(new LikeNewsFeedClickEventArgs {
                                View = Mainview, NewsFeedClass = item, LikeButton = LikeCount
                            });
                        }

                        if (!LikeIcon.HasOnClickListeners)
                        {
                            LikeIcon.Click += (sender, e) => ClickListeners.OnLikeNewsFeedClick(new LikeNewsFeedClickEventArgs {
                                View = Mainview, NewsFeedClass = item, LikeButton = LikeIcon
                            });
                        }

                        if (!Favicon.HasOnClickListeners)
                        {
                            Favicon.Click += (sender, e) => ClickListeners.OnFavNewsFeedClick(new FavNewsFeedClickEventArgs {
                                NewsFeedClass = item, FavButton = Favicon
                            });
                        }

                        if (!UserAvatar.HasOnClickListeners)
                        {
                            UserAvatar.Click += (sender, e) => ClickListeners.OnAvatarImageFeedClick(new AvatarFeedClickEventArgs {
                                NewsFeedClass = item, Image = UserAvatar, View = Mainview
                            }, "YoutubePost");
                        }

                        if (!CommentIcon.HasOnClickListeners)
                        {
                            CommentIcon.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview
                            }, "YoutubePost");
                        }

                        if (!ViewCommentsButton.HasOnClickListeners)
                        {
                            ViewCommentsButton.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview
                            }, "YoutubePost");
                        }

                        if (!MoreIcon.HasOnClickListeners)
                        {
                            MoreIcon.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview, IsOwner = item.IsOwner
                            }, false, "YoutubePost");
                        }

                        if (!ShareIcon.HasOnClickListeners)
                        {
                            ShareIcon.Click += (sender, e) => ClickListeners.OnShareClick(new ShareFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview
                            });
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 5
0
        public void SetDataDynamicForViewHolder(View itemView, TextView username, ImageView userAvatar, AutoLinkTextView description, TextView likeIcon, TextView favIcon, TextView commentCount, TextView likeCount, TextView viewMoreComments, TextView timeText, TextView commentIcon, TextView moreIcon, TextView shareIcon, TextView isBoostedIcon, PostsObject item)
        {
            try
            {
                if (item == null)
                {
                    return;
                }

                TextSanitizerAutoLink = new TextSanitizer(description, ActivityContext);

                GlideImageLoader.LoadImage(ActivityContext, item.Avatar, userAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                username.Text = item.Username;

                string time = Methods.Time.TimeAgo(Convert.ToInt32(item.Time));
                timeText.Text = time;

                if (!string.IsNullOrEmpty(description.Text))
                {
                    ReadMoreOption.AddReadMoreTo(description, item.Description);
                    TextSanitizerAutoLink.Load(item.Description);
                }
                else
                {
                    description.Visibility = ViewStates.Gone;
                }

                if (item.Boosted == "1")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, isBoostedIcon, IonIconsFonts.RibbonA);
                    isBoostedIcon.Text      += " " + ActivityContext.GetString(Resource.String.Lbl_Promoted);
                    isBoostedIcon.Visibility = ViewStates.Visible;
                }

                likeIcon.Tag = item.IsLiked ? "Like" : "Liked";
                ClickListeners.SetLike(likeIcon);

                favIcon.Tag = item.IsSaved ? "Add" : "Added";
                ClickListeners.SetFav(favIcon);

                commentCount.Text = item.Votes + " " + ActivityContext.GetString(Resource.String.Lbl_Comments);
                likeCount.Text    = item.Likes + " " + ActivityContext.GetString(Resource.String.Lbl_Likes);

                if (item.Votes > 0)
                {
                    viewMoreComments.Visibility = ViewStates.Visible;
                    viewMoreComments.Text       = ActivityContext.GetString(Resource.String.Lbl_ShowAllComments);
                }
                else
                {
                    viewMoreComments.Visibility = ViewStates.Gone;
                }

                if (!commentCount.HasOnClickListeners)
                {
                    commentCount.Click += (sender, e) => ClickListeners.OnCommentPostClick(new CommentFeedClickEventArgs {
                        View = itemView, NewsFeedClass = item
                    }, "NewsFeedPost");
                }

                if (!likeCount.HasOnClickListeners)
                {
                    likeCount.Click += (sender, e) => ClickListeners.OnLikedPostClick(new LikeNewsFeedClickEventArgs {
                        View = itemView, NewsFeedClass = item, LikeButton = likeCount
                    });
                }

                if (!likeIcon.HasOnClickListeners)
                {
                    likeIcon.Click += (sender, e) => ClickListeners.OnLikeNewsFeedClick(new LikeNewsFeedClickEventArgs {
                        View = itemView, NewsFeedClass = item, LikeButton = likeIcon
                    });
                }

                if (!favIcon.HasOnClickListeners)
                {
                    favIcon.Click += (sender, e) => ClickListeners.OnFavNewsFeedClick(new FavNewsFeedClickEventArgs {
                        NewsFeedClass = item, FavButton = favIcon
                    });
                }

                if (!userAvatar.HasOnClickListeners)
                {
                    userAvatar.Click += (sender, e) => ClickListeners.OnAvatarImageFeedClick(new AvatarFeedClickEventArgs {
                        NewsFeedClass = item, Image = userAvatar, View = itemView
                    }, "NewsFeedPost");
                }

                if (!commentIcon.HasOnClickListeners)
                {
                    commentIcon.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView
                    }, "NewsFeedPost");
                }

                if (!viewMoreComments.HasOnClickListeners)
                {
                    viewMoreComments.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView
                    }, "NewsFeedPost");
                }

                if (!moreIcon.HasOnClickListeners)
                {
                    moreIcon.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView, IsOwner = item.IsOwner
                    }, true, "NewsFeedPost");
                }

                if (!shareIcon.HasOnClickListeners)
                {
                    shareIcon.Click += (sender, e) => ClickListeners.OnShareClick(new ShareFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 6
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (!(viewHolder is RowSoundAdapterViewHolder holder))
                {
                    return;
                }

                var item = SoundsList[position];

                if (item == null)
                {
                    return;
                }

                holder.CountItemTextView.Text = position.ToString("D2");

                FullGlideRequestBuilder.Load(item.Thumbnail).Into(holder.Image);

                holder.TxtSongName.Text   = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.Title), 60);
                holder.TxtGenresName.Text = item.CategoryName + " " + ActivityContext.GetText(Resource.String.Lbl_Music) + " - " + DeepSoundTools.GetNameFinal(item.Publisher);

                if (item.IsLiked != null && item.IsLiked.Value)
                {
                    FullGlideRequestBuilder.Load(Resource.Drawable.icon_heart_filled_post_vector).Into(holder.LikeButton);
                    holder.LikeButton.SetColorFilter(Color.ParseColor("#E9314B"));
                }

                //holder.CountLike.Text = item.CountLikes.ToString();
                //holder.CountStars.Text = item.CountFavorite.ToString();
                //holder.CountViews.Text = item.CountViews;
                //holder.CountShare.Text = item.CountShares.ToString();
                //holder.CountComment.Text = item.CountComment.ToString();

                holder.TxtSongDuration.Text = item.Duration;

                if (item.IsPlay)
                {
                    holder.Image.Visibility         = ViewStates.Gone;
                    holder.CardViewImage.Visibility = ViewStates.Gone;
                    holder.Equalizer.Visibility     = ViewStates.Visible;
                    holder.Equalizer.AnimateBars();
                }
                else
                {
                    holder.Image.Visibility         = ViewStates.Visible;
                    holder.CardViewImage.Visibility = ViewStates.Visible;
                    holder.Equalizer.Visibility     = ViewStates.Gone;
                    holder.Equalizer.StopBars();
                }

                if (!holder.MoreButton.HasOnClickListeners)
                {
                    holder.MoreButton.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreSongClickEventArgs {
                        View = holder.MainView, SongsClass = item
                    }, NamePage);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void AddOrRemoveEvent(bool addEvent)
        {
            try
            {
                // true +=  // false -=
                if (addEvent)
                {
                    if (!string.IsNullOrEmpty(Json))
                    {
                        var item = JsonConvert.DeserializeObject <PostsObject>(Json);

                        GlideImageLoader.LoadImage(Activity, !string.IsNullOrEmpty(item.MediaSet[0].Extra) ? item.MediaSet[0].Extra : item.MediaSet[0].File, ImageDisplay, ImageStyle.FitCenter, ImagePlaceholders.Color);
                        GlideImageLoader.LoadImage(Activity, !string.IsNullOrEmpty(item.MediaSet[0].File) ? item.MediaSet[0].File : item.MediaSet[0].Extra, ImageDisplay, ImageStyle.FitCenter, ImagePlaceholders.Color);

                        ClickListeners = new SocialIoClickListeners(Activity);

                        if (!CommentCount.HasOnClickListeners)
                        {
                            CommentCount.Click += (sender, e) => ClickListeners.OnCommentPostClick(new CommentFeedClickEventArgs {
                                View = Mainview, NewsFeedClass = item
                            }, "ImagePost");
                        }

                        if (!LikeCount.HasOnClickListeners)
                        {
                            LikeCount.Click += (sender, e) => ClickListeners.OnLikedPostClick(new LikeNewsFeedClickEventArgs {
                                View = Mainview, NewsFeedClass = item, LikeButton = LikeIcon
                            });
                        }

                        if (!LikeIcon.HasOnClickListeners)
                        {
                            LikeIcon.Click += (sender, e) => ClickListeners.OnLikeNewsFeedClick(new LikeNewsFeedClickEventArgs {
                                View = Mainview, NewsFeedClass = item, LikeButton = LikeIcon
                            });
                        }

                        if (!Favicon.HasOnClickListeners)
                        {
                            Favicon.Click += (sender, e) => ClickListeners.OnFavNewsFeedClick(new FavNewsFeedClickEventArgs {
                                NewsFeedClass = item, FavButton = Favicon
                            });
                        }

                        if (!UserAvatar.HasOnClickListeners)
                        {
                            UserAvatar.Click += (sender, e) => ClickListeners.OnAvatarImageFeedClick(new AvatarFeedClickEventArgs {
                                NewsFeedClass = item, Image = UserAvatar, View = Mainview
                            }, "ImagePost");
                        }

                        if (!CommentIcon.HasOnClickListeners)
                        {
                            CommentIcon.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview
                            }, "ImagePost");
                        }

                        if (!ViewCommentsButton.HasOnClickListeners)
                        {
                            ViewCommentsButton.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview
                            }, "ImagePost");
                        }

                        if (!MoreIcon.HasOnClickListeners)
                        {
                            MoreIcon.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview, IsOwner = item.IsOwner
                            }, false, "ImagePost");
                        }

                        if (!ShareIcon.HasOnClickListeners)
                        {
                            ShareIcon.Click += (sender, e) => ClickListeners.OnShareClick(new ShareFeedClickEventArgs {
                                NewsFeedClass = item, View = Mainview
                            });
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }