Exemplo n.º 1
0
 private void FnSetUpControls()
 {
     searchViewSearchRunners = mThisFragmentView.FindViewById <SearchView>(Resource.Id.searchBar);
     mLvRunners      = mThisFragmentView.FindViewById <ListView>(Resource.Id.lvRunners);
     mTxtTotalAmount = mThisFragmentView.FindViewById <TextView>(Resource.Id.txtTotalAmount);
     searchViewSearchRunners.QueryHint = "Search Runners";
 }
Exemplo n.º 2
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu_main, menu);

            SearchManager searchManager = (SearchManager)GetSystemService(Context.SearchService);

            menu.FindItem(Resource.Id.search).SetActionView(Resource.Layout.searchview);

            IMenuItem search = menu.FindItem(Resource.Id.search);

            Android.Support.V7.Widget.SearchView searchView = search.ActionView.JavaCast <Android.Support.V7.Widget.SearchView>();

            searchView.SetSearchableInfo(searchManager.GetSearchableInfo(new ComponentName(this, SearchActivity.JavaType)));

            /*
             * TODO: set query hint by search context
             * searchView.QueryHint = null;
             */

            SearchOnClickListener searchListener = new SearchOnClickListener(this);

            searchView.SetOnSearchClickListener(searchListener);
            searchView.SetOnCloseListener(searchListener);

            return(true);
        }
Exemplo n.º 3
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            base.OnCreateOptionsMenu(menu, inflater);

            inflater.Inflate(Resource.Menu.fragment_photo_gallery, menu);

            var searchItem = menu.FindItem(Resource.Id.menu_item_search);

            _searchView = (Android.Support.V7.Widget.SearchView)searchItem.ActionView;

            _searchView.QueryTextSubmit += QueryTextSubmitted;
            _searchView.QueryTextChange += QueryTextChanged;
            _searchView.SetOnSearchClickListener(new OnSearchClickListener(SearchViewClicked));

            var toggleItem = menu.FindItem(Resource.Id.menu_item_toggle_polling);

            if (PollService.IsServiceAlarmOn(Activity))
            {
                toggleItem.SetTitle(Resource.String.stop_polling);
            }
            else
            {
                toggleItem.SetTitle(Resource.String.start_polling);
            }
        }
Exemplo n.º 4
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            // menu.Clear();
            inflater.Inflate(Resource.Menu.action_chat, menu);
            base.OnCreateOptionsMenu(menu, inflater);

            var searchItems = menu.FindItem(Resource.Id.action_ChatSearch);

            searchItems.SetVisible(true);

            //MenuItemCompat.SetOnActionExpandListener(searchItems, new SearchViewExpandListener((IFilter)mAdapter));

            var searchItem = MenuItemCompat.GetActionView(searchItems);


            _searchView = searchItem.JavaCast <Android.Support.V7.Widget.SearchView>();
            if (_adapter != null)
            {
                _searchView.QueryTextChange += (s, e) => _adapter.Filter.InvokeFilter(e.NewText.ToLower());

                _searchView.QueryTextSubmit += (s, e) =>
                {
                    // Handle enter/search button on keyboard here
                    Toast.MakeText(this.Context, "Searched for: " + e.Query, ToastLength.Short).Show();
                    e.Handled = true;
                };
            }

            //  MenuItemCompat.SetOnActionExpandListener(searchItems, new SearchViewExpandListener(_adapter));
        }
        private void AddSearchToToolBar()
        {
            if (Element is SearchPage)
            {
                MainActivity current = CrossCurrentActivity.Current.Activity as MainActivity;
                Toolbar      toolbar = current.FindViewById <Toolbar>(Resource.Id.toolbar);

                toolbar.Title = Element.Title;
                toolbar.InflateMenu(Resource.Menu.mainmenu);

                _searchView = toolbar?.Menu?.FindItem(Resource.Id.action_search)?.ActionView?.JavaCast <SearchView>();

                if (_searchView == null)
                {
                    return;
                }

                _searchView.QueryTextChange += searchView_QueryTextChange;
                _searchView.QueryTextSubmit += searchView_QueryTextSubmit;
                _searchView.QueryHint        = (Element as SearchPage)?.SearchPlaceHolderText;
                _searchView.ImeOptions       = (int)ImeAction.Search;
                _searchView.InputType        = (int)InputTypes.TextVariationNormal;
                _searchView.MaxWidth         = int.MaxValue; //Hack to go full width - http://stackoverflow.com/questions/31456102/searchview-doesnt-expand-full-width
            }
        }
