protected override void OnCreate(Bundle savedInstanceState) { SetContentView(Resource.Layout.Main); base.OnCreate(savedInstanceState); _clothesService = new ClothesService(_filesystem); _clothesItems = _clothesService.GetAll().ToCT1ItemList(); _filteredClothesItems = new List <CT1Item> (); _listView = FindViewById <ListView> (Resource.Id.accountList); _listView.Adapter = new CT1TextAdapter(this, _clothesItems); _listView.DescendantFocusability = DescendantFocusability.AfterDescendants; var sb = FindViewById <SearchView> (Resource.Id.searchView); sb.QueryTextChange += (s, e) => { string text = e.NewText.ToLower(); _filteredClothesItems = _clothesItems.Where(ac => ac.Name.ToLower().Contains(text)).ToList(); (_listView.Adapter as CT1TextAdapter).Update(_filteredClothesItems); }; sb.SetQueryHint(Resources.GetText(Resource.String.search_text)); var toolbar = FindViewById <Toolbar> (Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Mipmap.back); SetActionBar(toolbar); toolbar.NavigationOnClick += (s, e) => GoBack(s, e); var title = (TextView)toolbar.FindViewById(Resource.Id.toolbar_title); title.Text = _brandService.Get(AppSettings.SelectedBrandId).Name; _listView.RequestFocus(); }
public ClothesVC(IntPtr handle) : base(handle) { _clothesService = new ClothesService(new IosFileSystem()); _clothesItems = _clothesService.GetAll(); _filteredClothesItems = new List <ClothesItem>(); }