protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults returnObj = new FilterResults(); var results = new List <EventShort>(); if (a._originalData == null) { a._originalData = a._items; } if (constraint == null) { return(returnObj); } if (a._originalData != null && a._originalData.Any()) { // Compare constraint to all names lowercased. If they are contained they are added to results. results.AddRange( a._originalData.Where( item => item.Name.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); }
protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults returnObj = new FilterResults(); var matchList = new List <TaskOutboxModel>(); var results = new List <TaskOutboxModel>(); if (_adapter.AllItem == null) { _adapter.AllItem = _adapter.Mitems; } if (constraint == null) { return(returnObj); } if (_adapter.AllItem != null && _adapter.AllItem.Any()) { results.AddRange( _adapter.AllItem.Where( chemical2 => chemical2.Task_name.ToLower().Contains(constraint.ToString().ToLower()))); } returnObj.Values = FromArray(results.Select(r => r.ToJavaObject()).ToArray()); returnObj.Count = results.Count; constraint.Dispose(); return(returnObj); }
protected override void PublishResults(Java.Lang.ICharSequence constraint, Filter.FilterResults results) { if (results.Count == 0) { return; } var list = results.Values.ToArray <Java.Lang.Object>(); if (list != null && list.Length > 0) { adapter.Clear(); foreach (var t in list) { adapter.Add(t); } } if (results.Count > 0) { adapter.NotifyDataSetChanged(); } else { adapter.NotifyDataSetInvalidated(); } constraint.Dispose(); results.Dispose(); }
protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults returnObj = new FilterResults(); var results = new List <EventShort>(); if (a._originalData == null) { a._originalData = a._items; } if (constraint == null) { return(returnObj); } if (a._originalData != null && a._originalData.Any()) { // Compare constraint to all names lowercased. If they are contained they are added to results. results.AddRange( a._originalData.Where( item => item.Name.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); //if (constraint != null) //{ // var searchFor = constraint.ToString(); // var matchList = new List<string>(); // var matches = from i in a.AllItems // where i.IndexOf(searchFor) >= 0 // select i; // foreach (var match in matches) // { // matchList.Add(match); // } // a.MatchItems = matchList.ToArray(); // 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]); // } // returnObj.Values = matchObjects; // returnObj.Count = matchList.Count; //} //return returnObj; }
protected override FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { if (_originalItems == null) { _originalItems = GetItemsToFilter(); } var filterResults = new FilterResults(); if (constraint == null) { return(filterResults); } var results = new List <T>(); if (_originalItems != null && _originalItems.Count > 0) { var constraintString = constraint.ToString(); if (constraintString != null) { results.AddRange(PerformSearch(constraintString)); } } filterResults.Values = FromArray(results.Select(r => r.ToJavaObject()).ToArray()); filterResults.Count = results.Count; constraint.Dispose(); return(filterResults); }
protected override void PublishResults(Java.Lang.ICharSequence constraint, FilterResults results) { adapter.cursor = (ICursor)results.Values; adapter.ChangeCursor((ICursor)results.Values); //adapter.NotifyDataSetChanged (); constraint.Dispose(); results.Dispose(); }
protected override void PublishResults(Java.Lang.ICharSequence constraint, FilterResults results) { using (var values = results.Values) { SetItemsFromResults(values.ToArray <Java.Lang.Object>().Select(a => a.ToNetObject <T>()).ToList()); } constraint.Dispose(); results.Dispose(); }
protected override void PublishResults(Java.Lang.ICharSequence constraint, FilterResults results) { using (var values = results.Values) a._items = values.ToArray <Java.Lang.Object>().Select(r => r.ToNetObject <EventShort>()).ToList(); a.NotifyDataSetChanged(); // Don't do this and see GREF counts rising constraint.Dispose(); results.Dispose(); }
protected override void PublishResults(Java.Lang.ICharSequence constraint, FilterResults results) { using (var values = results.Values) { var list = values.ToArray <Object>().Select(a => a.ToNetObject <Character>()).ToArray(); _adapter.CharsList = new JavaList <Character>(list); } _adapter.NotifyDataSetChanged(); constraint.Dispose(); results.Dispose(); }
protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { FilterResults results = new FilterResults(); if (adapter._originalData == null) { adapter._originalData = adapter._items; } if (constraint == null) { return(results); } var matchList = new List <Java.Lang.Object>(); if (adapter._originalData != null && adapter._originalData.Any()) { foreach (var txt in adapter._originalData) { if (txt.ToString().ToUpper().Contains(constraint.ToString().ToUpper())) { //выходим когда кол-во совпадений больше заданного ограничения if (matchList.Count == limitRows.limValue) { matchList.Add(limitRows.limValueText); break; } matchList.Add(txt); } } } var resultsValues = new Java.Lang.Object[matchList.Count]; for (int i = 0; i < matchList.Count; i++) { resultsValues[i] = matchList[i]; } results.Count = matchList.Count; results.Values = resultsValues; constraint.Dispose(); return(results); }
protected override FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { var returnObj = new FilterResults(); var results = new List <Character>(); if (_adapter.OriginalCharsList == null) { _adapter.OriginalCharsList = _adapter.CharsList; } if (constraint == null) { return(returnObj); } if (_adapter.OriginalCharsList != null && _adapter.OriginalCharsList.ToList().Any()) { // Compare constraint to all names lowercased. // It they are contained they are added to results. var search = constraint.ToString().ToLower(); results.AddRange(_adapter.OriginalCharsList .Where(contact => contact.Name.ToLower() .Contains(search) ) .OrderByDescending(e => e.Name.ToLower().StartsWith(search)) .ThenBy(e => e.Name) ); } returnObj.Values = FromArray(results.Select(e => e.ToJavaObject()).ToArray()); returnObj.Count = results.Count; constraint.Dispose(); return(returnObj); }