Exemplo n.º 6
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu_main, menu);
            var item   = menu.FindItem(Resource.Id.action_search);
            var search = MenuItemCompat.GetActionView(item);

            searchView = search.JavaCast <Android.Support.V7.Widget.SearchView>();
            dsSearch   = new List <District>();

            searchView.QueryTextChange += (s, e) =>
            {
                dsSearch.Clear();
                foreach (var ds in dsList)
                {
                    if (ds.Name.ToLower().Contains(e.NewText.ToLower()))
                    {
                        dsSearch.Add(ds);
                    }
                    SearchAdapter = new ExCityAdapter(dsSearch, this);
                    radListView.SetAdapter(SearchAdapter);
                }
            };

            return(true);
        }
Exemplo n.º 7
0
 private void FindViews()
 {
     layout        = FindViewById <RelativeLayout>(Resource.Id.tasks_Layout);
     createButton  = FindViewById <FloatingActionButton>(Resource.Id.tasks_CreateButton);
     emptyTextView = FindViewById <TextView>(Resource.Id.tasksView_EmptyText);
     searchView    = FindViewById <V7.SearchView>(Resource.Id.tasks_SearchView);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes the contents of the Activity's standard options menu
        /// </summary>
        /// <param name="menu"></param>
        /// <param name="inflater"></param>
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate(Resource.Menu.search, menu);
            try
            {
                var searchItem = menu.FindItem(Resource.Id.menu_search);

                var searvView = MenuItemCompat.GetActionView(searchItem);
                Android.Support.V7.Widget.SearchView searchView = searvView.JavaCast <Android.Support.V7.Widget.SearchView>();

                searchView.QueryTextChange += (sender, args) =>
                {
                    string search = args.NewText;
                    mAdapter.GetFilteredList(search);
                    //if (string.IsNullOrEmpty(search))
                    //{
                    //    adapter.ResetSearch();
                    //}
                    //else
                    //{
                    //    adapter.filter.InvokeFilter(search);
                    //}
                };
            }
            catch (Exception e)
            {
            }
        }
Exemplo n.º 9
0
        private void FnSetUpSearchToolbar(LayoutInflater inflater)
        {
            toolbar = thisFragmentView.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbarSearchCategories);
            toolbar.MenuItemClick += Toolbar_MenuItemClick;

            //inflate search to toolbar
            inactiveSearchView = inflater.Inflate(Resource.Layout.checkout_fragment_search_inactive, toolbar, false);
            activeSearchView   = inflater.Inflate(Resource.Layout.checkout_fragment_search_active, toolbar, false);

            toolbar.AddView(inactiveSearchView);

            //search activate
            var btnSearchActivate = inactiveSearchView.FindViewById <LinearLayout>(Resource.Id.btnSearchActivate);

            btnSearchActivate.Click += btnSearchActivate_Click;

            //search deactivate
            searchCancelButton        = activeSearchView.FindViewById <ImageView>(Resource.Id.imgSearchCancel);
            searchCancelButton.Click += SearchCancelButton_Click;
            searchViewSearchItems     = activeSearchView.FindViewById <SearchView>(Resource.Id.txtSearchItems);
            //reused from CheckoutFragment
            searchViewSearchItems.SetOnQueryTextFocusChangeListener(new SearchViewFocusListener(Context, "ProductsFragment"));
            searchViewSearchItems.QueryHint        = "Search sizes";
            searchViewSearchItems.QueryTextChange += SearchViewSearchItems_QueryTextChange;
        }
