コード例 #1
0
ファイル: ReplyAdapter.cs プロジェクト: projectsoca/onefete
        public ReplyAdapterViewHolder(View itemView, Action <ReplyAdapterClickEventArgs> clickListener, Action <ReplyAdapterClickEventArgs> longClickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                Image        = MainView.FindViewById <CircleImageView>(Resource.Id.card_pro_pic);
                CommentText  = MainView.FindViewById <AutoLinkTextView>(Resource.Id.active);
                LikeIcon     = MainView.FindViewById <ImageView>(Resource.Id.likeIcon);
                TimeTextView = MainView.FindViewById <TextView>(Resource.Id.time);
                LikeCount    = MainView.FindViewById <TextView>(Resource.Id.Like);
                ReplyButton  = MainView.FindViewById <TextView>(Resource.Id.reply);

                ReplyButton.Text       = MainView.Context.GetString(Resource.String.Lbl_Reply);
                ReplyButton.Visibility = ViewStates.Gone;

                if (AppSettings.SetTabDarkTheme)
                {
                    LikeIcon.SetBackgroundResource(Resource.Drawable.Shape_Circle_Black);
                }

                //Event
                itemView.Click += (sender, e) => clickListener(new ReplyAdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
        private void GetReply()
        {
            try
            {
                if (UserinfoComment != null)
                {
                    TextSanitizer changer = new TextSanitizer(CommentText, Activity);
                    changer.Load(Methods.FunString.DecodeString(UserinfoComment.Text));

                    TimeTextView.Text = Methods.Time.TimeAgo(Convert.ToInt32(UserinfoComment.Time));

                    GlideImageLoader.LoadImage(Activity, UserinfoComment.Avatar, Image, ImageStyle.CircleCrop, ImagePlaceholders.Color);

                    ReplyButton.Visibility = ViewStates.Invisible;

                    LikeCount.Text = Activity.GetString(Resource.String.Lbl_Likes) + " " + "(" + UserinfoComment.Likes + ")";
                    LikeIcon.SetImageResource(UserinfoComment.IsLiked ? Resource.Drawable.ic_action_like_2 : Resource.Drawable.ic_action_like_1);
                }

                StartApiService();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #3
0
        public void DisplayData(string fullname, string description, string avatar, string time, string videofile, int likesCount, bool isliked, bool isSaved, int votesCount)
        {
            try
            {
                Fullname.Text     = fullname;
                TimeTextView.Text = time;
                GlideImageLoader.LoadImage(Activity, avatar, UserAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                var textSanitizer = new TextSanitizer(Description, Activity);

                if (!string.IsNullOrEmpty(description))
                {
                    ReadMoreOption.AddReadMoreTo(Description, Methods.FunString.DecodeString(description));
                    textSanitizer.Load(Methods.FunString.DecodeString(description));
                }
                else
                {
                    Description.Visibility = ViewStates.Gone;
                }

                CommentIcon.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#888888") : Color.ParseColor("#444444"));

                LikeCount.Text = likesCount + " " + Context.GetText(Resource.String.Lbl_Likes);
                LikeIcon.Tag   = "Like";

                if (isliked)
                {
                    LikeIcon.SetTextColor(Color.ParseColor("#ed4856"));
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, LikeIcon, IonIconsFonts.IosHeart);
                    LikeIcon.Tag = "Liked";
                }

                if (!isSaved)
                {
                    Favicon.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#888888") : Color.ParseColor("#444444"));
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, Favicon, IonIconsFonts.IosStarOutline);
                    Favicon.Tag = "Add";
                }
                else
                {
                    Favicon.SetTextColor(Color.ParseColor("#FFCE00"));
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, Favicon, IonIconsFonts.AndroidStar);
                    Favicon.Tag = "Added";
                }


                CommentCount.Text = votesCount + " " + Context.GetText(Resource.String.Lbl_Comments);

                if (votesCount <= 4)
                {
                    ViewCommentsButton.Visibility = ViewStates.Gone;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #4
0
        private void LikeIconOnClick(object sender, EventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                }
                else
                {
                    UserinfoComment.IsLiked = !UserinfoComment.IsLiked;

                    LikeIcon.SetImageResource(UserinfoComment.IsLiked  ? Resource.Drawable.ic_action_like_2 : Resource.Drawable.ic_action_like_1);
                    //LikeIcon.StartAnimation(animationScale);

                    RequestsAsync.Post.LikeComment(UserinfoComment.Id.ToString()).ConfigureAwait(false);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
コード例 #5
0
        private void InitComponent(View view)
        {
            try
            {
                Image        = view.FindViewById <CircleImageView>(Resource.Id.card_pro_pic);
                CommentText  = view.FindViewById <AutoLinkTextView>(Resource.Id.active);
                LikeIcon     = view.FindViewById <ImageView>(Resource.Id.likeIcon);
                TimeTextView = view.FindViewById <TextView>(Resource.Id.time);
                LikeCount    = view.FindViewById <TextView>(Resource.Id.Like);
                ReplyButton  = view.FindViewById <TextView>(Resource.Id.reply);

                RootView             = view.FindViewById <RelativeLayout>(Resource.Id.root);
                EmojiIcon            = view.FindViewById <AppCompatImageView>(Resource.Id.emojiicon);
                EmojIconEditTextView = view.FindViewById <EmojiconEditText>(Resource.Id.EmojiconEditText5);
                SendButton           = view.FindViewById <CircleButton>(Resource.Id.sendButton);
                ViewboxText          = view.FindViewById <TextView>(Resource.Id.viewbox);
                ViewboxText.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                MRecycler        = (RecyclerView)view.FindViewById(Resource.Id.recyler);
                EmptyStateLayout = view.FindViewById <ViewStub>(Resource.Id.viewStub);

                EmojIconEditTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Gray);
                EmojIconEditTextView.SetHintTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Gray);

                EmojIconActions emojis = new EmojIconActions(Activity, RootView, EmojIconEditTextView, EmojiIcon);
                emojis.ShowEmojIcon();

                if (AppSettings.SetTabDarkTheme)
                {
                    LikeIcon.SetBackgroundResource(Resource.Drawable.Shape_Circle_Black);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }