コード例 #1
0
        private void InitComponent()
        {
            try
            {
                ViewPager = (ViewPager)FindViewById(Resource.Id.view_pager);

                TxtDescription = FindViewById <SuperTextView>(Resource.Id.tv_description);
                TxtDescription?.SetTextInfo(TxtDescription);

                ImgLike          = FindViewById <ImageView>(Resource.Id.image_like1);
                ImgWoWonder      = FindViewById <ImageView>(Resource.Id.image_wowonder);
                TxtCountLike     = FindViewById <TextView>(Resource.Id.LikeText1);
                TxtCountWoWonder = FindViewById <TextView>(Resource.Id.WoWonderTextCount);

                MainLayout                = FindViewById <RelativeLayout>(Resource.Id.main);
                InfoImageLiner            = FindViewById <LinearLayout>(Resource.Id.infoImageLiner);
                InfoImageLiner.Visibility = ViewStates.Visible;

                BtnCountLike     = FindViewById <LinearLayout>(Resource.Id.linerlikeCount);
                BtnCountWoWonder = FindViewById <LinearLayout>(Resource.Id.linerwowonderCount);

                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.ReactButton);

                ShareText = FindViewById <TextView>(Resource.Id.ShareText);

                if (!AppSettings.ShowTextShareButton && ShareText != null)
                {
                    ShareText.Visibility = ViewStates.Gone;
                }

                if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine || AppSettings.PostButton == PostButtonSystem.Like)
                {
                    MainSectionButton.WeightSum = 3;
                    BtnWonder.Visibility        = ViewStates.Gone;

                    TxtCountWoWonder.Visibility = ViewStates.Gone;
                    BtnCountWoWonder.Visibility = ViewStates.Gone;
                    ImgWoWonder.Visibility      = ViewStates.Gone;
                }
                else if (AppSettings.PostButton == PostButtonSystem.Wonder)
                {
                    MainSectionButton.WeightSum = 4;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    TxtCountWoWonder.Visibility = ViewStates.Visible;
                    BtnCountWoWonder.Visibility = ViewStates.Visible;
                    ImgWoWonder.Visibility      = ViewStates.Visible;

                    ImgWoWonder.SetImageResource(Resource.Drawable.ic_action_wowonder);
                    ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder);
                    TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Wonder);
                }
                else if (AppSettings.PostButton == PostButtonSystem.DisLike)
                {
                    MainSectionButton.WeightSum = 4;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    TxtCountWoWonder.Visibility = ViewStates.Visible;
                    BtnCountWoWonder.Visibility = ViewStates.Visible;
                    ImgWoWonder.Visibility      = ViewStates.Visible;

                    ImgWoWonder.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)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
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);
            }
        }
コード例 #5
0
        private void InitComponent()
        {
            try
            {
                PageImage      = FindViewById <ImageViewTouch>(Resource.Id.imageview);
                TxtDescription = FindViewById <TextView>(Resource.Id.tv_description);
                ImgLike        = FindViewById <ImageView>(Resource.Id.image_like1);
                ImgWoWonder    = FindViewById <ImageView>(Resource.Id.image_wowonder);

                TxtCountLike     = FindViewById <TextView>(Resource.Id.LikeText1);
                TxtCountWoWonder = FindViewById <TextView>(Resource.Id.WoWonderTextCount);

                MainLayout                = FindViewById <RelativeLayout>(Resource.Id.main);
                InfoImageLiner            = FindViewById <LinearLayout>(Resource.Id.infoImageLiner);
                InfoImageLiner.Visibility = ViewStates.Visible;

                BtnCountLike     = FindViewById <LinearLayout>(Resource.Id.linerlikeCount);
                BtnCountWoWonder = FindViewById <LinearLayout>(Resource.Id.linerwowonderCount);

                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);

                // set the default image display type
                // PageImage.SetDisplayType(ImageViewTouchBase.DisplayType.FitIfBigger);

                LikeButton = FindViewById <ReactButton>(Resource.Id.beactButton);
                LikeButton.SetTextColor(Color.White);

                ShareText = FindViewById <TextView>(Resource.Id.ShareText);
                if (!AppSettings.ShowTextShareButton && ShareText != null)
                {
                    ShareText.Visibility = ViewStates.Gone;
                }

                if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine || AppSettings.PostButton == PostButtonSystem.Like)
                {
                    MainSectionButton.WeightSum = 3;
                    BtnWonder.Visibility        = ViewStates.Gone;

                    TxtCountWoWonder.Visibility = ViewStates.Gone;
                    BtnCountWoWonder.Visibility = ViewStates.Gone;
                    ImgWoWonder.Visibility      = ViewStates.Gone;
                }
                else if (AppSettings.PostButton == PostButtonSystem.Wonder)
                {
                    MainSectionButton.WeightSum = 4;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    TxtCountWoWonder.Visibility = ViewStates.Visible;
                    BtnCountWoWonder.Visibility = ViewStates.Visible;
                    ImgWoWonder.Visibility      = ViewStates.Visible;

                    ImgWoWonder.SetImageResource(Resource.Drawable.ic_action_wowonder);
                    ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder);
                    TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Wonder);
                }
                else if (AppSettings.PostButton == PostButtonSystem.DisLike)
                {
                    MainSectionButton.WeightSum = 4;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    TxtCountWoWonder.Visibility = ViewStates.Visible;
                    BtnCountWoWonder.Visibility = ViewStates.Visible;
                    ImgWoWonder.Visibility      = ViewStates.Visible;

                    ImgWoWonder.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);
            }
        }