Exemplo n.º 10
0
        private void InitToolbar(View view)
        {
            try
            {
                var toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar);
                if (toolbar != null)
                {
                    GlobalContext.SetToolBar(toolbar, "");

                    SearchBox = view.FindViewById <SearchView>(Resource.Id.searchBox);
                    SearchBox.SetIconifiedByDefault(false);
                    SearchBox.OnActionViewExpanded();
                    SearchBox.Iconified        = false;
                    SearchBox.QueryTextSubmit += SearchViewOnQueryTextSubmit;
                    SearchBox.QueryTextChange += SearchViewOnQueryTextChange;
                    SearchBox.ClearFocus();

                    //Change text colors
                    var editText = (EditText)SearchBox.FindViewById(Resource.Id.search_src_text);
                    editText.SetHintTextColor(Color.White);
                    editText.SetTextColor(Color.White);

                    //Remove Icon Search
                    ImageView searchViewIcon         = (ImageView)SearchBox.FindViewById(Resource.Id.search_mag_icon);
                    ViewGroup linearLayoutSearchView = (ViewGroup)searchViewIcon.Parent;
                    linearLayoutSearchView.RemoveView(searchViewIcon);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 11
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            // Inflate the menu; this adds items to the action bar if it is present.
            MenuInflater.Inflate(Resource.Menu.menu_file_list, menu);

            var item       = menu.FindItem(Resource.Id.action_search);
            var searchView = MenuItemCompat.GetActionView(item);

            mSearchView           = searchView.JavaCast <Android.Support.V7.Widget.SearchView>();
            mSearchView.MaxWidth  = int.MaxValue;
            mSearchView.QueryHint = Resources.GetText(Resource.String.search_songs);
            mSearchView.SetOnQueryTextListener(this);

            MenuItemCompat.SetOnActionExpandListener(item, new FileListSearchViewExpandListener(this));

            if (searchOpen)
            {
                MenuItemCompat.ExpandActionView(item);

                if (!TextUtils.IsEmpty(queryToSave))
                {
                    mSearchView.SetQuery(queryToSave, false);
                }

                mSearchView.ClearFocus();
            }

            return(true);
        }
        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            try
            {
                MenuInflater.Inflate(Resource.Menu.action_contactsListMenu, menu);
                if (menu != null)
                {
                    menu.FindItem(Resource.Id.action_menuOKOK).SetVisible(true);

                    var searchItems = menu.FindItem(Resource.Id.action_ContactSearch);

                    searchItems.SetVisible(true);

                    //MenuItemCompat.SetOnActionExpandListener(searchItems, new SearchViewExpandListener((IFilter)mAdapter));

                    var searchItem = MenuItemCompat.GetActionView(searchItems);
                    _searchView = searchItem.JavaCast <Android.Support.V7.Widget.SearchView>();
                    _searchView.SubmitButtonEnabled = true;

                    _searchView.QueryTextChange += (s, e) => mAdapter.Filter.InvokeFilter(e.NewText);
                }
            }
            catch (System.Exception ex)
            {
                Crashes.TrackError(ex);
            }
            return(base.OnCreateOptionsMenu(menu));
        }
