private void BindMessageActivityViewHolder(AniListActivityViewHolder viewHolder, AniListActivity item) { viewHolder.Title.TextFormatted = BaseAniDroidActivity.FromHtml($"<b><font color='{_userNameColorHex}'>{item.Messenger?.Name}</font></b>"); viewHolder.ContentImageContainer.Visibility = ViewStates.Gone; var builder = new SpannableStringBuilder(MarkdownTextCleaner.ConvertToSpanned(item.Message)); //viewHolder.ContentText.MovementMethod = LinkMovementMethod.Instance; viewHolder.ContentText.SetText(builder, TextView.BufferType.Spannable); MarkdownSpannableFormatter.FormatMarkdownSpannable(Context, viewHolder.ContentText.TextFormatted as SpannableString); viewHolder.ContentText.Visibility = ViewStates.Visible; ImageLoader.LoadImage(viewHolder.Image, item.Messenger?.Avatar?.Large); }
private View CreateUserDetailsView(AniList.Models.UserModels.User user) { var retView = LayoutInflater.Inflate(Resource.Layout.View_UserDetails, null); ImageLoader.LoadImage(retView.FindViewById <ImageView>(Resource.Id.User_Image), user.Avatar.Large); retView.FindViewById <TextView>(Resource.Id.User_Name).Text = user.Name; var aboutView = retView.FindViewById <ExpandableText>(Resource.Id.User_Description); if (!string.IsNullOrWhiteSpace(user.About)) { aboutView.TextFormatted = MarkdownTextCleaner.ConvertToSpanned(user.About); aboutView.ExpandTextAction = textView => { var builder = new SpannableStringBuilder(MarkdownTextCleaner.ConvertToSpanned(user.About)); textView.MovementMethod = LinkMovementMethod.Instance; textView.SetText(builder, TextView.BufferType.Spannable); MarkdownSpannableFormatter.FormatMarkdownSpannable(this, textView.TextFormatted as SpannableString); }; } else { aboutView.Visibility = ViewStates.Gone; } var followerView = retView.FindViewById <TextView>(Resource.Id.User_Donator); followerView.Visibility = user.DonatorTier > 0 ? ViewStates.Visible : ViewStates.Gone; var userAnimeView = retView.FindViewById <DataRow>(Resource.Id.User_AnimeSummary); var userAnimeListCount = user.Stats.AnimeStatusDistribution.Sum(x => x.Amount); if (userAnimeListCount > 0) { userAnimeView.Visibility = ViewStates.Visible; userAnimeView.TextOne = $"{userAnimeListCount} anime on lists"; userAnimeView.TextTwo = $"{user.GetDurationString(user.Stats.WatchedTime * 60, 1)} watched"; userAnimeView.SetButtonIcon(Resource.Drawable.svg_chevron_right); userAnimeView.ButtonClickable = false; userAnimeView.ButtonVisible = true; userAnimeView.Click += (sender, args) => MediaListActivity.StartActivity(this, user.Id, MediaType.Anime); } var userMangaView = retView.FindViewById <DataRow>(Resource.Id.User_MangaSummary); var userMangaListCount = user.Stats.MangaStatusDistribution.Sum(x => x.Amount); if (userMangaListCount > 0) { userMangaView.Visibility = ViewStates.Visible; userMangaView.TextOne = $"{userMangaListCount} manga on lists"; userMangaView.TextTwo = $"{user.Stats.ChaptersRead} chapters read"; userMangaView.SetButtonIcon(Resource.Drawable.svg_chevron_right); userMangaView.ButtonClickable = false; userMangaView.ButtonVisible = true; userMangaView.Click += (sender, args) => MediaListActivity.StartActivity(this, user.Id, MediaType.Manga); } var userFavorites = retView.FindViewById <DataRow>(Resource.Id.User_Favorites); if (true) { userFavorites.Visibility = ViewStates.Visible; userFavorites.TextOne = "View Favorites"; userFavorites.ButtonClickable = false; userFavorites.ButtonVisible = true; userFavorites.Click += (sender, args) => FavoritesActivity.StartActivity(this, user.Id); } return(retView); }