private void LoadCommentMovies() { try { switch (MoviesObject) { case null: return; } CommentLayout.LayoutResource = Resource.Layout.Style_Comment; CommentLayoutView = CommentLayout.Inflate(); var holder = new MoviesCommentAdapterViewHolder(CommentLayoutView, MAdapterMovies, new MoviesCommentClickListener(this, "Reply")) { ReplyTextView = { Visibility = ViewStates.Gone } }; //Load data same as comment adapter var commentAdapter = new MoviesCommentAdapter(this, "Reply"); commentAdapter.LoadCommentData(MoviesObject, holder); ReplyCountTextView.Text = MoviesObject.Replies?.Count > 0 ? MoviesObject.Replies.Count + " " + GetString(Resource.String.Lbl_Replies) : GetString(Resource.String.Lbl_Replies); TxtComment.Text = "@" + MoviesObject?.UserData?.Username + " " ?? ""; StartApiService(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void SetRecyclerViewAdapters() { try { MAdapter = new MoviesCommentAdapter(Activity, MRecycler, "Light", GlobalContext.MoviesId, "Comment") { CommentList = new ObservableCollection <CommentsMoviesObject>() }; if (!Methods.CheckConnectivity()) { Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => MAdapter.FetchMoviesApiComments(GlobalContext.MoviesId, "0") }); } } catch (Exception e) { Console.WriteLine(e); } }
public void SetRecyclerViewAdapters() { try { MAdapter = new MoviesCommentAdapter(this, "Comment") { CommentList = new ObservableCollection <CommentsMoviesObject>() }; LayoutManager = new LinearLayoutManager(this); MRecycler.SetLayoutManager(LayoutManager); MRecycler.HasFixedSize = true; MRecycler.SetItemViewCacheSize(10); MRecycler.GetLayoutManager().ItemPrefetchEnabled = true; var sizeProvider = new FixedPreloadSizeProvider(10, 10); var preLoader = new RecyclerViewPreloader <CommentsMoviesObject>(this, MAdapter, sizeProvider, 10); MRecycler.AddOnScrollListener(preLoader); MRecycler.SetAdapter(MAdapter); RecyclerViewOnScrollListener xamarinRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(LayoutManager); MainScrollEvent = xamarinRecyclerViewOnScrollListener; MainScrollEvent.LoadMoreEvent += MainScrollEventOnLoadMoreEvent; MRecycler.AddOnScrollListener(xamarinRecyclerViewOnScrollListener); MainScrollEvent.IsLoading = false; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void SetRecyclerViewAdapters() { try { switch (Type) { case "Article": { MAdapterArticles = new ArticlesCommentAdapter(Activity, MRecycler, "Light", ArticlesObject.BlogId, "Reply") { CommentList = new ObservableCollection <CommentsArticlesObject>() }; if (!Methods.CheckConnectivity()) { Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => MAdapterArticles.FetchBlogsApiReply(IdComment, "0") }); } break; } case "Movies": { MAdapterMovies = new MoviesCommentAdapter(Activity, MRecycler, "Light", MoviesObject.MovieId, "Reply") { CommentList = new ObservableCollection <CommentsMoviesObject>() }; if (!Methods.CheckConnectivity()) { Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => MAdapterMovies.FetchMoviesApiReply(IdComment, "0") }); } break; } } } catch (Exception e) { Console.WriteLine(e); } }