Пример #1
0
 public ViewHolder(View itemView, RoleAdapter adpt, bool dark) : base(itemView)
 {
     view        = itemView;
     view.Click += View_Click;
     this.adpt   = adpt;
     this.dark   = dark;
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.ListFragment, container, false);

            if (CurrentEvent != null)
            {
                List <Role> roles;
                if (thephase != null)
                {
                    roles = (from n in CurrentEvent.roles where thephase.roles.Contains(n.id) select n).ToList();
                }
                else
                {
                    roles = CurrentEvent.roles;
                }

                listAdapter           = new RoleAdapter(roles, dark);
                listAdapter.OnChosen += ListAdapter_OnChosen;
                var listview = view.FindViewById <RecyclerView>(Resource.Id.eventsView);
                listview.SetAdapter(listAdapter);
                listview.SetLayoutManager(new LinearLayoutManager(Activity));
                listview.AddItemDecoration(new Android.Support.V7.Widget.DividerItemDecoration(Activity, Android.Support.V7.Widget.DividerItemDecoration.Vertical));
            }
            return(view);
        }