Exemplo n.º 13
0
        private void DestroyBasic()
        {
            try
            {
                MAdView?.Destroy();
                RewardedVideo?.Destroy();

                MAdapter           = null;
                SwipeRefreshLayout = null;
                MRecycler          = null;
                EmptyStateLayout   = null;
                Inflated           = null;
                MainScrollEvent    = null;
                MAdView            = null;
                SearchText         = null;
                SearchView         = null;
                BtnFilter          = null;
                ToolBar            = null;
                RewardedVideo      = null;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void DestroyBasic()
        {
            try
            {
                MAdView?.Destroy();
                RewardedVideo?.Destroy();

                MAdapter           = null !;
                SwipeRefreshLayout = null !;
                MRecycler          = null !;
                EmptyStateLayout   = null !;
                Inflated           = null !;
                MainScrollEvent    = null !;
                MAdView            = null !;
                SearchText         = null !;
                SearchView         = null !;
                BtnFilter          = null !;
                ToolBar            = null !;
                RewardedVideo      = null !;
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 15
0
 public override bool OnCreateOptionsMenu(IMenu menu)
 {
     MenuInflater.Inflate(Resource.Menu.main_menu, menu);
     Android.Support.V7.Widget.SearchView searchView = (Android.Support.V7.Widget.SearchView)menu.GetItem(0).ActionView;
     searchView.SetOnQueryTextListener(this);
     searchView.SetOnQueryTextFocusChangeListener(this);
     return(true);
 }
Exemplo n.º 16
0
 public override bool OnCreateOptionsMenu(IMenu menu)
 {
     MenuInflater.Inflate(Resource.Menu.menu_search, menu);
     searchView = menu.FindItem(Resource.Id.menuSearch).ActionView as Android.Support.V7.Widget.SearchView;
     searchView.QueryTextSubmit += SearchView_QueryTextSubmit;
     searchView.QueryTextChange += SearchView_QueryTextChange;
     return(true);
 }
Exemplo n.º 17
0
 private void FnSetUpControls()
 {
     toolBar                 = FindViewById <SupportToolbar>(Resource.Id.toolBar);
     mBtnSelectCustomer      = FindViewById <Button>(Resource.Id.btnSelectCustomer);
     mListView               = FindViewById <ListView>(Resource.Id.lvCustomers);
     searchBar               = FindViewById <SupportSearchBar>(Resource.Id.searchBar);
     searchBar.QueryHint     = mIsCustomer ? "Search customers" : "Search runners";
     mBtnSelectCustomer.Text = mIsCustomer ? "REMOVE CUSTOMER" : "REMOVE RUNNER";
 }
Exemplo n.º 18
0
        //private async void ToolBar_MenuItemClick(object sender, SupportToolBar.MenuItemClickEventArgs e)
        //{
        //    if (NetworkStatus.State != NetworkState.Disconnected)
        //    {
        //        switch (e.Item.ItemId)
        //        {
        //            //case Resource.Id.menu_refresh:
        //            //    ProgressDialog progressDialog = ProgressDialog.Show(this, "", "Loading, please wait", true);

        //            //    SearchUsersList = await MeritMoneyBrain.GetListOfUsers(String.Empty);

        //            //    UsersDatabase db = new UsersDatabase();
        //            //    db.Update(SearchUsersList);

        //            //    RecyclerViewAdapter.AddNewList(SearchUsersList);

        //            //    for (int i = 0; i < SearchUsersList.Count(); i++)
        //            //        new CacheListItemImage(RecyclerViewAdapter, i, Application.Context).Execute(SearchUsersList[i]);

        //            //    progressDialog.Dismiss();
        //            //    break;
        //        }
        //    }
        //    else
        //    {
        //        Toast.MakeText(this, GetString(Resource.String.NoInternet), ToastLength.Short).Show();
        //    }
        //}

        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.search_top_menu, menu);
            IMenuItem menuItem = menu.FindItem(Resource.Id.action_search);

            Android.Support.V7.Widget.SearchView searchView = (Android.Support.V7.Widget.SearchView)Android.Support.V4.View.MenuItemCompat.GetActionView(menuItem);
            searchView.SetOnQueryTextListener(this);
            return(base.OnCreateOptionsMenu(menu));
        }
        private async void InitComponent()
        {
            try
            {
                MapIcon = FindViewById <TextView>(Resource.Id.map_icon);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, MapIcon, IonIconsFonts.AndroidLocate);

                ListIcon = FindViewById <TextView>(Resource.Id.list_icon);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, ListIcon, IonIconsFonts.AndroidList);

                MapButton  = FindViewById <LinearLayout>(Resource.Id.map_button);
                ListButton = FindViewById <LinearLayout>(Resource.Id.list_button);

                SearchView = FindViewById <SearchView>(Resource.Id.searchView);
                SearchView.SetQuery("", false);
                SearchView.SetIconifiedByDefault(false);
                SearchView.OnActionViewExpanded();
                SearchView.Iconified = false;
                SearchView.ClearFocus();

                //Change text colors
                var editText = (EditText)SearchView.FindViewById(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.White);
                editText.SetTextColor(Color.White);
                editText.Hint = GetText(Resource.String.Lbl_SearchForPlace);

                //Change Color Icon Search
                ImageView searchViewIcon = (ImageView)SearchView.FindViewById(Resource.Id.search_mag_icon);
                searchViewIcon.SetColorFilter(Color.White);

                BtnSelect = FindViewById <FloatingActionButton>(Resource.Id.add_button);


                MAdapter            = new PlacesAdapter(this);
                MAdapter.ItemClick += MAdapterOnItemClick;

                var mapFrag = SupportMapFragment.NewInstance();
                SupportFragmentManager.BeginTransaction().Add(Resource.Id.map, mapFrag, mapFrag.Tag).Commit();
                mapFrag.GetMapAsync(this);

                if (!string.IsNullOrEmpty(UserDetails.Lat) || !string.IsNullOrEmpty(UserDetails.Lng))
                {
                    Lat = Convert.ToDouble(UserDetails.Lat);
                    Lng = Convert.ToDouble(UserDetails.Lng);

                    OnLocationChanged();
                }
                else
                {
                    await GetPosition();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 20
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            toolbar.InflateMenu(Resource.Menu.MenuSearchView);
            IMenuItem item = toolbar.Menu.FindItem(Resource.Id.action_search);

            SearchView searchView = (SearchView)MenuItemCompat.GetActionView(item);

            searchView.SetOnQueryTextListener(this);

            return(base.OnCreateOptionsMenu(menu));
        }
Exemplo n.º 21
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate (Resource.Menu.ActionMenu, menu);

            // Set up the search
            var search = menu.FindItem (Resource.Id.actionSearch);
            var searchView = MenuItemCompat.GetActionView (search);
            mSearch = searchView.JavaCast<SupportSearch> ();

            // Check for query and filter ListView
            mSearch.QueryTextChange += (sender, e) => mAdapter.Filter.InvokeFilter(e.NewText);
            mSearch.QueryTextSubmit += (sender, e) => {};
        }
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.User_Search_Menu, menu);

            var item       = menu.FindItem(Resource.Id.searchUserBar);
            var searchItem = MenuItemCompat.GetActionView(item);

            _SearchView = searchItem.JavaCast <SearchView>();
            _SearchView.SetIconifiedByDefault(true);
            _SearchView.QueryTextChange += _SearchView_OnTextChange;
            _SearchView.QueryTextSubmit += _SearchView_OnTextSubmit;
            return(base.OnCreateOptionsMenu(menu));
        }
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.SearchGif_Menu, menu);

            var        item       = menu.FindItem(Resource.Id.searchUserBar);
            SearchView searchItem = (SearchView)item.ActionView;

            SearchView = searchItem.JavaCast <SearchView>();
            SearchView.SetIconifiedByDefault(true);
            SearchView.QueryTextChange += SearchView_OnTextChange;
            SearchView.QueryTextSubmit += SearchView_OnTextSubmit;

            return(base.OnCreateOptionsMenu(menu));
        }
