Exemple #1
0
        public static void SetReactionPack(CommentAdapterViewHolder holder, string React)
        {
            try
            {
                var MReactionPack = XReactions.GetReactions();

                var data = MReactionPack?.FirstOrDefault(a => a.GetReactText() == React);
                if (data != null)
                {
                    holder.LikeTextView.Text = data.GetReactText();
                    holder.LikeTextView.SetTextColor(Color.ParseColor(data.GetReactTextColor()));
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public static void SetReactionPack(CommentAdapterViewHolder holder, string react)
        {
            try
            {
                var mReactionPack = XReactions.GetReactions();

                var data = mReactionPack?.FirstOrDefault(a => a.GetReactText() == react);
                if (data != null)
                {
                    holder.LikeTextView.Text = data.GetReactText();
                    holder.LikeTextView.SetTextColor(Color.ParseColor(data.GetReactTextColor()));
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #3
0
        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);
            }
        }
        //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);
            }
        }
Exemple #5
0
        //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);
            }
        }