private void SetUpRecyclerView(RecyclerView recyclerView) { try { new System.Threading.Thread(new System.Threading.ThreadStart(delegate { act.RunOnUiThread(() => { //we need to fetch the info for this as well WMSScanner.TripsDetails tripswithso = Constants._service.Android_Routing_Get_SalesOrders_On_Trips(Update_Variables.WMSGuid.ToString(), JobNo); if (tripswithso.Successful == false) { //show error } //check if items has user on them List <WMSScanner.TripDetail> itemsfordisplay = new List <WMSScanner.TripDetail>(); for (int i = 0; i < tripswithso.trips.Length; i++) { if (tripswithso.trips[i].UserLastScannedk__BackingField == null) { itemsfordisplay.Add(tripswithso.trips[i]); } else { //item has already been set FirstItem = false; } } tripdetails.Clear(); tripdetails.AddRange(itemsfordisplay); var values = tripdetails; recyclerView.SetLayoutManager(new LinearLayoutManager(recyclerView.Context)); _adapter = new SimpleStringRecyclerViewAdapter(recyclerView.Context, values, Resources); recyclerView.SetAdapter(_adapter); recyclerView.SetItemClickListener((rv, position, view) => { }); }); } ) ) { Name = "TripInvoice" }.Start(); } catch (Exception ex) { string error = ex.Message; } }
/// <summary> /// Setup our custom recycler view /// </summary> /// <param name="recyclerView"></param> private void SetUpRecyclerView(RecyclerView recyclerView) { new System.Threading.Thread(new System.Threading.ThreadStart(delegate { act.RunOnUiThread(() => { WMSScanner.TripsDetails tripresult = new WMSScanner.TripsDetails(); if (tripresult.Successful == false) { //error out } tripobject.Clear(); var temp = new WMSScanner.TripDetail(); temp._invoice = "35088 | 2019-02-13 | Cranswick Supplier"; tripobject.Add(temp); temp = new WMSScanner.TripDetail(); temp._invoice = "35089 | 2019-02-13 | Cranswick Supplier"; tripobject.Add(temp); temp = new WMSScanner.TripDetail(); temp._invoice = "35090 | 2019-02-13 | Cranswick Supplier"; tripobject.Add(temp); //tripobject.AddRange(tripresult.trips); if (tripobject.Count == 0) { Toast.MakeText(context, "No Trips Loaded For Operator", ToastLength.Long).Show(); } else { var values = tripobject; recyclerView.SetLayoutManager(new LinearLayoutManager(recyclerView.Context)); _adapter = new SimpleStringRecyclerViewAdapter(recyclerView.Context, values, Activity.Resources); recyclerView.SetAdapter(_adapter); recyclerView.SetItemClickListener((rv, position, view) => { try { //start the signing screen Context context = view.Context; Intent intent = new Intent(context, typeof(TripScanner)); intent.PutExtra(TripScanner.EXTRA_NAME, values[position]._tripno);//pass information to the next screen context.StartActivity(intent); } catch (System.Exception ex) { } }); } }); })).Start(); }