private void Initialize(NotificationsAdapterViewHolder holder, Notification notify)
        {
            try
            {
                if (notify.Type == "memory")
                {
                    Glide.With(ActivityContext).Load(Resource.Mipmap.icon).Apply(new RequestOptions().CircleCrop()).Into(holder.ImageUser);
                    holder.UserNameNotfy.Text = AppSettings.ApplicationName;
                }
                else
                {
                    GlideImageLoader.LoadImage(ActivityContext, notify.Notifier?.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    holder.UserNameNotfy.Text = WoWonderTools.GetNameFinal(notify.Notifier);
                }

                AddIconFonts(holder, notify.Type, notify.Icon);

                var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor(GetColorFonts(notify.Type, notify.Icon)));
                holder.Image.SetImageDrawable(drawable);

                if (notify.Type == "share_post" || notify.Type == "shared_your_post")
                {
                    holder.TextNotfy.Text = ActivityContext.GetText(Resource.String.Lbl_sharedYourPost);
                }
                else
                {
                    holder.TextNotfy.Text = notify.TypeText;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 2
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Notifications_view
         var itemView = LayoutInflater.From(parent.Context)?.Inflate(Resource.Layout.Style_Notifications_view, parent, false);
         var vh       = new NotificationsAdapterViewHolder(itemView, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Console.WriteLine("EX:ALLEN Notifications >> " + exception);
         return(null !);
     }
 }
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Notifications_view
         var itemView = LayoutInflater.From(parent.Context)?.Inflate(Resource.Layout.Style_Notifications_view, parent, false);
         var vh       = new NotificationsAdapterViewHolder(itemView, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
         return(null !);
     }
 }
        private void Initialize(NotificationsAdapterViewHolder holder, NotificationObject notify)
        {
            try
            {
                switch (notify.Type)
                {
                case "memory":
                    Glide.With(ActivityContext).Load(Resource.Mipmap.icon).Apply(new RequestOptions().CircleCrop()).Into(holder.ImageUser);
                    holder.UserNameNotfy.Text = AppSettings.ApplicationName;
                    break;

                default:
                {
                    GlideImageLoader.LoadImage(ActivityContext, notify.Notifier?.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                    var name = WoWonderTools.GetNameFinal(notify.Notifier);

                    string tempString = notify.Type == "share_post" || notify.Type == "shared_your_post"
                            ? name + " " + ActivityContext.GetText(Resource.String.Lbl_sharedYourPost)
                            : name + " " + notify.TypeText;
                    try
                    {
                        SpannableString spanString = new SpannableString(tempString);
                        spanString.SetSpan(new StyleSpan(TypefaceStyle.Bold), 0, name.Length, 0);

                        holder.UserNameNotfy.SetText(spanString, TextView.BufferType.Spannable);
                    }
                    catch
                    {
                        holder.UserNameNotfy.Text = tempString;
                    }

                    break;
                }
                }

                holder.TextNotfy.Text = Methods.Time.TimeAgo(Convert.ToInt32(notify.Time), false);

                AddIconFonts(holder, notify.Type, notify.Icon);

                var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor(GetColorFonts(notify.Type, notify.Icon)));
                holder.Image.SetImageDrawable(drawable);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 5
0
        private void AddIconFonts(NotificationsAdapterViewHolder holder, string type, string icon)
        {
            try
            {
                if (type == "following")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.PersonAdd);
                    return;
                }

                if (type == "memory")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Time);
                    return;
                }

                if (type == "comment" || type == "comment_reply" || type == "also_replied")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.IosChatboxes);
                    return;
                }

                if (type == "liked_post" || type == "liked_comment" || type == "liked_reply_comment" ||
                    type == "liked_page")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.ThumbsUp);
                    return;
                }

                if (type == "wondered_post" || type == "wondered_comment" || type == "wondered_reply_comment" ||
                    type == "exclamation-circle")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Information);
                    return;
                }

                if (type == "comment_mention" || type == "comment_reply_mention")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Pricetag);
                    return;
                }

                if (type == "post_mention")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.At);
                    return;
                }

                if (type == "share_post" || type == "shared_your_post")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.ShareAlt);
                    return;
                }

                if (type == "profile_wall_post")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Image);
                    return;
                }

                if (type == "visited_profile")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Eye);
                    return;
                }

                if (type == "joined_group" || type == "accepted_invite" || type == "accepted_request" ||
                    type == "accepted_join_request")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Checkmark);
                    return;
                }

                if (type == "invited_page")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Flag);
                    return;
                }

                if (type == "added_you_to_group")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Add);
                    return;
                }

                if (type == "requested_to_join_group")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Timer);
                    return;
                }

                if (type == "thumbs-down")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.ThumbsDown);
                    return;
                }

                if (type == "going_event")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Calendar);
                    return;
                }

                if (type == "viewed_story")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Aperture);
                    return;
                }

                if (type == "reaction")
                {
                    var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == icon).Value?.Id ?? "";
                    switch (react)
                    {
                    case "like":
                    case "1":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.ThumbsUp);
                        break;

                    case "haha":
                    case "3":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Happy);
                        break;

                    case "love":
                    case "2":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Heart);
                        break;

                    case "wow":
                    case "4":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Information);
                        break;

                    case "sad":
                    case "5":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Sad);
                        break;

                    case "angry":
                    case "6":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.LogoFreebsdDevil);
                        break;

                    default:
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Notifications);
                        break;
                    }
                }
                else
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Notifications);
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Notifications);
            }
        }
        private void AddIconFonts(NotificationsAdapterViewHolder holder, string type, string icon)
        {
            try
            {
                if (type == "following")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.PersonAdd);
                    return;
                }

                if (type == "memory")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.AndroidTime);
                    return;
                }

                if (type == "comment" || type == "comment_reply" || type == "also_replied")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.IosChatboxes);
                    return;
                }

                if (type == "liked_post" || type == "liked_comment" || type == "liked_reply_comment" ||
                    type == "liked_page")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Thumbsup);
                    return;
                }

                if (type == "wondered_post" || type == "wondered_comment" || type == "wondered_reply_comment" ||
                    type == "exclamation-circle")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Information);
                    return;
                }

                if (type == "comment_mention" || type == "comment_reply_mention")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Pricetag);
                    return;
                }

                if (type == "post_mention")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.At);
                    return;
                }

                if (type == "share_post" || type == "shared_your_post")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.AndroidShareAlt);
                    return;
                }

                if (type == "profile_wall_post")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Image);
                    return;
                }

                if (type == "visited_profile")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Eye);
                    return;
                }

                if (type == "joined_group" || type == "accepted_invite" || type == "accepted_request" ||
                    type == "accepted_join_request")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Checkmark);
                    return;
                }

                if (type == "invited_page")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Flag);
                    return;
                }

                if (type == "added_you_to_group")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.AndroidAdd);
                    return;
                }

                if (type == "requested_to_join_group")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.IosTimerOutline);
                    return;
                }

                if (type == "thumbs-down")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Thumbsdown);
                    return;
                }

                if (type == "going_event")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Calendar);
                    return;
                }

                if (type == "viewed_story")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Aperture);
                    return;
                }

                if (type == "reaction")
                {
                    switch (icon)
                    {
                    case "like":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Thumbsup);
                        break;

                    case "haha":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Happy);
                        break;

                    case "love":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Heart);
                        break;

                    case "wow":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.Information);
                        break;

                    case "sad":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.SadOutline);
                        break;

                    case "angry":
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.SocialFreebsdDevil);
                        break;

                    default:
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.AndroidNotifications);
                        break;
                    }
                }
                else
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.AndroidNotifications);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotfy, IonIconsFonts.AndroidNotifications);
            }
        }