public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is MentionAdapterViewHolder holder)
                {
                    var item = MentionList[position];
                    if (item != null)
                    {
                        holder.CheckBox.Checked = item.Selected;
                        holder.CheckBox.SetOnCheckedChangeListener(null);

                        if (!holder.MainView.HasOnClickListeners)
                        {
                            holder.MainView.Click += (sender, args) =>
                            {
                                if (holder.CheckBox.Checked)
                                {
                                    holder.CheckBox.Checked = false;
                                    item.Selected           = false;
                                    NotifyItemChanged(position);
                                }
                                else
                                {
                                    holder.CheckBox.Checked = true;
                                    item.Selected           = true;
                                    NotifyItemChanged(position);
                                }
                            }
                        }
                        ;

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

                        holder.Name.Text  = AppTools.GetNameFinal(item);
                        holder.About.Text = Methods.FunString.SubStringCutOf(AppTools.GetAboutFinal(item), 25);
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Exemplo n.º 2
0
        private async void LoadProfile()
        {
            try
            {
                //var dataUser = new SqLiteDatabase().GetMyProfile();

                if (ListUtils.MyProfileList.Count == 0)
                {
                    await ApiRequest.GetProfile_Api(Activity);
                }

                var data = ListUtils.MyProfileList.FirstOrDefault();
                if (data != null)
                {
                    GlideImageLoader.LoadImage(Activity, data.Avatar, UserProfileImage, ImageStyle.RoundedCrop, ImagePlaceholders.Color);

                    TxtName.Text     = AppTools.GetNameFinal(data);
                    TxtUsername.Text = data.Username;

                    TextSanitizerAutoLink.Load(AppTools.GetAboutFinal(data));

                    TxtCountFav.Text = Methods.FunString.FormatPriceValue(Int32.Parse(data.Favourites));

                    IconVerified.Visibility = data.Verified == "1" ? ViewStates.Visible : ViewStates.Gone;

                    IconBusiness.Visibility = data.BusinessAccount == "1" ? ViewStates.Visible : ViewStates.Gone;

                    if (data.Followers != null && int.TryParse(data.Followers, out var numberFollowers))
                    {
                        TxtCountFollowers.Text = Methods.FunString.FormatPriceValue(numberFollowers);
                    }

                    if (data.Following != null && int.TryParse(data.Following, out var numberFollowing))
                    {
                        TxtCountFollowing.Text = Methods.FunString.FormatPriceValue(numberFollowing);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 3
0
        public void LoadUserData(UserDataObject cl, bool friends = true)
        {
            try
            {
                PPrivacy = cl.PPrivacy;

                GlideImageLoader.LoadImage(Activity, cl.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Color);

                AboutTab.TextSanitizerAutoLink.Load(AppTools.GetAboutFinal(cl));
                AboutTab.TxtGender.Text = cl.Gender;
                AboutTab.TxtEmail.Text  = cl.Email;
                if (string.IsNullOrEmpty(cl.Website))
                {
                    AboutTab.WebsiteLinearLayout.Visibility = ViewStates.Gone;
                }
                else
                {
                    AboutTab.TxtWebsite.Text = cl.Website;
                    AboutTab.WebsiteLinearLayout.Visibility = ViewStates.Visible;
                }

                TxtUserName.Text = "@" + cl.Username;

                var font = Typeface.CreateFromAsset(Application.Context.Resources.Assets, "ionicons.ttf");
                TxtFullName.SetTypeface(font, TypefaceStyle.Normal);

                var textHighLighter = AppTools.GetNameFinal(cl);

                if (cl.Verified == "1")
                {
                    textHighLighter += " " + IonIconsFonts.CheckmarkCircled;
                }

                if (cl.BusinessAccount == "1")
                {
                    textHighLighter += " " + IonIconsFonts.SocialUsd;
                }

                var decorator = TextDecorator.Decorate(TxtFullName, textHighLighter);

                if (cl.Verified == "1")
                {
                    decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircled);
                }

                if (cl.BusinessAccount == "1")
                {
                    decorator.SetTextColor(Resource.Color.Post_IsBusiness, IonIconsFonts.SocialUsd);
                }

                decorator.Build();

                TxtPostCount.Text = Methods.FunString.FormatPriceValue(Int32.Parse(cl.PostsCount));

                if (cl.Followers != null && int.TryParse(cl.Followers, out var numberFollowers))
                {
                    TxtFollowersCount.Text = Methods.FunString.FormatPriceValue(numberFollowers);
                }

                if (cl.Following != null && int.TryParse(cl.Following, out var numberFollowing))
                {
                    TxtFollowingCount.Text = Methods.FunString.FormatPriceValue(numberFollowing);
                }

                if (!string.IsNullOrEmpty(cl.Google))
                {
                    AboutTab.Google = cl.Google;
                    AboutTab.SocialGoogle.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.SocialGoogle.Text            = IonIconsFonts.SocialGoogle;
                    AboutTab.SocialGoogle.Visibility      = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Facebook))
                {
                    AboutTab.Facebook = cl.Facebook;
                    AboutTab.SocialFacebook.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.SocialFacebook.Text          = IonIconsFonts.SocialFacebook;
                    AboutTab.SocialFacebook.Visibility    = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Website))
                {
                    AboutTab.Website = cl.Website;
                    AboutTab.WebsiteButton.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.WebsiteButton.Text           = IonIconsFonts.AndroidGlobe;
                    AboutTab.WebsiteButton.Visibility     = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }


                if (!string.IsNullOrEmpty(cl.Twitter))
                {
                    AboutTab.Twitter = cl.Twitter;
                    AboutTab.SocialTwitter.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.SocialTwitter.Text           = IonIconsFonts.SocialTwitter;
                    AboutTab.SocialTwitter.Visibility     = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }

                BtnMessage.Visibility = cl.IsFollowing != null && (cl.CPrivacy == "1" || cl.CPrivacy == "2" && cl.IsFollowing.Value) ? ViewStates.Visible : ViewStates.Invisible;

                if (cl.IsFollowing != null)
                {
                    SIsFollowing = cl.IsFollowing.Value;
                }

                if (!friends)
                {
                    return;
                }
                if (cl.IsFollowing != null && cl.IsFollowing.Value) // My Friend
                {
                    FollowButton.SetBackgroundColor(Color.ParseColor("#efefef"));
                    FollowButton.SetTextColor(Color.ParseColor("#444444"));
                    FollowButton.Text = Context.GetText(Resource.String.Lbl_Following);
                    FollowButton.Tag  = "true";
                }
                else
                {
                    //Not Friend
                    FollowButton.SetBackgroundResource(Resource.Drawable.buttonFlatNormal);
                    FollowButton.SetTextColor(Color.ParseColor("#ffffff"));
                    FollowButton.Text = Context.GetText(Resource.String.Lbl_Follow);
                    FollowButton.Tag  = "false";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 4
0
        private async Task LoadDataAsync()
        {
            if (Methods.CheckConnectivity())
            {
                var channel = await ApiRequest.GetChannelData(Activity, IdChannel);

                if (channel != null)
                {
                    TextSanitizer text = new TextSanitizer(TxtAboutChannel, Activity, GlobalContext);
                    text.Load(AppTools.GetAboutFinal(channel));

                    if (channel.Gender == "male" || channel.Gender == "Male")
                    {
                        TxtGender.Text = GetText(Resource.String.Radio_Male);
                    }
                    else
                    {
                        TxtGender.Text = GetText(Resource.String.Radio_Female);
                    }

                    TxtEmail.Text = channel.Email;

                    Facebook = channel.Facebook;
                    Google   = channel.Google;
                    Twitter  = channel.Twitter;

                    if (string.IsNullOrEmpty(channel.Facebook))
                    {
                        BtnFacebook.Enabled = false;
                        BtnFacebook.SetColor(Color.ParseColor("#8c8a8a"));
                    }
                    else
                    {
                        BtnFacebook.Enabled = true;
                    }

                    if (string.IsNullOrEmpty(channel.Twitter))
                    {
                        BtnTwitter.Enabled = false;
                        BtnTwitter.SetColor(Color.ParseColor("#8c8a8a"));
                    }
                    else
                    {
                        BtnTwitter.Enabled = true;
                    }

                    if (string.IsNullOrEmpty(channel.Google))
                    {
                        BtnGoogle.Enabled = false;
                        BtnGoogle.SetColor(Color.ParseColor("#8c8a8a"));
                    }
                    else
                    {
                        BtnGoogle.Enabled = true;
                    }

                    if (IdChannel == UserDetails.UserId)
                    {
                        var idCurrency = ListUtils.MySettingsList?.PaymentCurrency;
                        var(currency, currencyIcon) = AppTools.GetCurrency(idCurrency);
                        Console.WriteLine(currencyIcon);
                        TxtMonetization.Text = channel.Balance + " " + currency;
                    }
                }
            }
            else
            {
                Toast.MakeText(Context, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
            }
        }
Exemplo n.º 5
0
        private void LoadUserData(UserDataObject cl, bool friends = true)
        {
            try
            {
                PPrivacy = cl.PPrivacy;

                GlideImageLoader.LoadImage(Activity, cl.Avatar, UserProfileImage, ImageStyle.RoundedCrop, ImagePlaceholders.Color);
                UserProfileImage.SetScaleType(ImageView.ScaleType.CenterCrop);

                TextSanitizerAutoLink.Load(AppTools.GetAboutFinal(cl));
                AboutLiner.Visibility = ViewStates.Visible;

                Username.Text = "@" + cl.Username;
                Fullname.Text = AppTools.GetNameFinal(cl);

                IconVerified.Visibility = cl.Verified == "1" ? ViewStates.Visible : ViewStates.Gone;

                IconBusiness.Visibility = cl.BusinessAccount == "1" ? ViewStates.Visible : ViewStates.Gone;

                Typeface font = Typeface.CreateFromAsset(Application.Context.Resources.Assets, "ionicons.ttf");

                TxtCountFav.Text       = Methods.FunString.FormatPriceValue(Int32.Parse(cl.PostsCount));
                TxtCountFollowers.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(cl.Followers));
                TxtCountFollowing.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(cl.Following));

                if (!string.IsNullOrEmpty(cl.Google))
                {
                    Google = cl.Google;
                    SocialGoogle.SetTypeface(font, TypefaceStyle.Normal);
                    SocialGoogle.Text       = IonIconsFonts.SocialGoogle;
                    SocialGoogle.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Facebook))
                {
                    Facebook = cl.Facebook;
                    SocialFacebook.SetTypeface(font, TypefaceStyle.Normal);
                    SocialFacebook.Text       = IonIconsFonts.SocialFacebook;
                    SocialFacebook.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Website))
                {
                    Website = cl.Website;
                    WebsiteButton.SetTypeface(font, TypefaceStyle.Normal);
                    WebsiteButton.Text       = IonIconsFonts.AndroidGlobe;
                    WebsiteButton.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Twitter))
                {
                    Twitter = cl.Twitter;
                    SocialTwitter.SetTypeface(font, TypefaceStyle.Normal);
                    SocialTwitter.Text       = IonIconsFonts.SocialTwitter;
                    SocialTwitter.Visibility = ViewStates.Visible;
                }

                if (cl.IsFollowing != null)
                {
                    SIsFollowing = cl.IsFollowing.Value;
                    if (!friends)
                    {
                        return;
                    }

                    if (cl.IsFollowing.Value) // My Friend
                    {
                        FollowButton.SetBackgroundResource(Resource.Drawable.Shape_Radius_Grey_Btn);
                        FollowButton.SetTextColor(Color.ParseColor("#000000"));
                        FollowButton.Text = Context.GetText(Resource.String.Lbl_Following);
                        FollowButton.Tag  = "true";
                    }
                    else
                    {
                        //Not Friend
                        FollowButton.SetBackgroundResource(Resource.Drawable.Shape_Radius_Gradient_Btn);
                        FollowButton.SetTextColor(Color.ParseColor("#ffffff"));
                        FollowButton.Text = Context.GetText(Resource.String.Lbl_Follow);
                        FollowButton.Tag  = "false";
                    }

                    MessageButton.Visibility = cl.CPrivacy == "1" || cl.CPrivacy == "2" && cl.IsFollowing.Value
                        ? ViewStates.Visible
                        : ViewStates.Invisible;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 6
0
        private void Initialize(ContactsAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

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

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

                if (ShowButton)
                {
                    switch (users.IsFollowing)
                    {
                    // My Friend
                    case true:
                    {
                        holder.Button.SetBackgroundResource(Resource.Xml.background_signup2);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                        holder.Button.Tag  = "true";
                        break;
                    }

                    case false:
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Follow);
                        holder.Button.Tag  = "false";
                        break;
                    }
                    }

                    if (users.UserId.ToString() == UserDetails.UserId)
                    {
                        holder.Button.Visibility = ViewStates.Gone;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }