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);
            }
Пример #2
0
    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);
    }
Пример #3
0
            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);
            }