Exemplo n.º 24
0
        private void FnSetUpControls()
        {
            searchViewSearchTransactions = mThisFragmentView.FindViewById <SearchView>(Resource.Id.searchBar);
            mRecyclerViewTransactionList = mThisFragmentView.FindViewById <RecyclerView>(Resource.Id.recyclerViewTransactions);
            mRlDateFilter          = mThisFragmentView.FindViewById <RelativeLayout>(Resource.Id.rlDateFilter);
            mTxtDateFilterText     = mThisFragmentView.FindViewById <TextView>(Resource.Id.txtDateFilterText);
            mTxtSaleAmountAndCount = mThisFragmentView.FindViewById <TextView>(Resource.Id.txtSaleAmountAndCount);
            mImgRemoveFilter       = mThisFragmentView.FindViewById <ImageView>(Resource.Id.imgRemoveFilter);

            searchViewSearchTransactions.OnActionViewExpanded(); //show edit mode of searchview
            searchViewSearchTransactions.ClearFocus();           //clear focus and hide keyboard
            searchViewSearchTransactions.QueryHint = "Search customer, transaction #";
            searchViewSearchTransactions.SetOnQueryTextFocusChangeListener(new SearchViewFocusListener(Context, "TransactionsFragment"));
        }
Exemplo n.º 25
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate(Resource.Menu.ActionMenu, menu);

            // Set up the search
            var search     = menu.FindItem(Resource.Id.actionSearch);
            var searchView = MenuItemCompat.GetActionView(search);

            mSearch = searchView.JavaCast <SupportSearch> ();

            // Check for query and filter ListView
            mSearch.QueryTextChange += (sender, e) => mAdapter.Filter.InvokeFilter(e.NewText);
            mSearch.QueryTextSubmit += (sender, e) => {};
        }
Exemplo n.º 26
0
        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.action_menuSearch, menu);
            if (menu != null)
            {
                menu.FindItem(Resource.Id.action_menuSearchSearch).SetVisible(true);
                var item = menu.FindItem(Resource.Id.action_menuSearchSearch);
                MenuItemCompat.SetOnActionExpandListener(item, new SearchViewExpandListener(_adapter));

                var searchItem = MenuItemCompat.GetActionView(item);
                _searchView = searchItem.JavaCast <Android.Support.V7.Widget.SearchView>();
                _searchView.QueryTextChange += (sender, e) => _adapter.Filter.InvokeFilter(e.NewText);
            }
            return(base.OnCreateOptionsMenu(menu));
        }