コード例 #6
0
        //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);
            }
        }
コード例 #7
0
        //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);
            }
        }
コード例 #8
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);
            }
        }
コード例 #9
0
        //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);
            }
        }
コード例 #10
0
        private void InitComponent()
        {
            try
            {
                PageImage      = FindViewById <ImageViewTouch>(Resource.Id.imageview);
                TxtDescription = FindViewById <SuperTextView>(Resource.Id.tv_description);
                TxtDescription?.SetTextInfo(TxtDescription);

                ImgLike     = FindViewById <ImageView>(Resource.Id.image_like1);
                ImgWoWonder = FindViewById <ImageView>(Resource.Id.image_wowonder);

                TxtCountLike     = FindViewById <TextView>(Resource.Id.LikeText1);
                TxtCountWoWonder = FindViewById <TextView>(Resource.Id.WoWonderTextCount);

                ShareCount   = FindViewById <TextView>(Resource.Id.Sharecount);
                CommentCount = FindViewById <TextView>(Resource.Id.Commentcount);

                MainLayout                = FindViewById <RelativeLayout>(Resource.Id.main);
                InfoImageLiner            = FindViewById <LinearLayout>(Resource.Id.infoImageLiner);
                InfoImageLiner.Visibility = ViewStates.Visible;

                BtnCountLike     = FindViewById <LinearLayout>(Resource.Id.linerlikeCount);
                BtnCountWoWonder = FindViewById <LinearLayout>(Resource.Id.linerwowonderCount);

                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);

                // set the default image display type
                // PageImage.SetDisplayType(ImageViewTouchBase.DisplayType.FitIfBigger);

                LikeButton = FindViewById <ReactButton>(Resource.Id.ReactButton);
                LikeButton.SetTextColor(Color.ParseColor("#C3C7D0"));

                ShareText            = FindViewById <TextView>(Resource.Id.ShareText);
                ShareText.Visibility = AppSettings.ShowTextShareButton switch
                {
                    false when ShareText != null => ViewStates.Gone,
                               _ => ShareText.Visibility
                };

                switch (AppSettings.PostButton)
                {
                case PostButtonSystem.ReactionDefault:
                case PostButtonSystem.ReactionSubShine:
                case PostButtonSystem.Like:
                    MainSectionButton.WeightSum = 5;
                    BtnWonder.Visibility        = ViewStates.Gone;

                    TxtCountWoWonder.Visibility = ViewStates.Gone;
                    BtnCountWoWonder.Visibility = ViewStates.Gone;
                    ImgWoWonder.Visibility      = ViewStates.Gone;
                    break;

                case PostButtonSystem.Wonder:
                    MainSectionButton.WeightSum = 4;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    TxtCountWoWonder.Visibility = ViewStates.Visible;
                    BtnCountWoWonder.Visibility = ViewStates.Visible;
                    ImgWoWonder.Visibility      = ViewStates.Visible;

                    ImgWoWonder.SetImageResource(Resource.Drawable.ic_action_wowonder);
                    ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder);
                    TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Wonder);
                    break;

                case PostButtonSystem.DisLike:
                    MainSectionButton.WeightSum = 4;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    TxtCountWoWonder.Visibility = ViewStates.Visible;
                    BtnCountWoWonder.Visibility = ViewStates.Visible;
                    ImgWoWonder.Visibility      = ViewStates.Visible;

                    ImgWoWonder.SetImageResource(Resource.Drawable.ic_action_dislike);
                    ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike);
                    TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Dislike);
                    break;
                }

                BtnShare.Visibility = AppSettings.ShowShareButton switch
                {
                    false when BtnShare != null => ViewStates.Gone,
                               _ => BtnShare.Visibility
                };
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
コード例 #11
0
        //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);
            }
        }