private void SetDataPost() { try { TxtDescription.Text = Methods.FunString.DecodeString(PostData.Orginaltext); if (PostData.IsLiked != null && PostData.IsLiked.Value) { BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); } else { BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); } if (PostData.IsWondered != null && PostData.IsWondered.Value) { BtnWonder.Tag = "true"; ImgWonder.SetColorFilter(Color.ParseColor("#f89823")); ImgWoWonder.SetColorFilter(Color.ParseColor("#f89823")); TxtWonder.Text = GetText(Resource.String.Lbl_wondered); } else { BtnWonder.Tag = "false"; ImgWonder.SetColorFilter(Color.White); ImgWoWonder.SetColorFilter(Color.White); TxtWonder.Text = GetText(Resource.String.Btn_Wonder); } TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(int.Parse(PostData.PostWonders)); if (AppSettings.PostButton == PostButtonSystem.Reaction) { PostData.Reaction ??= new WoWonderClient.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 && PostData.IsLiked.Value) { LikeButton.SetReactionPack(ReactConstants.Like); } TxtCountLike.Text = Methods.FunString.FormatPriceValue(int.Parse(PostData.PostLikes)); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostData.IsWondered != null && PostData.IsWondered.Value: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Wonder: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.DisLike when PostData.IsWondered != null && PostData.IsWondered.Value: 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)); break; case PostButtonSystem.DisLike: ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; } } } catch (Exception e) { Console.WriteLine(e); } }
private void SetDataPost() { try { if (string.IsNullOrEmpty(PostData.Orginaltext) || string.IsNullOrWhiteSpace(PostData.Orginaltext)) { TxtDescription.Visibility = ViewStates.Gone; } else { var description = Methods.FunString.DecodeString(PostData.Orginaltext); var readMoreOption = new StReadMoreOption.Builder() .TextLength(250, StReadMoreOption.TypeCharacter) .MoreLabel(GetText(Resource.String.Lbl_ReadMore)) .LessLabel(GetText(Resource.String.Lbl_ReadLess)) .MoreLabelColor(Color.ParseColor(AppSettings.MainColor)) .LessLabelColor(Color.ParseColor(AppSettings.MainColor)) .LabelUnderLine(true) .Build(); readMoreOption.AddReadMoreTo(TxtDescription, new Java.Lang.String(description)); } if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PostData.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); TxtCountLike.Text = Methods.FunString.FormatPriceValue(PostData.Reaction.Count); if (PostData.Reaction.IsReacted != null && PostData.Reaction.IsReacted.Value) { if (!string.IsNullOrEmpty(PostData.Reaction.Type)) { var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == PostData.Reaction.Type).Value?.Id ?? ""; switch (react) { case "1": LikeButton.SetReactionPack(ReactConstants.Like); ImgLike.SetImageResource(Resource.Drawable.emoji_like); break; case "2": LikeButton.SetReactionPack(ReactConstants.Love); ImgLike.SetImageResource(Resource.Drawable.emoji_love); break; case "3": LikeButton.SetReactionPack(ReactConstants.HaHa); ImgLike.SetImageResource(Resource.Drawable.emoji_haha); break; case "4": LikeButton.SetReactionPack(ReactConstants.Wow); ImgLike.SetImageResource(Resource.Drawable.emoji_wow); break; case "5": LikeButton.SetReactionPack(ReactConstants.Sad); ImgLike.SetImageResource(Resource.Drawable.emoji_sad); break; case "6": LikeButton.SetReactionPack(ReactConstants.Angry); ImgLike.SetImageResource(Resource.Drawable.emoji_angry); break; default: LikeButton.SetReactionPack(ReactConstants.Default); ImgLike.SetImageResource(PostData.Reaction.Count > 0 ? Resource.Drawable.emoji_like : Resource.Drawable.icon_post_like_vector); break; } } } else { LikeButton.SetReactionPack(ReactConstants.Default); LikeButton.SetTextColor(Color.White); ImgLike.SetImageResource(PostData.Reaction.Count > 0 ? Resource.Drawable.emoji_like : Resource.Drawable.icon_post_like_vector); } } else { ImgLike.SetImageResource(Resource.Drawable.icon_post_like_vector); TxtCountLike.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostLikes)); if (AppSettings.PostButton == PostButtonSystem.Wonder || AppSettings.PostButton == PostButtonSystem.DisLike) { TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostWonders)); } switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostData.IsWondered != null && PostData.IsWondered.Value: BtnWonder.Tag = "true"; ImgWoWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Wonder: BtnWonder.Tag = "false"; ImgWoWonder.SetColorFilter(Color.White); ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.DisLike when PostData.IsWondered != null && PostData.IsWondered.Value: BtnWonder.Tag = "true"; ImgWoWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); 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)); break; case PostButtonSystem.DisLike: BtnWonder.Tag = "false"; ImgWoWonder.SetColorFilter(Color.White); ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.Like when PostData.IsLiked != null && PostData.IsLiked.Value: BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Like: BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
//Get Data private void Get_DataImage() { try { AlbumData = JsonConvert.DeserializeObject <PostDataObject>(Intent.GetStringExtra("AlbumObject")); if (AlbumData != null) { string index = Intent.GetStringExtra("itemIndex") ?? "0"; if (index == "00") { ImageUrl = !string.IsNullOrEmpty(AlbumData.PostSticker) ? AlbumData.PostSticker : AlbumData.PostFileFull; //var bit = drawable_from_url(new Uri(ImageUrl)); //PageImage.SetImageBitmap(bit); if (ImageUrl.Contains(".gif")) { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions().Placeholder(Resource.Drawable.ImagePlacholder).FitCenter()).Into(PageImage); } else { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions()).Into(PageImage); } } else { var imageData = AlbumData.PhotoAlbum[int.Parse(index)]; if (imageData != null) { ImageUrl = imageData.Image; //var bit = drawable_from_url(new Uri(imageData.Image)); //PageImage.SetImageBitmap(bit); if (ImageUrl.Contains(".gif")) { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions().Placeholder(Resource.Drawable.ImagePlacholder).FitCenter()).Into(PageImage); } else { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions()).Into(PageImage); } } } if (string.IsNullOrEmpty(AlbumData.Orginaltext) || string.IsNullOrWhiteSpace(AlbumData.Orginaltext)) { TxtDescription.Visibility = ViewStates.Gone; } else { TxtDescription.Text = Methods.FunString.DecodeString(AlbumData.Orginaltext); } if (AlbumData.IsLiked != null && AlbumData.IsLiked.Value) { BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); } else { BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); } if (AlbumData.IsWondered != null && AlbumData.IsWondered.Value) { BtnWonder.Tag = "true"; ImgWonder.SetColorFilter(Color.ParseColor("#f89823")); ImgWoWonder.SetColorFilter(Color.ParseColor("#f89823")); TxtWonder.Text = GetText(Resource.String.Lbl_wondered); } else { BtnWonder.Tag = "false"; ImgWonder.SetColorFilter(Color.White); ImgWoWonder.SetColorFilter(Color.White); TxtWonder.Text = GetText(Resource.String.Btn_Wonder); } TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(int.Parse(AlbumData.PostWonders)); if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { AlbumData.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); TxtCountLike.Text = Methods.FunString.FormatPriceValue(AlbumData.Reaction.Count); if ((bool)(AlbumData.Reaction != null & AlbumData.Reaction?.IsReacted)) { if (!string.IsNullOrEmpty(AlbumData.Reaction.Type)) { switch (AlbumData.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 (AlbumData.IsLiked != null && AlbumData.IsLiked.Value) { LikeButton.SetReactionPack(ReactConstants.Like); } TxtCountLike.Text = Methods.FunString.FormatPriceValue(int.Parse(AlbumData.PostLikes)); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when AlbumData.IsWondered != null && AlbumData.IsWondered.Value: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Wonder: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.DisLike when AlbumData.IsWondered != null && AlbumData.IsWondered.Value: 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)); break; case PostButtonSystem.DisLike: ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; } } } } catch (Exception e) { Console.WriteLine(e); } }
//Get Data private void Get_DataImage() { try { IndexImage = Convert.ToInt32(Intent?.GetStringExtra("indexImage") ?? "0"); TypePost = Intent?.GetStringExtra("TypePost") ?? ""; PostData = JsonConvert.DeserializeObject <PostDataObject>(Intent?.GetStringExtra("AlbumObject") ?? ""); if (PostData != null) { var photos = new ObservableCollection <string>(); if (TypePost == "Product" && PostData.Product != null) { foreach (var item in PostData.Product.Value.ProductClass.Images) { photos.Add(item.Image); } } else { foreach (var item in PostData.PhotoMulti ?? PostData.PhotoAlbum) { photos.Add(item.Image); } } ViewPager.Adapter = new TouchImageAdapter(this, photos); ViewPager.CurrentItem = IndexImage; ViewPager.Adapter.NotifyDataSetChanged(); if (string.IsNullOrEmpty(PostData.Orginaltext) || string.IsNullOrWhiteSpace(PostData.Orginaltext)) { TxtDescription.Visibility = ViewStates.Gone; } else { var description = Methods.FunString.DecodeString(PostData.Orginaltext); var readMoreOption = new StReadMoreOption.Builder() .TextLength(250, StReadMoreOption.TypeCharacter) .MoreLabel(GetText(Resource.String.Lbl_ReadMore)) .LessLabel(GetText(Resource.String.Lbl_ReadLess)) .MoreLabelColor(Color.ParseColor(AppSettings.MainColor)) .LessLabelColor(Color.ParseColor(AppSettings.MainColor)) .LabelUnderLine(true) .Build(); readMoreOption.AddReadMoreTo(TxtDescription, new Java.Lang.String(description)); } if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PostData.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); TxtCountLike.Text = Methods.FunString.FormatPriceValue(PostData.Reaction.Count); if (PostData.Reaction.IsReacted != null && PostData.Reaction.IsReacted.Value) { if (!string.IsNullOrEmpty(PostData.Reaction.Type)) { var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == PostData.Reaction.Type).Value?.Id ?? ""; switch (react) { case "1": LikeButton.SetReactionPack(ReactConstants.Like); ImgLike.SetImageResource(Resource.Drawable.emoji_like); break; case "2": LikeButton.SetReactionPack(ReactConstants.Love); ImgLike.SetImageResource(Resource.Drawable.emoji_love); break; case "3": LikeButton.SetReactionPack(ReactConstants.HaHa); ImgLike.SetImageResource(Resource.Drawable.emoji_haha); break; case "4": LikeButton.SetReactionPack(ReactConstants.Wow); ImgLike.SetImageResource(Resource.Drawable.emoji_wow); break; case "5": LikeButton.SetReactionPack(ReactConstants.Sad); ImgLike.SetImageResource(Resource.Drawable.emoji_sad); break; case "6": LikeButton.SetReactionPack(ReactConstants.Angry); ImgLike.SetImageResource(Resource.Drawable.emoji_angry); break; default: LikeButton.SetReactionPack(ReactConstants.Default); ImgLike.SetImageResource(PostData.Reaction.Count > 0 ? Resource.Drawable.emoji_like : Resource.Drawable.icon_post_like_vector); break; } } } else { LikeButton.SetReactionPack(ReactConstants.Default); LikeButton.SetTextColor(Color.White); ImgLike.SetImageResource(PostData.Reaction.Count > 0 ? Resource.Drawable.emoji_like : Resource.Drawable.icon_post_like_vector); } } else { ImgLike.SetImageResource(Resource.Drawable.icon_post_like_vector); TxtCountLike.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostLikes)); if (AppSettings.PostButton == PostButtonSystem.Wonder || AppSettings.PostButton == PostButtonSystem.DisLike) { TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostWonders)); } switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostData.IsWondered != null && PostData.IsWondered.Value: BtnWonder.Tag = "true"; ImgWoWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Wonder: BtnWonder.Tag = "false"; ImgWoWonder.SetColorFilter(Color.White); ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.DisLike when PostData.IsWondered != null && PostData.IsWondered.Value: BtnWonder.Tag = "true"; ImgWoWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); 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)); break; case PostButtonSystem.DisLike: BtnWonder.Tag = "false"; ImgWoWonder.SetColorFilter(Color.White); ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.Like when PostData.IsLiked != null && PostData.IsLiked.Value: BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Like: BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); break; } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
//Get Data private void Get_DataImage() { try { IndexImage = int.Parse(Intent.GetStringExtra("indexImage")); PostData = JsonConvert.DeserializeObject <PostDataObject>(Intent.GetStringExtra("AlbumObject")); if (PostData != null) { var photos = PostData.PhotoMulti ?? PostData.PhotoAlbum; ViewPager.Adapter = new TouchImageAdapter(this, new ObservableCollection <PhotoAlbumObject>(photos)); ViewPager.CurrentItem = IndexImage; ViewPager.Adapter.NotifyDataSetChanged(); TxtDescription.Text = Methods.FunString.DecodeString(PostData.Orginaltext); if (PostData.IsLiked != null && PostData.IsLiked.Value) { BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); } else { BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); } if (PostData.IsWondered != null && PostData.IsWondered.Value) { BtnWonder.Tag = "true"; ImgWonder.SetColorFilter(Color.ParseColor("#f89823")); ImgWoWonder.SetColorFilter(Color.ParseColor("#f89823")); TxtWonder.Text = GetText(Resource.String.Lbl_wondered); } else { BtnWonder.Tag = "false"; ImgWonder.SetColorFilter(Color.White); ImgWoWonder.SetColorFilter(Color.White); TxtWonder.Text = GetText(Resource.String.Btn_Wonder); } TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(int.Parse(PostData.PostWonders)); if (AppSettings.PostButton == PostButtonSystem.Reaction) { PostData.Reaction ??= new WoWonderClient.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 && PostData.IsLiked.Value) { LikeButton.SetReactionPack(ReactConstants.Like); } TxtCountLike.Text = Methods.FunString.FormatPriceValue(int.Parse(PostData.PostLikes)); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostData.IsWondered != null && PostData.IsWondered.Value: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Wonder: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.DisLike when PostData.IsWondered != null && PostData.IsWondered.Value: 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)); break; case PostButtonSystem.DisLike: ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; } } } } catch (Exception e) { Console.WriteLine(e); } }
//Get Data private void Get_DataImage() { try { PostData = JsonConvert.DeserializeObject <PostDataObject>(Intent?.GetStringExtra("AlbumObject") ?? ""); if (PostData != null) { string index = Intent?.GetStringExtra("itemIndex") ?? "0"; if (index == "00") { if (PostData.PhotoAlbum?.Count > 0) { var imagesList = PostData.PhotoAlbum; ImageUrl = imagesList[0].Image; } else { ImageUrl = !string.IsNullOrEmpty(PostData.PostSticker) ? PostData.PostSticker : PostData.PostFileFull; } //var bit = drawable_from_url(new Uri(ImageUrl)); //PageImage.SetImageBitmap(bit); if (ImageUrl.Contains(".gif")) { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions().Placeholder(Resource.Drawable.ImagePlacholder).FitCenter()).Into(PageImage); } else { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions()).Into(PageImage); } } else { var imageData = PostData.PhotoAlbum[Convert.ToInt32(index)]; if (imageData != null) { ImageUrl = imageData.Image; //var bit = drawable_from_url(new Uri(imageData.Image)); //PageImage.SetImageBitmap(bit); if (ImageUrl.Contains(".gif")) { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions().Placeholder(Resource.Drawable.ImagePlacholder).FitCenter()).Into(PageImage); } else { Glide.With(this).Load(ImageUrl).Apply(new RequestOptions()).Into(PageImage); } } } if (string.IsNullOrEmpty(PostData.Orginaltext) || string.IsNullOrWhiteSpace(PostData.Orginaltext)) { TxtDescription.Visibility = ViewStates.Gone; } else { var description = Methods.FunString.DecodeString(PostData.Orginaltext); var readMoreOption = new StReadMoreOption.Builder() .TextLength(250, StReadMoreOption.TypeCharacter) .MoreLabel(GetText(Resource.String.Lbl_ReadMore)) .LessLabel(GetText(Resource.String.Lbl_ReadLess)) .MoreLabelColor(Color.ParseColor(AppSettings.MainColor)) .LessLabelColor(Color.ParseColor(AppSettings.MainColor)) .LabelUnderLine(true) .Build(); readMoreOption.AddReadMoreTo(TxtDescription, new Java.Lang.String(description)); } if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PostData.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); TxtCountLike.Text = Methods.FunString.FormatPriceValue(PostData.Reaction.Count); if (PostData.Reaction.IsReacted != null && PostData.Reaction.IsReacted.Value) { if (!string.IsNullOrEmpty(PostData.Reaction.Type)) { var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == PostData.Reaction.Type).Value?.Id ?? ""; switch (react) { case "1": LikeButton.SetReactionPack(ReactConstants.Like); ImgLike.SetImageResource(Resource.Drawable.emoji_like); break; case "2": LikeButton.SetReactionPack(ReactConstants.Love); ImgLike.SetImageResource(Resource.Drawable.emoji_love); break; case "3": LikeButton.SetReactionPack(ReactConstants.HaHa); ImgLike.SetImageResource(Resource.Drawable.emoji_haha); break; case "4": LikeButton.SetReactionPack(ReactConstants.Wow); ImgLike.SetImageResource(Resource.Drawable.emoji_wow); break; case "5": LikeButton.SetReactionPack(ReactConstants.Sad); ImgLike.SetImageResource(Resource.Drawable.emoji_sad); break; case "6": LikeButton.SetReactionPack(ReactConstants.Angry); ImgLike.SetImageResource(Resource.Drawable.emoji_angry); break; default: LikeButton.SetReactionPack(ReactConstants.Default); ImgLike.SetImageResource(PostData.Reaction.Count > 0 ? Resource.Drawable.emoji_like : Resource.Drawable.icon_post_like_vector); break; } } } else { LikeButton.SetReactionPack(ReactConstants.Default); LikeButton.SetTextColor(Color.White); ImgLike.SetImageResource(PostData.Reaction.Count > 0 ? Resource.Drawable.emoji_like : Resource.Drawable.icon_post_like_vector); } } else { ImgLike.SetImageResource(Resource.Drawable.icon_post_like_vector); TxtCountLike.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostLikes)); if (AppSettings.PostButton == PostButtonSystem.Wonder || AppSettings.PostButton == PostButtonSystem.DisLike) { TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostWonders)); } switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostData.IsWondered != null && PostData.IsWondered.Value: BtnWonder.Tag = "true"; ImgWoWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Wonder: BtnWonder.Tag = "false"; ImgWoWonder.SetColorFilter(Color.White); ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.DisLike when PostData.IsWondered != null && PostData.IsWondered.Value: BtnWonder.Tag = "true"; ImgWoWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); 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)); break; case PostButtonSystem.DisLike: BtnWonder.Tag = "false"; ImgWoWonder.SetColorFilter(Color.White); ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.Like when PostData.IsLiked != null && PostData.IsLiked.Value: BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Like: BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); break; } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
//Get Data private void Get_DataImage() { try { IndexImage = Convert.ToInt32(Intent?.GetStringExtra("indexImage") ?? ""); PostData = JsonConvert.DeserializeObject <PostDataObject>(Intent?.GetStringExtra("AlbumObject") ?? ""); if (PostData != null) { var photos = PostData.PhotoMulti ?? PostData.PhotoAlbum; ViewPager.Adapter = new TouchImageAdapter(this, new ObservableCollection <PhotoAlbumObject>(photos)); ViewPager.CurrentItem = IndexImage; ViewPager.Adapter.NotifyDataSetChanged(); if (string.IsNullOrEmpty(PostData.Orginaltext) || string.IsNullOrWhiteSpace(PostData.Orginaltext)) { TxtDescription.Visibility = ViewStates.Gone; } else { TxtDescription.Text = Methods.FunString.DecodeString(PostData.Orginaltext); } if (PostData.IsLiked != null && PostData.IsLiked.Value) { BtnLike.Tag = "true"; ImgLike.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); } else { BtnLike.Tag = "false"; ImgLike.SetColorFilter(Color.White); } if (PostData.IsWondered != null && PostData.IsWondered.Value) { BtnWonder.Tag = "true"; ImgWonder.SetColorFilter(Color.ParseColor("#f89823")); ImgWoWonder.SetColorFilter(Color.ParseColor("#f89823")); TxtWonder.Text = GetText(Resource.String.Lbl_wondered); } else { BtnWonder.Tag = "false"; ImgWonder.SetColorFilter(Color.White); ImgWoWonder.SetColorFilter(Color.White); TxtWonder.Text = GetText(Resource.String.Btn_Wonder); } TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostWonders)); if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PostData.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); TxtCountLike.Text = Methods.FunString.FormatPriceValue(PostData.Reaction.Count); if (PostData.Reaction.IsReacted != null && PostData.Reaction.IsReacted.Value) { if (!string.IsNullOrEmpty(PostData.Reaction.Type)) { var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == PostData.Reaction.Type).Value?.Id ?? ""; switch (react) { case "1": LikeButton.SetReactionPack(ReactConstants.Like); break; case "2": LikeButton.SetReactionPack(ReactConstants.Love); break; case "3": LikeButton.SetReactionPack(ReactConstants.HaHa); break; case "4": LikeButton.SetReactionPack(ReactConstants.Wow); break; case "5": LikeButton.SetReactionPack(ReactConstants.Sad); break; case "6": LikeButton.SetReactionPack(ReactConstants.Angry); break; default: LikeButton.SetReactionPack(ReactConstants.Default); break; } } } else { LikeButton.SetReactionPack(ReactConstants.Default); LikeButton.SetTextColor(Color.White); } } else { if (PostData.IsLiked != null && PostData.IsLiked.Value) { LikeButton.SetReactionPack(ReactConstants.Like); } TxtCountLike.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostLikes)); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostData.IsWondered != null && PostData.IsWondered.Value: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); TxtWonder.Text = GetString(Resource.String.Lbl_wondered); TxtWonder.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; case PostButtonSystem.Wonder: ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Wonder); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; case PostButtonSystem.DisLike when PostData.IsWondered != null && PostData.IsWondered.Value: 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)); break; case PostButtonSystem.DisLike: ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike); ImgWonder.SetColorFilter(Color.White); TxtWonder.Text = GetString(Resource.String.Btn_Dislike); TxtWonder.SetTextColor(Color.ParseColor("#444444")); break; } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }