Esempio n. 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View myView = inflater.Inflate(Resource.Layout.sndFragLayout, container, false);


            myListView            = myView.FindViewById <ListView>(Resource.Id.listView2);
            barFilter             = myView.FindViewById <SearchView>(Resource.Id.barSearch);
            myPokemonList         = myDbInstance.GetLiblaryPokemons(2, "0");
            myPokemonListFillter  = myDbInstance.GetLiblaryPokemons(2, "0");
            myAdapter             = new CustomAdapterLib(this.context, myPokemonList);
            myListView.Adapter    = myAdapter;
            myListView.ChoiceMode = ChoiceMode.Single;

            barFilter.QueryTextChange += barSearch_QueryTextChange;

            this.myListView.ItemClick += myListView_ItemClick;

            return(myView);
        }
Esempio n. 2
0
 private void barSearch_QueryTextChange(object sender, SearchView.QueryTextChangeEventArgs e)
 {
     //Console.WriteLine(e.NewText);
     myPokemonList.Clear();
     foreach (Pokemon item in myPokemonListFillter)
     {
         if (item.name.Contains(e.NewText))
         {
             Console.WriteLine(item.name);
             myPokemonList.Add(item);
         }
         else if (e.NewText == "")
         {
             myPokemonList.Add(item);
         }
     }
     myAdapter          = new CustomAdapterLib(this.context, myPokemonList);
     myListView.Adapter = myAdapter;
     myAdapter.NotifyDataSetChanged();
 }