コード例 #1
0
 protected override void OnTextChanged(Java.Lang.ICharSequence text, int start, int before, int after)
 {
     base.OnTextChanged(text, start, before, after);
     mNeedsResize = true;
     // Since this view may be reused, it is good to reset the text size
     resetTextSize();
 }
コード例 #2
0
        public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count)
        {
            if (string.IsNullOrEmpty(mask))
            {
                return;
            }
            if (!editingOnChanged && editingBefore)
            {
                editingOnChanged = true;
                if (ignore)
                {
                    return;
                }

                if (count > 0)
                {
                    int startingPosition = maskToRaw[nextValidPosition(start)];
                    var addedString      = s.SubSequence(start, start + count);
                    count = rawText.AddToString(clear(addedString), startingPosition, maxRawLength);
                    if (initialized)
                    {
                        int currentPosition = startingPosition + count < rawToMask.Length ? rawToMask[startingPosition + count] :
                                              lastValidMaskPosition + 1;

                        selection = nextValidPosition(currentPosition);
                    }
                }
            }
        }
コード例 #3
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);
    }
コード例 #4
0
            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);
            }
コード例 #5
0
            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);
            }
コード例 #6
0
ファイル: Fragment1.cs プロジェクト: leecloudvictor/PS4_Tools
            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);
            }
コード例 #7
0
        public void BeforeTextChanged(Java.Lang.ICharSequence s, int start, int count, int after)
        {
            if (string.IsNullOrEmpty(mask))
            {
                return;
            }

            if (!editingBefore)
            {
                editingBefore = true;
                ignore       |= start > lastValidMaskPosition;

                int rangeStart = start;
                if (after == 0)
                {
                    rangeStart = erasingStart(start);
                }

                var range = calculateRange(rangeStart, start + count);

                if (range.Start != -1)
                {
                    rawText.SubtractFromString(range);
                }

                if (count > 0)
                {
                    selection = previousValidPosition(start);
                }
            }
        }
コード例 #8
0
ファイル: FriendAdapter.cs プロジェクト: haichay88/lunchbox
 protected override void PublishResults(Java.Lang.ICharSequence constraint, Filter.FilterResults results)
 {
     if (results.Count == 0)
     {
         this.SAdapter.NotifyDataSetInvalidated();
     }
     else
     {
         SAdapter.firstNames = (string[])results.Values;
         SAdapter.NotifyDataSetChanged();
     }
 }
コード例 #9
0
ファイル: FriendAdapter.cs プロジェクト: haichay88/lunchbox
        //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);
        }
コード例 #10
0
        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));
        }
コード例 #11
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);
            }
コード例 #12
0
 public override IEditable NewEditable(Java.Lang.ICharSequence source)
 {
     return(new TextBoxStringBuilder(_owner, source));
 }
コード例 #13
0
 public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count)
 {
     adapter.Filter.InvokeFilter(s);
 }
コード例 #14
0
 public void BeforeTextChanged(Java.Lang.ICharSequence s, int start, int count, int after)
 {
 }
コード例 #15
0
 public IMenuItem Add(int groupId, int itemId, int order, Java.Lang.ICharSequence title)
 {
     return(AddInternal(itemId, order, title));
 }
コード例 #16
0
 public void AddFragment(Fragment fragment, Java.Lang.ICharSequence Title)
 {
     FragmentsList.Add(fragment);
     FragmentListTitles.Add(Title);
 }
コード例 #17
0
 public override Java.Lang.ICharSequence FilterFormatted(Java.Lang.ICharSequence source, int start, int end, ISpanned dest, int dstart, int dend)
 {
     Parent.OnEditorAction( );
     return(base.FilterFormatted(source, start, end, dest, dstart, dend));
 }
コード例 #18
0
ファイル: Fragment1.cs プロジェクト: leecloudvictor/PS4_Tools
 protected override void PublishResults(Java.Lang.ICharSequence constraint, Filter.FilterResults results)
 {
     a.NotifyDataSetChanged();
 }
コード例 #19
0
 public IMenuItem Add(Java.Lang.ICharSequence title)
 {
     return(AddInternal(0, 0, title));
 }