Exemplo n.º 1
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is InviteMembersAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        holder.Name.Text  = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 25);
                        holder.About.Text = item.UserId == UserDetails.UserId ? ActivityContext.GetString(Resource.String.Lbl_Online) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(item.LastseenUnixTime), false);

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

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

                        if (item.UserId == UserDetails.UserId)
                        {
                            holder.ButtonMore.Visibility = ViewStates.Gone;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemplo n.º 2
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is RecentDonationAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);

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

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

                        holder.About.Text = AppSettings.CurrencyFundingPriceStatic + item.Amount + " " + Methods.Time.TimeAgo(Convert.ToInt32(item.Time), true);

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

                        WoWonderTools.SetAddFriendCondition(item.UserData.IsFollowing, holder.Button);
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemplo n.º 3
0
        private void Initialize(MembersAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

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

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

                holder.About.Text = users.UserId == UserDetails.UserId ? ActivityContext.GetString(Resource.String.Lbl_Online): ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(users.LastseenUnixTime), false);

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


                if (users.UserId == UserDetails.UserId)
                {
                    holder.ButtonMore.Visibility = ViewStates.Gone;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case NearByAdapterViewHolder holder:
                {
                    var users = UserList[position];
                    switch (users)
                    {
                    case null:
                        return;
                    }

                    GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Color);

                    var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(users.LastseenUnixTime), users.LastseenStatus);

                    switch (online)
                    {
                    //Online Or offline
                    case true:
                        //Online
                        holder.ImageOnline.SetImageResource(Resource.Drawable.Green_Color);
                        holder.LastTimeOnline.Text = ActivityContext.GetString(Resource.String.Lbl_Online);
                        break;

                    default:
                        holder.ImageOnline.SetImageResource(Resource.Drawable.Grey_Offline);
                        holder.LastTimeOnline.Text = Methods.Time.TimeAgo(Convert.ToInt32(users.LastseenUnixTime), false);
                        break;
                    }

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

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

                    WoWonderTools.SetAddFriendCondition(users.IsFollowing, holder.Button);
                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemplo n.º 5
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);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case PokesAdapterViewHolder holder:
                {
                    var item = PokeList[position];
                    if (item != null)
                    {
                        if (item.UserData?.UserDataClass != null)
                        {
                            GlideImageLoader.LoadImage(ActivityContext, item.UserData?.UserDataClass.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);
                            holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item.UserData?.UserDataClass), 20);

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

                            holder.About.Text = ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(item.UserData?.UserDataClass.LastseenUnixTime), false);

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

                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_PokeBack);
                        holder.BindEvents(position, item, holder.Button, PokeItemClickListener);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is NearByAdapterViewHolder holder)
                {
                    var users = UserList[position];
                    if (users == null)
                    {
                        return;
                    }

                    try
                    {
                        GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Color);

                        var online = WoWonderTools.GetStatusOnline(int.Parse(users.LastseenUnixTime), users.LastseenStatus);

                        //Online Or offline
                        if (online)
                        {
                            //Online
                            holder.ImageOnline.SetImageResource(Resource.Drawable.Green_Color);
                            holder.LastTimeOnline.Text = ActivityContext.GetString(Resource.String.Lbl_Online);
                        }
                        else
                        {
                            holder.ImageOnline.SetImageResource(Resource.Drawable.Grey_Offline);
                            holder.LastTimeOnline.Text = Methods.Time.TimeAgo(int.Parse(users.LastseenUnixTime));
                        }

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

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

                        if (users.IsFollowing == "1" || users.IsFollowing == "yes" || users.IsFollowing == "Yes") // My Friend
                        {
                            holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                            holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                            holder.Button.Text = ActivityContext.GetText(AppSettings.ConnectivitySystem == 1 ? Resource.String.Lbl_Following : Resource.String.Lbl_Friends);
                            holder.Button.Tag  = "friends";
                        }
                        else //Not Friend
                        {
                            holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                            holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                            holder.Button.Text = ActivityContext.GetText(AppSettings.ConnectivitySystem == 1 ? Resource.String.Lbl_Follow : Resource.String.Lbl_AddFriends);
                            holder.Button.Tag  = "false";
                        }

                        if (!holder.Button.HasOnClickListeners)
                        {
                            holder.Button.Click += (sender, args) =>
                            {
                                try
                                {
                                    if (!Methods.CheckConnectivity())
                                    {
                                        Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_CheckYourInternetConnection),
                                                       ToastLength.Short).Show();
                                    }
                                    else
                                    {
                                        NotifyItemChanged(viewHolder.AdapterPosition, holder.Button.Tag.ToString() == "false" ? "true" : "false");

                                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                            () => RequestsAsync.Global.Follow_User(users.UserId)
                                        });
                                    }
                                }
                                catch (Exception e)
                                {
                                    Console.WriteLine(e);
                                }
                            }
                        }
                        ;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void Initialize(ContactsAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                if (users.Avatar == "addImage")
                {
                    holder.ImageLastseen.Visibility = ViewStates.Gone;
                }

                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

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

                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), 35) : 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);
                if (online)
                {
                    holder.ImageLastseen.SetImageResource(Resource.Drawable.Green_Online);
                    if (AppSettings.ShowOnlineOfflineMessage)
                    {
                        var data = ListOnline.Contains(users.Name);
                        if (data == false)
                        {
                            ListOnline.Add(users.Name);

                            Toast toast = Toast.MakeText(ActivityContext, users.Name + " " + ActivityContext.GetString(Resource.String.Lbl_Online), ToastLength.Short);
                            toast.SetGravity(GravityFlags.Center, 0, 0);
                            toast.Show();
                        }
                    }
                }
                else
                {
                    holder.ImageLastseen.SetImageResource(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);
            }
        }