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);
            }
        }
Beispiel #2
0
        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);

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

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