//Event Add Wonder private void BtnWonderOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); return; } if (PostData.IsWondered != null && (bool)PostData.IsWondered) { var x = Convert.ToInt32(PostData.PostWonders); if (x > 0) { x--; } else { x = 0; } ImgWonder.SetColorFilter(Color.White); ImgObeeNetwork.SetColorFilter(Color.White); PostData.IsWondered = false; PostData.PostWonders = Convert.ToString(x, CultureInfo.InvariantCulture); TxtCountObeeNetwork.Text = Methods.FunString.FormatPriceValue(x); if (AppSettings.PostButton == PostButtonSystem.Wonder) { TxtWonder.Text = GetText(Resource.String.Btn_Wonder); } else if (AppSettings.PostButton == PostButtonSystem.DisLike) { TxtWonder.Text = GetText(Resource.String.Btn_Dislike); } BtnWonder.Tag = "false"; } else { var x = Convert.ToInt32(PostData.PostWonders); x++; PostData.PostWonders = Convert.ToString(x, CultureInfo.InvariantCulture); PostData.IsWondered = true; ImgWonder.SetColorFilter(Color.ParseColor("#f89823")); ImgObeeNetwork.SetColorFilter(Color.ParseColor("#f89823")); TxtCountObeeNetwork.Text = Methods.FunString.FormatPriceValue(x); if (AppSettings.PostButton == PostButtonSystem.Wonder) { TxtWonder.Text = GetText(Resource.String.Lbl_wondered); } else if (AppSettings.PostButton == PostButtonSystem.DisLike) { TxtWonder.Text = GetText(Resource.String.Lbl_disliked); } BtnWonder.Tag = "true"; } TxtCountObeeNetwork.Text = Methods.FunString.FormatPriceValue(int.Parse(PostData.PostWonders)); if (AppSettings.PostButton == PostButtonSystem.Wonder) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.PostId, "wonder") }); } else if (AppSettings.PostButton == PostButtonSystem.DisLike) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.PostId, "dislike") }); } } catch (Exception exception) { Console.WriteLine(exception); } }
private void SetDataPost() { try { TxtDescription.Text = Methods.FunString.DecodeString(PostData.Orginaltext); if (PostData.IsLiked != null && (bool)PostData.IsLiked) { BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); } else { BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); } if (PostData.IsWondered != null && (bool)PostData.IsWondered) { BtnWonder.Tag = "true"; ImgWonder.SetColorFilter(Color.ParseColor("#f89823")); ImgObeeNetwork.SetColorFilter(Color.ParseColor("#f89823")); TxtWonder.Text = GetText(Resource.String.Lbl_wondered); } else { BtnWonder.Tag = "false"; ImgWonder.SetColorFilter(Color.White); ImgObeeNetwork.SetColorFilter(Color.White); TxtWonder.Text = GetText(Resource.String.Btn_Wonder); } TxtCountObeeNetwork.Text = Methods.FunString.FormatPriceValue(int.Parse(PostData.PostWonders)); if (AppSettings.PostButton == PostButtonSystem.Reaction) { if (PostData.Reaction == null) { PostData.Reaction = new ObeeNetworkClient.Classes.Posts.Reaction(); } TxtCountLike.Text = Methods.FunString.FormatPriceValue(PostData.Reaction.Count); if ((bool)(PostData.Reaction != null & PostData.Reaction?.IsReacted)) { if (!string.IsNullOrEmpty(PostData.Reaction.Type)) { switch (PostData.Reaction.Type) { case "1": case "Like": LikeButton.SetReactionPack(ReactConstants.Like); break; case "2": case "Love": LikeButton.SetReactionPack(ReactConstants.Love); break; case "3": case "HaHa": LikeButton.SetReactionPack(ReactConstants.HaHa); break; case "4": case "WoW": LikeButton.SetReactionPack(ReactConstants.Wow); break; case "5": case "Sad": LikeButton.SetReactionPack(ReactConstants.Sad); break; case "6": case "Angry": LikeButton.SetReactionPack(ReactConstants.Angry); break; default: LikeButton.SetReactionPack(ReactConstants.Default); break; } } } else { LikeButton.SetDefaultReaction(XReactions.GetDefaultReact()); LikeButton.SetTextColor(Color.White); } } else { if (PostData.IsLiked != null && (bool)PostData.IsLiked) { LikeButton.SetReactionPack(ReactConstants.Like); } TxtCountLike.Text = Methods.FunString.FormatPriceValue(int.Parse(PostData.PostLikes)); if (AppSettings.PostButton == PostButtonSystem.Wonder) { if (PostData.IsWondered != null && (bool)PostData.IsWondered) { ImgWonder.SetImageResource(Resource.Drawable.ic_action_ObeeNetwork); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); } else { ImgWonder.SetImageResource(Resource.Drawable.ic_action_ObeeNetwork); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); } } else if (AppSettings.PostButton == PostButtonSystem.DisLike) { if (PostData.IsWondered != null && (bool)PostData.IsWondered) { ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_disliked); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); } else { ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); } } } } catch (Exception e) { Console.WriteLine(e); } }
private void InitComponent() { try { ViewPager = (ViewPager)FindViewById(Resource.Id.view_pager); TxtDescription = FindViewById <TextView>(Resource.Id.tv_description); ImgLike = FindViewById <ImageView>(Resource.Id.image_like1); ImgObeeNetwork = FindViewById <ImageView>(Resource.Id.image_ObeeNetwork); TxtCountLike = FindViewById <TextView>(Resource.Id.LikeText1); TxtCountObeeNetwork = FindViewById <TextView>(Resource.Id.ObeeNetworkTextCount); MainLayout = FindViewById <RelativeLayout>(Resource.Id.main); InfoImageLiner = FindViewById <LinearLayout>(Resource.Id.infoImageLiner); InfoImageLiner.Visibility = ViewStates.Visible; BtnCountLike = FindViewById <LinearLayout>(Resource.Id.linerlikeCount); BtnCountObeeNetwork = FindViewById <LinearLayout>(Resource.Id.linerObeeNetworkCount); BtnLike = FindViewById <LinearLayout>(Resource.Id.linerlike); BtnComment = FindViewById <LinearLayout>(Resource.Id.linercomment); BtnShare = FindViewById <LinearLayout>(Resource.Id.linershare); MainSectionButton = FindViewById <LinearLayout>(Resource.Id.mainsection); BtnWonder = FindViewById <LinearLayout>(Resource.Id.linerSecondReaction); ImgWonder = FindViewById <ImageView>(Resource.Id.image_SecondReaction); TxtWonder = FindViewById <TextView>(Resource.Id.SecondReactionText); LikeButton = FindViewById <ReactButton>(Resource.Id.beactButton); ShareText = FindViewById <TextView>(Resource.Id.ShareText); if (!AppSettings.ShowTextShareButton && ShareText != null) { ShareText.Visibility = ViewStates.Gone; } if (AppSettings.PostButton == PostButtonSystem.Reaction || AppSettings.PostButton == PostButtonSystem.Like) { MainSectionButton.WeightSum = 3; BtnWonder.Visibility = ViewStates.Gone; TxtCountObeeNetwork.Visibility = ViewStates.Gone; BtnCountObeeNetwork.Visibility = ViewStates.Gone; ImgObeeNetwork.Visibility = ViewStates.Gone; } else if (AppSettings.PostButton == PostButtonSystem.Wonder) { MainSectionButton.WeightSum = 4; BtnWonder.Visibility = ViewStates.Visible; TxtCountObeeNetwork.Visibility = ViewStates.Visible; BtnCountObeeNetwork.Visibility = ViewStates.Visible; ImgObeeNetwork.Visibility = ViewStates.Visible; ImgObeeNetwork.SetImageResource(Resource.Drawable.ic_action_ObeeNetwork); ImgWonder.SetImageResource(Resource.Drawable.ic_action_ObeeNetwork); TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Wonder); } else if (AppSettings.PostButton == PostButtonSystem.DisLike) { MainSectionButton.WeightSum = 4; BtnWonder.Visibility = ViewStates.Visible; TxtCountObeeNetwork.Visibility = ViewStates.Visible; BtnCountObeeNetwork.Visibility = ViewStates.Visible; ImgObeeNetwork.Visibility = ViewStates.Visible; ImgObeeNetwork.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Dislike); } if (!AppSettings.ShowShareButton && BtnShare != null) { BtnShare.Visibility = ViewStates.Gone; } } catch (Exception e) { Console.WriteLine(e); } }