Beispiel #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_HContact_view
         var itemView = LayoutInflater.From(parent.Context)?.Inflate(Resource.Layout.Style_HContact_view, parent, false);
         var vh       = new ContactsAdapterViewHolder(itemView, FollowButtonClick, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
         return(null !);
     }
 }
Beispiel #2
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Style_HContact_view
         var itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_HContact_view, parent, false);
         var vh       = new ContactsAdapterViewHolder(itemView, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         return(null);
     }
 }
Beispiel #3
0
        private void Initialize(ContactsAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);

                holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 20);

                switch (users.Verified)
                {
                case "1":
                    holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                    break;
                }

                switch (Type)
                {
                case TypeTextSecondary.None:
                    holder.About.Visibility = ViewStates.Gone;
                    break;

                default:
                    holder.About.Text = Type == TypeTextSecondary.About ? Methods.FunString.SubStringCutOf(WoWonderTools.GetAboutFinal(users), 25) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(users.LastseenUnixTime), true);
                    break;
                }

                //Online Or offline
                var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(users.LastseenUnixTime), users.LastseenStatus);
                holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);

                switch (ShowButton)
                {
                case false:
                    return;

                default:
                    WoWonderTools.SetAddFriendCondition(users.IsFollowing, holder.Button);
                    break;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Beispiel #4
0
        private void Initialize(ContactsAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);

                holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 20);

                if (users.Verified == "1")
                {
                    holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                }

                if (Type == TypeTextSecondary.None)
                {
                    holder.About.Visibility = ViewStates.Gone;
                }
                else
                {
                    holder.About.Text = Type == TypeTextSecondary.About ? Methods.FunString.SubStringCutOf(WoWonderTools.GetAboutFinal(users), 25) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(int.Parse(users.LastseenUnixTime), true);
                }

                //Online Or offline
                var online = WoWonderTools.GetStatusOnline(int.Parse(users.LastseenUnixTime), users.LastseenStatus);
                holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);

                if (ShowButton)
                {
                    switch (users.IsFollowing)
                    {
                    // My Friend
                    case "1":
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                        }
                        holder.Button.Tag = "true";
                        break;
                    }

                    // Request
                    case "2":
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor("#444444"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Request);
                        holder.Button.Tag  = "Request";
                        break;

                    //Not Friend
                    case "0":
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Follow);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_AddFriends);
                        }
                        holder.Button.Tag = "false";

                        var dbDatabase = new SqLiteDatabase();
                        dbDatabase.Delete_UsersContact(users.UserId);
                        dbDatabase.Dispose();
                        break;
                    }

                    default:
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                        }

                        users.IsFollowing = "1";
                        holder.Button.Tag = "true";
                        break;
                    }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }