public void UpdateHeader(UserProfileResponse profile) { if (profile == null) { return; } _profile = profile; _userAvatar = profile.ProfileImage; if (!string.IsNullOrEmpty(_userAvatar)) { Picasso.With(_context).Load(_userAvatar.GetProxy(_profileImage.LayoutParameters.Width, _profileImage.LayoutParameters.Height)) .Placeholder(Resource.Drawable.ic_holder) .NoFade() .Into(_profileImage, null, OnError); } else { Picasso.With(_context).Load(Resource.Drawable.ic_holder).Into(_profileImage); } if (profile.Username.Equals(AppSettings.User.Login, StringComparison.OrdinalIgnoreCase)) { _votingPower.VotingPower = (float)profile.VotingPower; _votingPower.Draw = true; } if (string.Equals(AppSettings.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _followButton.Visibility = ViewStates.Gone; } else { var background = (GradientDrawable)_followButton.Background; if (profile.FollowedChanging) { background.SetColors(new int[] { Style.R255G121B4, Style.R255G22B5 }); background.SetOrientation(GradientDrawable.Orientation.LeftRight); background.SetStroke(0, Color.White); _followButton.Text = string.Empty; _followButton.SetTextColor(Color.White); _followButton.Enabled = false; _loadingSpinner.Visibility = ViewStates.Visible; } else { if (profile.HasFollowed) { background.SetColors(new int[] { Color.White, Color.White }); background.SetStroke(3, Style.R244G244B246); _followButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Unfollow); _followButton.SetTextColor(Style.R15G24B30); } else { background.SetColors(new int[] { Style.R255G121B4, Style.R255G22B5 }); background.SetOrientation(GradientDrawable.Orientation.LeftRight); background.SetStroke(0, Color.White); _followButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Follow); _followButton.SetTextColor(Color.White); } _followButton.Enabled = true; _loadingSpinner.Visibility = ViewStates.Gone; } } if (!string.IsNullOrEmpty(profile.Name)) { _name.Text = profile.Name; _name.SetTextColor(Style.R15G24B30); } else if (!string.Equals(AppSettings.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _name.Visibility = ViewStates.Gone; } if (!string.IsNullOrEmpty(profile.Location)) { _place.Text = profile.Location.Trim(); } else if (!string.Equals(AppSettings.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _place.Visibility = ViewStates.Gone; } if (!string.IsNullOrEmpty(profile.About)) { _description.Text = profile.About; _description.SetTextColor(Style.R15G24B30); } else if (!string.Equals(AppSettings.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _description.Visibility = ViewStates.Gone; } if (!string.IsNullOrEmpty(profile.Website)) { _site.AutoLinkText = profile.Website; _site.SetTextColor(Style.R231G72B00); } else if (!string.Equals(AppSettings.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _site.Visibility = ViewStates.Gone; } _photosCount.Text = profile.PostCount.ToString("N0"); _followingCount.Text = profile.FollowingCount.ToString("#,##0"); _followersCount.Text = profile.FollowersCount.ToString("#,##0"); _balance.Text = BasePresenter.ToFormatedCurrencyString(profile.EstimatedBalance); }