protected override void InitBindings() { Bindings.Add( this.SetBinding(() => ViewModel.CurrentData).WhenSourceChanges(() => { ImageService.Instance.LoadUrl(ViewModel.CurrentData.User.ImgUrl) .Success(ProfilePageGeneralTabAnimeUserImg.AnimateFadeIn) .Into(ProfilePageGeneralTabAnimeUserImg); ProfilePageGeneralTabDetailsList.SetAdapter( ViewModel.CurrentData.Details.GetAdapter(GetDetailTemplateDelegate)); ProfilePageGeneralTabFriendsGrid.ItemHeight = ProfilePageGeneralTabFriendsGrid.ItemWidth = DimensionsHelper.DpToPx(65); ProfilePageGeneralTabFriendsGrid.SetColumnWidth((int)ProfilePageGeneralTabFriendsGrid.ItemWidth); ProfilePageGeneralTabFriendsGrid.Adapter = ViewModel.CurrentData.Friends.GetAdapter(GetFriendTemplateDelegate); ProfilePageGeneralTabCommentsList.SetAdapter( ViewModel.CurrentData.Comments.GetAdapter(GetCommentTemplateDelegate)); })); ProfilePageGeneralTabAnimeListButton.SetCommand(ViewModel.NavigateAnimeListCommand); ProfilePageGeneralTabMangaListButton.SetCommand(ViewModel.NavigateMangaListCommand); ProfilePageGeneralTabHistoryButton.SetCommand(ViewModel.NavigateHistoryCommand); }
private void PopulateComments() { Bindings.Add(this.SetBinding(() => ViewModel.MalComments).WhenSourceChanges(() => { ProfilePageGeneralTabCommentsList.InjectFlingAdapter(ViewModel.MalComments, view => new CommentViewHolder(view), DataTemplateFull, DataTemplateFling, DataTemplateBasic, ContainerTemplate); ProfilePageGeneralTabCommentsList.Post(() => { int grossElementHeight = 0; if (ProfilePageGeneralTabCommentsList.Adapter.Count > 0) { for (int i = 0; i < (ProfilePageGeneralTabCommentsList.Adapter.Count > 4 ? 4 : ProfilePageGeneralTabCommentsList.Adapter.Count); i++) { View childView = ProfilePageGeneralTabCommentsList.Adapter.GetView(i, null, ProfilePageGeneralTabCommentsList); childView.Measure(_unbounded, _unbounded); grossElementHeight += childView.MeasuredHeight; } } else { grossElementHeight = DimensionsHelper.DpToPx(100); } ProfilePageGeneralTabCommentsList.LayoutParameters.Height = grossElementHeight; ProfilePageGeneralTabCommentsList.NestedScrollingEnabled = false; }); })); }