Ejemplo n.º 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);
            }
        }
        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);
            }
        }