private void LoadPost() { try { PostObject = JsonConvert.DeserializeObject <PostDataObject>(Intent?.GetStringExtra("PostObject")); if (PostObject != null) { var readMoreOption = new StReadMoreOption.Builder() .TextLength(200, 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(); if (SecondReactionButton != null) { switch (AppSettings.PostButton) { case PostButtonSystem.ReactionDefault: case PostButtonSystem.ReactionSubShine: case PostButtonSystem.Like: MainSectionButton.WeightSum = 3; SecondReactionButton.Visibility = ViewStates.Gone; break; case PostButtonSystem.Wonder: MainSectionButton.WeightSum = 4; SecondReactionButton.Visibility = ViewStates.Visible; SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_action_wowonder, 0, 0, 0); SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Wonder); break; case PostButtonSystem.DisLike: MainSectionButton.WeightSum = 4; SecondReactionButton.Visibility = ViewStates.Visible; SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_action_dislike, 0, 0, 0); SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Dislike); break; default: MainSectionButton.WeightSum = 3; SecondReactionButton.Visibility = ViewStates.Gone; break; } } var publisher = PostObject.Publisher ?? PostObject.UserData; if (publisher != null) { if (PostObject.PostPrivacy == "4") { Username.Text = GetText(Resource.String.Lbl_Anonymous); GlideImageLoader.LoadImage(this, "user_anonymous", UserAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); } else { GlideImageLoader.LoadImage(this, publisher.Avatar, UserAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var postDataDecoratedContent = new WoTextDecorator().SetupStrings(PostObject, this); Username.SetText(postDataDecoratedContent, TextView.BufferType.Spannable); } if (PostExtrasLayout != null) { PostExtrasLayout.Visibility = PostObject.IsPostBoosted == "0" ? ViewStates.Gone : ViewStates.Visible; } if (string.IsNullOrEmpty(PostObject.Orginaltext)) { if (Description.Visibility != ViewStates.Gone) { Description.Visibility = ViewStates.Gone; } } else { if (Description.Visibility != ViewStates.Visible) { Description.Visibility = ViewStates.Visible; } if (!Description.Text.Contains(GetText(Resource.String.Lbl_ReadMore)) && !Description.Text.Contains(GetText(Resource.String.Lbl_ReadLess))) { if (PostObject.RegexFilterList != null & PostObject.RegexFilterList?.Count > 0) { Description.SetAutoLinkOnClickListener(this, PostObject.RegexFilterList); } else { Description.SetAutoLinkOnClickListener(this, new Dictionary <string, string>()); } readMoreOption.AddReadMoreTo(Description, new String(PostObject.Orginaltext)); } else if (Description.Text.Contains(GetText(Resource.String.Lbl_ReadLess))) { readMoreOption.AddReadLess(Description, new String(PostObject.Orginaltext)); } else { Description.Text = PostObject.Orginaltext; } } bool success = int.TryParse(PostObject.Time, out var number); TimeText.Text = success ? Methods.Time.TimeAgo(number, false) : PostObject.Time; if (PrivacyPostIcon != null && !string.IsNullOrEmpty(PostObject.PostPrivacy) && publisher.UserId == UserDetails.UserId) { if (PostObject.PostPrivacy == "0") //Everyone { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.Globe); } else if (PostObject.PostPrivacy.Contains("ifollow") || PostObject.PostPrivacy == "2") //People_i_Follow { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.User); } else if (PostObject.PostPrivacy.Contains("me") || PostObject.PostPrivacy == "1") //People_Follow_Me { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.UserFriends); } else if (PostObject.PostPrivacy == "4") //Anonymous { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, PrivacyPostIcon, FontAwesomeIcon.UserSecret); } else //No_body) { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.Lock); } PrivacyPostIcon.Visibility = ViewStates.Visible; } if (CommentCount != null) { CommentCount.Text = PostObject.PostComments; } } if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PostObject.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); if (LikeCount != null) { LikeCount.Text = PostObject?.Reaction?.Count + " " + GetString(Resource.String.Btn_Likes); } if (PostObject.Reaction.IsReacted != null && PostObject.Reaction.IsReacted.Value) { if (!string.IsNullOrEmpty(PostObject.Reaction.Type)) { var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == PostObject.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); } } else { if (PostObject.IsLiked != null && PostObject.IsLiked.Value) { LikeButton.SetReactionPack(ReactConstants.Like); } if (LikeCount != null) { LikeCount.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostObject.PostLikes)) + " " + GetString(Resource.String.Btn_Likes); } if (SecondReactionButton != null) { switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostObject.IsWondered != null && PostObject.IsWondered.Value: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_wowonder); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#f89823")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#f89823"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Lbl_wondered); SecondReactionButton.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; } case PostButtonSystem.Wonder: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_wowonder); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#666666")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#666666"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Btn_Wonder); SecondReactionButton.SetTextColor(Color.ParseColor("#444444")); break; } case PostButtonSystem.DisLike when PostObject.IsWondered != null && PostObject.IsWondered.Value: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_dislike); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#f89823")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#f89823"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Lbl_disliked); SecondReactionButton.SetTextColor(Color.ParseColor("#f89823")); break; } case PostButtonSystem.DisLike: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_dislike); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#666666")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#666666"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Btn_Dislike); SecondReactionButton.SetTextColor(Color.ParseColor("#444444")); break; } } } } if (PostObject?.GetPostComments?.Count > 0) { var db = ClassMapper.Mapper?.Map <List <CommentObjectExtra> >(PostObject.GetPostComments); MAdapter.CommentList = new ObservableCollection <CommentObjectExtra>(db); } else { MAdapter.CommentList = new ObservableCollection <CommentObjectExtra>(); } MAdapter.NotifyDataSetChanged(); } } catch (Exception e) { Methods.DisplayReportResultTrack(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); } }
private static void LoadCommentData(CommentsArticlesObject item, RecyclerView.ViewHolder viewHolder, int position = 0) { try { if (!(viewHolder is ArticlesCommentAdapterViewHolder holder)) { return; } if (AppSettings.FlowDirectionRightToLeft) { holder.BubbleLayout.LayoutDirection = LayoutDirection.Rtl; } if (string.IsNullOrEmpty(item.Text) || string.IsNullOrWhiteSpace(item.Text)) { holder.CommentText.Visibility = ViewStates.Gone; } else { var description = Methods.FunString.DecodeString(item.Text); var readMoreOption = new StReadMoreOption.Builder() .TextLength(250, StReadMoreOption.TypeCharacter) .MoreLabel(ActivityContext.GetText(Resource.String.Lbl_ReadMore)) .LessLabel(ActivityContext.GetText(Resource.String.Lbl_ReadLess)) .MoreLabelColor(Color.ParseColor(AppSettings.MainColor)) .LessLabelColor(Color.ParseColor(AppSettings.MainColor)) .LabelUnderLine(true) .Build(); readMoreOption.AddReadMoreTo(holder.CommentText, new Java.Lang.String(description)); } holder.TimeTextView.Text = Methods.Time.TimeAgo(Convert.ToInt32(item.Posted), false); holder.UserName.Text = item.UserData.Name; GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var textHighLighter = item.UserData.Name; var textIsPro = string.Empty; if (item.UserData.Verified == "1") { textHighLighter += " " + IonIconsFonts.CheckmarkCircle; } if (item.UserData.IsPro == "1") { textIsPro = " " + IonIconsFonts.Flash; textHighLighter += textIsPro; } var decorator = TextDecorator.Decorate(holder.UserName, textHighLighter).SetTextStyle((int)TypefaceStyle.Bold, 0, item.UserData.Name.Length); if (item.UserData.Verified == "1") { decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircle); } if (item.UserData.IsPro == "1") { decorator.SetTextColor(Resource.Color.text_color_in_between, textIsPro); } decorator.Build(); if (item.Replies?.Count > 0) { holder.ReplyTextView.Text = ActivityContext.GetText(Resource.String.Lbl_Reply) + " " + "(" + item.Replies.Count + ")"; } if (item.IsCommentLiked) { holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked); holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.LikeTextView.Tag = "Liked"; } else { holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like); holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff"): Color.ParseColor("#000000")); holder.LikeTextView.Tag = "Like"; } holder.TimeTextView.Tag = "true"; if (holder.Image.HasOnClickListeners) { return; } var postEventListener = new ArticlesCommentClickListener(ActivityContext, Type); //Create an Event holder.MainView.LongClick += (sender, e) => postEventListener.MoreCommentReplyPostClick(new CommentReplyArticlesClickEventArgs { CommentObject = item, Position = position, View = holder.MainView }); holder.Image.Click += (sender, args) => postEventListener.ProfileClick(new CommentReplyArticlesClickEventArgs { Holder = holder, CommentObject = item, Position = position, View = holder.MainView }); switch (Type) { case "Comment": holder.ReplyTextView.Click += (sender, args) => ArticlesViewActivity.GetInstance()?.CommentReplyClick(item); break; case "Reply": holder.ReplyTextView.Click += (sender, args) => ArticlesViewActivity.GetInstance()?.ReplyOnReplyClick(item); break; } holder.LikeTextView.Click += delegate { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } if (holder.LikeTextView?.Tag?.ToString() == "Liked") { item.IsCommentLiked = false; holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like); holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme? Color.ParseColor("#ffffff"): Color.ParseColor("#000000")); holder.LikeTextView.Tag = "Like"; //sent api Dislike comment reply_like switch (Type) { case "Comment": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.LikeUnLikeCommentAsync(item.BlogId, item.Id, false) }); break; case "Reply": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.LikeUnLikeCommentAsync(item.BlogId, item.Id, false, "reply_like") }); break; } } else { item.IsCommentLiked = true; holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked); holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.LikeTextView.Tag = "Liked"; //sent api like comment switch (Type) { case "Comment": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.LikeUnLikeCommentAsync(item.BlogId, item.Id, true) }); break; case "Reply": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.LikeUnLikeCommentAsync(item.BlogId, item.Id, true, "reply_like") }); break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }; } catch (Exception e) { Methods.DisplayReportResultTrack(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 { 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); } }
private void Get_Data_Event() { try { if (EventData != null) { Glide.With(this).Load(EventData.Cover).Apply(new RequestOptions()).Into(ImageEventCover); Name = Methods.FunString.DecodeString(EventData.Name); TxtName.Text = Name; ToolbarLayout.Title = Name; SupportActionBar.Title = Name; if (string.IsNullOrEmpty(EventData.GoingCount)) { EventData.GoingCount = "0"; } if (string.IsNullOrEmpty(EventData.InterestedCount)) { EventData.InterestedCount = "0"; } TxtGoing.Text = EventData.GoingCount + " " + GetText(Resource.String.Lbl_GoingPeople); TxtInterested.Text = EventData.InterestedCount + " " + GetText(Resource.String.Lbl_InterestedPeople); TxtLocation.Text = EventData.Location; TxtStartDate.Text = EventData.StartDate; TxtEndDate.Text = EventData.EndDate; if (!string.IsNullOrEmpty(EventData.Description)) { var description = Methods.FunString.DecodeString(EventData.Description); 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(TxtDescriptionText, new String(description)); } else { TxtDescription.Visibility = ViewStates.Gone; TxtDescriptionText.Visibility = ViewStates.Gone; } if (EventData.IsGoing != null && EventData.IsGoing.Value) { BtnGo.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed); BtnGo.SetTextColor(Color.ParseColor("#ffffff")); BtnGo.Text = GetText(Resource.String.Lbl_Going); BtnGo.Tag = "true"; } else { BtnGo.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); BtnGo.SetTextColor(Color.ParseColor(AppSettings.MainColor)); BtnGo.Text = GetText(Resource.String.Lbl_Go); BtnGo.Tag = "false"; } if (EventData.IsInterested != null && EventData.IsInterested.Value) { BtnInterested.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed); BtnInterested.SetTextColor(Color.ParseColor("#ffffff")); BtnInterested.Text = GetText(Resource.String.Lbl_Interested); BtnInterested.Tag = "true"; } else { BtnInterested.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); BtnInterested.SetTextColor(Color.ParseColor(AppSettings.MainColor)); BtnInterested.Text = GetText(Resource.String.Lbl_Interested); BtnInterested.Tag = "false"; } //add post var checkSection = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AddPostBox); if (checkSection == null) { Combiner.AddPostBoxPostView("Event", -1, new PostDataObject() { Event = new EventUnion() { EventClass = EventData } }); PostFeedAdapter.NotifyItemInserted(PostFeedAdapter.ListDiffer.Count - 1); } StartApiService(); } } catch (Exception e) { Console.WriteLine(e); } }
private void Get_Data_Product(ProductDataObject productData) { try { ProductData = productData; PostData = new PostDataObject { PostId = productData.PostId, Product = new ProductUnion { ProductClass = productData, }, ProductId = productData.Id, UserId = productData.UserId, UserData = productData.Seller, Url = productData.Url, PostUrl = productData.Url, }; List <string> listImageUser = new List <string>(); if (productData.Images?.Count > 0) { listImageUser.AddRange(productData.Images.Select(t => t.Image)); } else { listImageUser.Add(productData.Images?[0]?.Image); } if (ViewPagerView.Adapter == null) { ViewPagerView.Adapter = new MultiImagePagerAdapter(this, listImageUser); ViewPagerView.CurrentItem = 0; CircleIndicatorView.SetViewPager(ViewPagerView); } ViewPagerView.Adapter.NotifyDataSetChanged(); GlideImageLoader.LoadImage(this, productData.Seller.Avatar, UserImageAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var(currency, currencyIcon) = WoWonderTools.GetCurrency(productData.Currency); TxtProductPrice.Text = productData.Price + " " + currencyIcon; Console.WriteLine(currency); var readMoreOption = new StReadMoreOption.Builder() .TextLength(200, 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(); if (Methods.FunString.StringNullRemover(productData.Description) != "Empty") { var description = Methods.FunString.DecodeString(productData.Description); readMoreOption.AddReadMoreTo(TxtProductDescription, new String(description)); } else { TxtProductDescription.Text = GetText(Resource.String.Lbl_Empty); } TxtProductLocation.Text = Methods.FunString.DecodeString(productData.Location); TxtProductCardName.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(productData.Seller), 14); TxtProductTime.Text = productData.TimeText; if (productData.Seller.UserId == UserDetails.UserId) { BtnContact.Visibility = ViewStates.Gone; } //Type == "0" >> New // Type != "0" Used TxtProductNew.Visibility = productData.Type == "0" ? ViewStates.Visible : ViewStates.Gone; // Status InStock TxtProductInStock.Visibility = productData.Status == "0" ? ViewStates.Visible : ViewStates.Gone; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }