示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            recyclerview              = FindViewById <RecyclerView>(Resource.Id.recyclerview);
            contact                   = new List <ContactList>();
            contactListitems          = new ContactListAdapter <ContactList>();
            recyclerview_layoutmanger = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false);
            recyclerview.SetLayoutManager(recyclerview_layoutmanger);

            for (int i = 0; i < names.Length; i++)
            {
                contact.Add(new ContactList {
                    ContactName = names[i]
                });
            }

            foreach (var s in contact)
            {
                contactListitems.Add(s);
            }

            recyclerview_adapter = new RecyclerAdapter(contactListitems);
            recyclerview.SetAdapter(recyclerview_adapter);

            sv = FindViewById <SearchView>(Resource.Id.searchview);

            sv.QueryTextChange += Sv_QueryTextChange;
        }
示例#2
0
        private void Sv_QueryTextChange(object sender, SearchView.QueryTextChangeEventArgs e)
        {
            ContactListAdapter <ContactList> contactListit = new ContactListAdapter <ContactList>();
            List <ContactList> fcontact = new List <ContactList>();

            for (int i = 0; i < names.Length; i++)
            {
                if (names[i].Contains(e.NewText))
                {
                    fcontact.Add(new ContactList {
                        ContactName = names[i]
                    });
                }
            }

            foreach (var c in fcontact)
            {
                contactListit.Add(c);
            }

            recyclerview_adapter = new RecyclerAdapter(contactListit);
            recyclerview.SetAdapter(recyclerview_adapter);
        }
示例#3
0
 public RecyclerAdapter(ContactListAdapter <ContactList> Mitems)
 {
     this.Mitems = Mitems;
     NotifyDataSetChanged();
 }