public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.fragment_past_trips, null); viewModel = new PastTripsViewModel(); recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView); refresher = view.FindViewById <SwipeRefreshLayout>(Resource.Id.refresher); refresher.Refresh += (sender, e) => viewModel.LoadPastTripsCommand.Execute(null); adapter = new TripAdapter(Activity, viewModel); adapter.ItemClick += OnItemClick; adapter.ItemLongClick += OnItemLongClick; layoutManager = new LinearLayoutManager(Activity) { Orientation = LinearLayoutManager.Vertical }; recyclerView.SetLayoutManager(layoutManager); recyclerView.SetAdapter(adapter); recyclerView.ClearOnScrollListeners(); recyclerView.AddOnScrollListener(new TripsOnScrollListenerListener(viewModel, layoutManager)); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.fragment_past_trips, null); viewModel = new PastTripsViewModel(); recyclerView = view.FindViewById<RecyclerView>(Resource.Id.recyclerView); refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher); refresher.Refresh += (sender, e) => viewModel.LoadPastTripsCommand.Execute(null); adapter = new TripAdapter(Activity, viewModel); adapter.ItemClick += OnItemClick; adapter.ItemLongClick += OnItemLongClick; layoutManager = new LinearLayoutManager(Activity) {Orientation = LinearLayoutManager.Vertical}; recyclerView.SetLayoutManager(layoutManager); recyclerView.SetAdapter(adapter); recyclerView.ClearOnScrollListeners(); recyclerView.AddOnScrollListener(new TripsOnScrollListenerListener(viewModel, layoutManager)); return view; }