Beispiel #1
0
        protected override FilterResults PerformFiltering(ICharSequence constraint)
        {
            FilterResults filterResults = new FilterResults();

            if (constraint != null && constraint.Length() > 0)
            {
                string          query         = constraint.ToString().ToUpper();
                JavaList <Item> filteredItems = new JavaList <Item>();

                for (int i = 0; i < currentItems.NumItems; i++)
                {
                    string itemName = currentItems[i].Text;
                    if (itemName.ToUpper().Contains(query.ToString()))
                    {
                        filteredItems.Add(currentItems[i]);
                    }
                }
                filterResults.Count  = filteredItems.Count;
                filterResults.Values = filteredItems;
            }
            else
            {
                filterResults.Count  = currentItems.NumItems;
                filterResults.Values = currentItems.getItems();
            }
            return(filterResults);
        }
Beispiel #2
0
 public ItemsAdapter(Items items)
 {
     mItems       = items;
     currentItems = new Items();
     currentItems.setItems(items.getItems());
 }