Exemplo n.º 27
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            //SearchMenu
            inflater.Inflate(Resource.Menu.nav_search, menu);
            var searchItem = menu.FindItem(Resource.Id.action_search);
            var provider   = MenuItemCompat.GetActionView(searchItem);

            mSearchView = provider.JavaCast <Android.Support.V7.Widget.SearchView>();
            mSearchView.QueryTextChange += (s, e) => mCategoryAdapter.Filter.InvokeFilter(e.NewText);
            mSearchView.QueryTextSubmit += (s, e) =>
            {
                Toast.MakeText(this.Activity, "You searched: " + e.Query, ToastLength.Short).Show();
                e.Handled = true;
            };
            //MenuItemCompat.SetOnActionExpandListener(searchItem, new SearchViewExpandListener(mCategoryAdapter));
        }
Exemplo n.º 28
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.sample_actions, menu);

            var item = menu.FindItem(Resource.Id.action_search);

            var searchView = MenuItemCompat.GetActionView(item);

            mSearchView = searchView.JavaCast <V7SearchView>();

            ((EditText)searchView.FindViewById(Resource.Id.search_src_text)).SetHint(Resource.String.search_hint);
            mSearchView.SetIconifiedByDefault(false);
            mSearchView.QueryTextSubmit += MSearchView_QueryTextSubmit;

            return(true);
        }
Exemplo n.º 29
0
        private void FnSetUpSearchToolbar(LayoutInflater inflater)
        {
            toolbar.AddView(inactiveSearchView);

            //search activate
            var btnSearchActivate = inactiveSearchView.FindViewById <LinearLayout>(Resource.Id.btnSearchActivate);

            btnSearchActivate.Click += btnSearchActivate_Click;

            //search deactivate
            searchCancelButton        = activeSearchView.FindViewById <ImageView>(Resource.Id.imgSearchCancel);
            searchCancelButton.Click += SearchCancelButton_Click;

            searchViewSearchItems = activeSearchView.FindViewById <SearchView>(Resource.Id.txtSearchItems);
            searchViewSearchItems.SetOnQueryTextFocusChangeListener(new SearchViewFocusListener(this.Context, "ProductsFragment"));
            searchViewSearchItems.QueryTextChange += SearchViewSearchItems_QueryTextChange;
        }
Exemplo n.º 30
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            this.MenuInflater.Inflate(Resource.Menu.search1, menu);

            var searchItem = menu.FindItem(Resource.Id.action_search);

            searchView = searchItem.ActionView.JavaCast <SearchView>();

            if (!(searchView is null))
            {
                searchView.QueryTextSubmit += (sender, args) =>
                {
                    // Toast.MakeText(this, "You searched: " + args.Query, ToastLength.Short).Show();
                };
            }
            return(base.OnCreateOptionsMenu(menu));
        }
Exemplo n.º 31
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            // set the menu layout on Main Activity
            MenuInflater.Inflate(Resource.Menu.menu, menu);
            var searchItem  = menu.FindItem(Resource.Id.action_search);
            var _searchView = MenuItemCompat.GetActionView(searchItem);

            searchView = _searchView.JavaCast <Android.Support.V7.Widget.SearchView>();
            Console.WriteLine("SearchView is null? : " + searchView == null);
            searchView.QueryTextChange += (s, e) => donorsAdapter.Filter.InvokeFilter(e.NewText);
            searchView.QueryTextSubmit += (s, e) =>
            {
                e.Handled = true;
            };
            MenuItemCompat.SetOnActionExpandListener(searchItem, new SearchViewExpandListener(donorsAdapter));
            return(true);
        }
Exemplo n.º 32
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.main, menu);

            var item = menu.FindItem(Resource.Id.action_search);
            MenuItemCompat.SetOnActionExpandListener(item, new SearchViewExpandListener(_adapter));

            var searchItem = MenuItemCompat.GetActionView(item);
            _searchView = searchItem.JavaCast<Android.Support.V7.Widget.SearchView>();

            _searchView.QueryTextChange += (s, e) => _adapter.Filter.InvokeFilter(e.NewText);

            _searchView.QueryTextSubmit += (s, e) =>
            {
                //TODO: Do something fancy when search button on keyboard is pressed
                Toast.MakeText(this, "Searched for: " + e.Query, ToastLength.Short).Show();
                e.Handled = true;
            };

            return true;
        }
