protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults returnObj = new FilterResults(); var matchList = new List <MarkingListModel>(); var results = new List <MarkingListModel>(); if (_adapter.AllItem == null) { _adapter.AllItem = _adapter.marking; } if (constraint == null) { return(returnObj); } if (_adapter.AllItem != null && _adapter.AllItem.Any()) { results.AddRange( _adapter.AllItem.Where( chemical => chemical.NPName.ToLower().Contains(constraint.ToString().ToLower()))); } returnObj.Values = FromArray(results.Select(r => r.ToJavaObject()).ToArray()); returnObj.Count = results.Count; constraint.Dispose(); return(returnObj); }
protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults results = new FilterResults(); if (constraint != null) { var searchFor = constraint.ToString(); Console.WriteLine("searchFor:" + searchFor); var matchList = new List <string>(); if (list.Contains(searchFor)) { } Console.WriteLine("resultCount:" + matchList.Count); Java.Lang.Object[] matchObjects; matchObjects = new Java.Lang.Object[matchList.Count]; for (int i = 0; i < matchList.Count; i++) { matchObjects[i] = new Java.Lang.String(matchList[i]); } results.Values = matchObjects; results.Count = matchList.Count; } return(results); }
protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults results = new FilterResults(); if (constraint != null) { var searchFor = constraint.ToString().ToLower(); //Console.System.Diagnostics.Debug.WriteLine("searchFor:" + searchFor); // var matchList = new List<TruckModel>(); // find matches, IndexOf means look for the input anywhere in the items // but it isn't case-sensitive by default! var matches = from i in customAdapter._list where i.PR.ToLower().Contains(searchFor) select i; //foreach (var match in matches) { //matchList.Add (match); //} customAdapter._list = matches.ToList(); // Console.System.Diagnostics.Debug.WriteLine("resultCount:" + customAdapter.MatchItems.Count); // not sure if the Java array/FilterResults are used Java.Lang.Object[] matchObjects; matchObjects = new Java.Lang.Object[customAdapter._list.Count]; for (int i = 0; i < customAdapter._list.Count; i++) { matchObjects[i] = new Java.Lang.String(customAdapter._list[i].PR.ToLower()); } results.Values = matchObjects; results.Count = customAdapter._list.Count; } return(results); }
//public SearchAdapter SAdapter //{ // get { return adapter; } // set { this.adapter = value; } //} protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults results = new FilterResults(); if (constraint != null) { List <FriendDTO> matchList = new List <FriendDTO>(); foreach (FriendDTO friend in this.SAdapter.items) { if (friend.Email.ToUpper().Contains(constraint.ToString().ToUpper())) { matchList.Add(friend); } } results.Count = matchList.Count; results.Values = matchList.Select(a => a.FirstName).ToArray(); } return(results); }
public override Android.Database.ICursor RunQueryOnBackgroundThread(Java.Lang.ICharSequence constraint) { IFilterQueryProvider filter = FilterQueryProvider; if (filter != null) { return(filter.RunQuery(constraint)); } Android.Net.Uri uri = Android.Net.Uri.WithAppendedPath( ContactsContract.Contacts.ContentFilterUri, Android.Net.Uri.Encode("")); if (constraint != null) { uri = Android.Net.Uri.WithAppendedPath( ContactsContract.Contacts.ContentFilterUri, Android.Net.Uri.Encode(constraint.ToString())); } return(mContent.Query(uri, AutoComplete4.CONTACT_PROJECTION, null, null, null)); }
protected override FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { // Source: https://gist.github.com/Cheesebaron/9838325 var returnObj = new FilterResults(); List <Ruta> results = new List <Ruta>(); //List<Ruta> matchList = new List<Ruta>(); if (adapter._items == null) { adapter._items = adapter.lRuta; } if (adapter.lRuta.Count == 0) { // Patchwork for when list is emptied by the filtter, do check if there is a error // by comparing the source code and this current code adapter.lRuta = adapter._items; } if (constraint == null) { return(returnObj); } if (adapter.lRuta != null && adapter.lRuta.Any()) { results.AddRange(adapter.lRuta.Where( ruta => ruta.nombre.ToLower().Contains(constraint.ToString().ToLower())) ); } returnObj.Values = results.ToArray(); returnObj.Count = results.Count; constraint.Dispose(); return(returnObj); }
protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { var returnObj = new FilterResults(); var results = new List <Posel>(); if (adapter.originalData == null) { adapter.originalData = adapter.list; } if (constraint == null) { return(returnObj); } if (adapter.originalData != null && adapter.originalData.Any()) { // Compare constraint to all names lowercased. // It they are contained they are added to results. results.AddRange( adapter.originalData.Where( posel => System.String.Concat(posel.Imie.ToLower(), " ", posel.Nazwisko.ToLower()).Contains(constraint.ToString()))); } // Nasty piece of .NET to Java wrapping, be careful with this! returnObj.Values = FromArray(results.Select(r => r.ToJavaObject()).ToArray()); returnObj.Count = results.Count; constraint.Dispose(); return(returnObj); }