Ejemplo n.º 1
0
        private void PopluteUserDataObjectClass(FetchUserPostsByUserIdObject cl)
        {
            try
            {
                GlideImageLoader.LoadImage(Activity, cl.data.UserData.Avatar, UserProfileImage, ImageStyle.RoundedCrop, ImagePlaceholders.Color);


                if (!string.IsNullOrEmpty(cl.data.UserData.About))
                {
                    About.Text            = Methods.FunString.DecodeString(cl.data.UserData.About);
                    AboutLiner.Visibility = ViewStates.Visible;
                }

                TxtCountFollowers.Text = Methods.FunString.FormatPriceValue(cl.data.UserFollowers);
                TxtCountFollowing.Text = Methods.FunString.FormatPriceValue(cl.data.UserFollowing);
                TxtCountFav.Text       = Methods.FunString.FormatPriceValue(cl.data.TotalPosts);
                Username.Text          = "@" + cl.data.UserData.Username;
                Fullname.Text          = Methods.FunString.DecodeString(cl.data.UserData.Name);

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

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

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

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

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


                if (cl.data.IsFollowing) // 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";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
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);
            }
        }