Exemplo n.º 33
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.Hoofdscherm, menu);
            _searchItem = menu.FindItem(Resource.Id.search);
            _searchItem.ExpandActionView();
            MenuItemCompat.SetOnActionExpandListener(_searchItem, this);
            View tempSearchView = MenuItemCompat.GetActionView(_searchItem);
            _searchView = tempSearchView.JavaCast<SearchView>();
            _searchView.SetIconifiedByDefault(false);
            _searchView.RequestFocus();

            _searchView.QueryTextChange += (sender, args) =>
            {
                if (args.NewText.Length > 0)
                {
                    _adapter.Filter.InvokeFilter(args.NewText);
                }
                else
                {
                    _adapter.Filter.InvokeFilter("zxcvbnmasdfghjklqwertyuiopmnbvcxzlkjhgfdsapoiuytrewq");
                }
            };
            _searchView.QueryTextSubmit += (sender, args) =>
            {
                if (args.Query.Length > 0)
                {
                    _adapter.Filter.InvokeFilter(args.Query);
                }
                else
                {
                    _adapter.Filter.InvokeFilter("zxcvbnmasdfghjklqwertyuiopmnbvcxzlkjhgfdsapoiuytrewq");
                }

                Toast.MakeText(this, _adapter.Items.Count + " results", ToastLength.Short).Show();
            };
            return base.OnCreateOptionsMenu(menu);
        }
Exemplo n.º 34
0
 private void MainPageSearchViewOnSuggestionClick(object sender, SearchView.SuggestionClickEventArgs suggestionClickEventArgs)
 {
     MainPageSearchView.SetQuery(ViewModel.CurrentHintSet[suggestionClickEventArgs.Position],true);
     MainPageSearchView.ClearFocus();
 }
Exemplo n.º 35
0
 private void MainPageSearchViewOnQueryTextSubmit(object sender, SearchView.QueryTextSubmitEventArgs queryTextSubmitEventArgs)
 {
     ViewModel.OnSearchInputSubmit();
     MainPageSearchView.ClearFocus();
 }
Exemplo n.º 36
0
 private void MainPageSearchViewOnQueryTextChange(object sender, SearchView.QueryTextChangeEventArgs queryTextChangeEventArgs)
 {
     if(!ViewModel.SearchInputVisibility)
         return;
     ViewModel.CurrentSearchQuery = queryTextChangeEventArgs.NewText;
     queryTextChangeEventArgs.Handled = true;
 }
Exemplo n.º 37
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate(Resource.Menu.main, menu);

            var item = menu.FindItem (Resource.Id.action_search);
            var searchView = MenuItemCompat.GetActionView (item);
            _searchView = searchView.JavaCast<SearchView> ();
            MenuItemCompat.SetOnActionExpandListener(item, new mOnActionExpandListener(this));

            using (WebClient wb = new WebClient())
            {
                _searchView.QueryTextChange += (sender, e) =>
                {
                    if (mAdapter != null)
                    {
                        if (e.NewText != "")
                        {
                            pbNews.Visibility = ViewStates.Visible;
                            listViewNews.Visibility = ViewStates.Gone;
                            searching = true;
                            searchingPage = 1;
                            var connectivityManager = (Android.Net.ConnectivityManager)Activity.ApplicationContext.GetSystemService(Android.App.Activity.ConnectivityService);
                            var activeConnection = connectivityManager.ActiveNetworkInfo;
                            if ((activeConnection != null) && activeConnection.IsConnected)
                            {
                                refresher.Enabled = false;
                                wb.CancelAsync();
                                loadedSite = site + "feed/?s=" + e.NewText;
                                wb.DownloadStringAsync(new Uri(site + "feed/?s=" + e.NewText));
                                wb.DownloadStringCompleted += (_s, _e) =>
                                {
                                    if (!_e.Cancelled && _e.Error==null)
                                    {
                                        var posts = new RssFeedReader().ReadFeed(_e.Result.Replace("content:encoded", "contentEncoded").Replace("dc:creator", "dcCreator"));
                                        mAdapter.listNews = posts.ToList();
                                        mAdapter.NotifyDataSetChanged();
                                        pbNews.Visibility = ViewStates.Gone;
                                        listViewNews.Visibility = ViewStates.Visible;
                                    }
                                    searchDetecting = true;
                                };
                            }
                            else
                            {
                                Toast.MakeText(Activity, "Nessuna connessione a internet.", ToastLength.Short).Show();
                                pbNews.Visibility = ViewStates.Gone;
                            }
                        }
                    }
                    else
                    {
                        textToSearchOnAdapterLoad = e.NewText;
                    }
                };
            }
        }