Пример #1
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Style_LastActivities_View
         var itemView = LayoutInflater.From(parent.Context)
                        .Inflate(Resource.Layout.Style_LastActivities_View, parent, false);
         var vh = new LastActivities_AdapterViewHolder(itemView, OnClick, OnLongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Crashes.TrackError(exception);
         return(null);
     }
 }
Пример #2
0
        public void Initialize(LastActivities_AdapterViewHolder holder, Activities_Object.Activity item)
        {
            try
            {
                var AvatarSplit     = item.Activator.Avatar.Split('/').Last();
                var getImage_Avatar = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, AvatarSplit);
                if (getImage_Avatar != "File Dont Exists")
                {
                    if (holder.ActivitiesImage.Tag?.ToString() != "loaded")
                    {
                        ImageServiceLoader.Load_Image(holder.ActivitiesImage, "no_profile_image.png", getImage_Avatar, 5);
                        holder.ActivitiesImage.Tag = "loaded";
                    }
                }
                else
                {
                    if (holder.ActivitiesImage.Tag?.ToString() != "loaded")
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage, item.Activator.Avatar);
                        ImageServiceLoader.Load_Image(holder.ActivitiesImage, "no_profile_image.png", item.Activator.Avatar, 5);
                        holder.ActivitiesImage.Tag = "loaded";
                    }
                }

                if (item.ActivityType.Contains("wondered_post"))
                {
                    IMethods.Set_TextViewIcon("1", holder.Icon, IonIcons_Fonts.InformationCircled);
                }
                else if (item.ActivityType.Contains("liked_post"))
                {
                    IMethods.Set_TextViewIcon("1", holder.Icon, IonIcons_Fonts.Thumbsup);
                }
                else if (item.ActivityType.Contains("commented_post"))
                {
                    IMethods.Set_TextViewIcon("1", holder.Icon, IonIcons_Fonts.Chatboxes);
                }
                else
                {
                    IMethods.Set_TextViewIcon("1", holder.Icon, IonIcons_Fonts.AndroidNotifications);
                }

                string replace = "";
                if (item.ActivityText.Contains("commented on"))
                {
                    replace = item.ActivityText.Replace("commented on", this.Activity_Context.GetString(Resource.String.Lbl_CommentedOn))
                              .Replace("post", this.Activity_Context.GetString(Resource.String.Lbl_Post));
                }
                else if (item.ActivityText.Contains("reacted to"))
                {
                    replace = item.ActivityText.Replace("reacted to", this.Activity_Context.GetString(Resource.String.Lbl_ReactedTo))
                              .Replace("post", this.Activity_Context.GetString(Resource.String.Lbl_Post));
                }
                else if (item.ActivityText.Contains("started following"))
                {
                    replace = item.ActivityText.Replace("started following", this.Activity_Context.GetString(Resource.String.Lbl_StartedFollowing));
                }
                else if (item.ActivityText.Contains("become friends with"))
                {
                    replace = item.ActivityText.Replace("become friends with", this.Activity_Context.GetString(Resource.String.Lbl_BecomeFriendsWith));
                }
                else if (item.ActivityText.Contains("is following"))
                {
                    replace = item.ActivityText.Replace("is following", this.Activity_Context.GetString(Resource.String.Lbl_IsFollowing));
                }
                else if (item.ActivityText.Contains("liked"))
                {
                    replace = item.ActivityText.Replace("liked", this.Activity_Context.GetString(Resource.String.Btn_Liked))
                              .Replace("post", this.Activity_Context.GetString(Resource.String.Lbl_Post));
                }
                else if (item.ActivityText.Contains("wondered"))
                {
                    replace = item.ActivityText.Replace("wondered", this.Activity_Context.GetString(Resource.String.Lbl_wondered))
                              .Replace("post", this.Activity_Context.GetString(Resource.String.Lbl_Post));
                }
                else if (item.ActivityText.Contains("disliked"))
                {
                    replace = item.ActivityText.Replace("disliked", this.Activity_Context.GetString(Resource.String.Lbl_disliked))
                              .Replace("post", this.Activity_Context.GetString(Resource.String.Lbl_Post));
                }
                else if (item.ActivityText.Contains("shared"))
                {
                    replace = item.ActivityText.Replace("shared", this.Activity_Context.GetString(Resource.String.Lbl_shared))
                              .Replace("post", this.Activity_Context.GetString(Resource.String.Lbl_Post));
                }

                holder.Activities_event.Text = !string.IsNullOrEmpty(replace) ? replace : item.ActivityText;

                // holder.Username.Text = item.Activator.Name;
                holder.Username.Visibility = ViewStates.Gone;

                holder.Time.Text = IMethods.ITime.TimeAgo(int.Parse(item.Time));
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }