Пример #1
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.new_chat_menu, menu);

            SearchManager searchManager = (SearchManager)GetSystemService(SearchService);

            Android.Widget.SearchView searchView = (Android.Widget.SearchView)menu.FindItem(Resource.Id.SearchFriend).ActionView;
            searchView.SetSearchableInfo(searchManager.GetSearchableInfo(ComponentName));

            searchView.QueryTextChange += (sender, e) => {
                string query = e.NewText;
                Console.WriteLine($"Got {query}");
                UpdateResults(query);
            };

            return(base.OnCreateOptionsMenu(menu));
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);
            Cheeseknife.Inject(this);

            countries = GetJsonFromAsset <Country>("countries.json");
            adapter   = new CountryAdapter(countries);
            rvCountries.SetLayoutManager(new LinearLayoutManager(this));
            rvCountries.SetAdapter(adapter);

            searchView = FindViewById <Android.Widget.SearchView>(Resource.Id.searchView);
            searchView.QueryTextChange += (sender, e) =>
            {
                adapter = new CountryAdapter(countries.FindAll(country => country.Name.ToLower().Contains(searchView.Query)));
                rvCountries.SetAdapter(adapter);
            };
        }
Пример #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.artistsOverviewFragment, container, false);

            // Initialize viewmodel
            _artistsViewModel = App.Container.Resolve <ArtistsViewModel>();
            _artistsViewModel.Initialize();

            _artistSearchView = view.FindViewById <SearchView>(Resource.Id.searchView);

            _artistRecyclerview = view.FindViewById <RecyclerView>(Resource.Id.artistRecyclerView);
            _artistRecyclerview.SetLayoutManager(new LinearLayoutManager(this.Context));
            _artistRecyclerview.SetItemAnimator(new DefaultItemAnimator());
            _artistSearchView.QueryTextChange += ArtistSearchTextChanged;

            _artistAdapter             = new ArtistAdapter(_artistsViewModel);
            _artistAdapter._itemClick += OnItemClick;

            return(view);
        }
Пример #4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view         = inflater.Inflate(Resource.Layout.dictionary_view, container, false);
            searchView   = view.FindViewById <SearchView>(Resource.Id.sv_word_search);
            recyclerView = view.FindViewById <RecyclerView>(Resource.Id.rv_dictionary_words);

            LinearLayoutManager layoutManager = new LinearLayoutManager(Application.Context);

            recyclerView.SetLayoutManager(layoutManager);

            recyclerView.SetAdapter(dictionaryAdapter);

            var callback        = new DictionaryItemTouchHelper(WordsLogic.GetInstance(), dictionaryAdapter, this);
            var itemTouchHelper = new ItemTouchHelper(callback);

            itemTouchHelper.AttachToRecyclerView(recyclerView);

            searchView.QueryTextChange += TextChange;

            return(view);
        }