// Create new views (invoked by the layout manager) public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { try { //Setup your layout here >> Style_PageCircle_view View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_CommentView, parent, false); var vh = new CommentAdapterViewHolder(itemView, Click, LongClick); return(vh); } catch (Exception exception) { Console.WriteLine(exception); return(null); } }
private void OnLikeButtonClick(CommentAdapterViewHolder holder, CommentAdapterClickEventArgs e) { try { if (!UserDetails.IsLogin) { PopupDialogController dialog = new PopupDialogController(ActivityContext, null, "Login"); dialog.ShowNormalDialog(ActivityContext.GetText(Resource.String.Lbl_Login), ActivityContext.GetText(Resource.String.Lbl_Message_Sorry_signin), ActivityContext.GetText(Resource.String.Lbl_Yes), ActivityContext.GetText(Resource.String.Lbl_No)); return; } if (Methods.CheckConnectivity()) { if (e.Class != null) { if (holder.LikeButton.Tag.ToString() == "1") { FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.LikeiconView, IonIconsFonts.IosHeartOutline); holder.LikeiconView.SetTextColor(Color.White); holder.LikeButton.Tag = "0"; e.Class.IsLikedComment = false; if (!holder.LikeNumber.Text.Contains("K") && !holder.LikeNumber.Text.Contains("M")) { double x = Convert.ToDouble(holder.LikeNumber.Text); if (x > 0) { x--; } else { x = 0; } holder.LikeNumber.Text = x.ToString(CultureInfo.InvariantCulture); e.Class.CountLiked = Convert.ToInt32(x); } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comments.LikeUnLikeCommentAsync(e.Class.Id.ToString(), false) }); } else { FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.LikeiconView, IonIconsFonts.IosHeart); holder.LikeiconView.SetTextColor(Color.ParseColor("#ed4856")); holder.LikeButton.Tag = "1"; e.Class.IsLikedComment = true; if (!holder.LikeNumber.Text.Contains("K") && !holder.LikeNumber.Text.Contains("M")) { double x = Convert.ToDouble(holder.LikeNumber.Text); x++; holder.LikeNumber.Text = x.ToString(CultureInfo.InvariantCulture); e.Class.CountLiked = Convert.ToInt32(x); } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comments.LikeUnLikeCommentAsync(e.Class.Id.ToString(), true) }); } } } else { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }