public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.SearchGif_Menu, menu);

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

                SearchView = searchItem.JavaCast <SearchView>();
                SearchView.SetQuery("", false);
                SearchView.SetIconifiedByDefault(false);
                SearchView.OnActionViewExpanded();
                SearchView.Iconified        = false;
                SearchView.QueryTextChange += SearchViewOnQueryTextChange;
                SearchView.QueryTextSubmit += SearchViewOnQueryTextSubmit;
                SearchView.ClearFocus();

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

                //Remove Icon Search
                ImageView searchViewIcon         = (ImageView)SearchView.FindViewById(Resource.Id.search_mag_icon);
                ViewGroup linearLayoutSearchView = (ViewGroup)searchViewIcon.Parent;
                linearLayoutSearchView.RemoveView(searchViewIcon);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(base.OnCreateOptionsMenu(menu));
        }
Esempio n. 2
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate(Resource.Menu.buscador, menu);

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

            var searchView = MenuItemCompat.GetActionView(item);

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


            _searchView.QueryTextChange += (s, e) => {
                this.Activity.RunOnUiThread(() => {
                    adaptadorEmpleados.Filter.InvokeFilter(new Java.Lang.String(e.NewText.ToString()));
                    adaptadorEmpleados.NotifyDataSetChanged();
                });
            };

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

            MenuItemCompat.SetOnActionExpandListener(item, new SearchViewExpandListener(adaptadorEmpleados));

            fillListView();

            base.OnCreateOptionsMenu(menu, inflater);
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            StatusBarCompat.SetOrdinaryToolBar(this);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            searchView = FindViewById <SearchView>(Resource.Id.searchView);
            searchView.SetIconifiedByDefault(true);
            searchView.OnActionViewExpanded();
            searchView.SetOnQueryTextListener(this);

            viewPager = FindViewById <ViewPager>(Resource.Id.viewPager);
            viewPager.OffscreenPageLimit = 4;

            TabLayout tabs = FindViewById <TabLayout>(Resource.Id.tabLayout);

            adapter = new SearchTabsAdapter(this.SupportFragmentManager, Resources.GetStringArray(Resource.Array.SearchTabs).ToList());

            viewPager.Adapter = adapter;
            tabs.SetupWithViewPager(viewPager);
            tabs.AddOnTabSelectedListener(this);
        }
Esempio n. 4
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            //change menu_search to your name
            if (!refreshing)
            {
                this.MenuInflater.Inflate(Resource.Menu.menu_home, menu);

                if (viewModel.Places.Count == 0)
                {
                    menu.RemoveItem(Resource.Id.action_navigation);
                }

                var searchItem = menu.FindItem(Resource.Id.action_search);
                var provider   = MenuItemCompat.GetActionView(searchItem);
                searchView = provider.JavaCast <Android.Support.V7.Widget.SearchView> ();

                searchView.QueryTextSubmit += (sender, args) => {
                    RefreshData(true, args.Query.Trim());
                    var view = sender as Android.Support.V7.Widget.SearchView;
                    if (view != null)
                    {
                        view.ClearFocus();
                    }
                };
            }
            return(base.OnCreateOptionsMenu(menu));
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            listView = FindViewById <ListView>(Resource.Id.companiesList);
            InitializeListView();

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            searchView = FindViewById <Android.Support.V7.Widget.SearchView>(Resource.Id.companySearchView);
            searchView.QueryTextSubmit += (sender, args) =>
            {
                if (string.IsNullOrEmpty(args.NewText))
                {
                    InitializeListView();
                }
                else
                {
                    GetCompaniesByName(args.NewText);
                }
                args.Handled = true;
            };
        }
        private void InitToolbar(View view)
        {
            try
            {
                var toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar);
                GlobalContext.SetToolBar(toolbar, "", false);

                SearchBox = view.FindViewById <SearchView>(Resource.Id.browseSearchBox);
                SearchBox.SetIconifiedByDefault(false);

                if ((int)Build.VERSION.SdkInt < 23)
                {
                    SearchBox.SetOnClickListener(this);
                    SearchBox.SetOnSearchClickListener(this);
                    SearchBox.SetOnQueryTextFocusChangeListener(this);
                }

                //Change text colors
                var editText = SearchBox.FindViewById <EditText>(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.Gray);
                editText.SetTextColor(Color.Black);
                Methods.SetFocusable(editText);
                editText.Touch += EditTextOnClick;

                ImageView searchViewIcon = (ImageView)SearchBox.FindViewById(Resource.Id.search_mag_icon);
                searchViewIcon.SetColorFilter(Color.Gray);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            handler = new Handler();

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.search_dark_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

            searchView           = FindViewById <SearchView>(Resource.Id.searchView);
            searchView.Focusable = false;
            searchView.SetIconifiedByDefault(true);
            searchView.OnActionViewExpanded();
            searchView.SetOnQueryTextListener(this);

            var searchAutoComplete = (SearchView.SearchAutoComplete)searchView.FindViewById(Resource.Id.search_src_text);

            searchAutoComplete.SetTextColor(GetColorStateList(Resource.Color.title_color));
            searchAutoComplete.SetTextSize(Android.Util.ComplexUnitType.Sp, 14);
            searchAutoComplete.SetHintTextColor(GetColorStateList(Resource.Color.subtitle_color));
            searchAutoComplete.OnFocusChangeListener = this;

            StatusBarCompat.SetOrdinaryToolBar(this);

            bottomBar = BottomBar.AttachShy(FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout), FindViewById(Resource.Id.frameContent), savedInstanceState);

            bottomBar.UseFixedMode();
            bottomBar.SetItems(Resource.Menu.bottombar_menu);
            bottomBar.SetOnTabClickListener(this);
        }
Esempio n. 8
0
        private void InitToolbar(View view)
        {
            try
            {
                var toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar);
                GlobalContext.SetToolBar(toolbar, "");

                SearchBox = view.FindViewById <SearchView>(Resource.Id.searchBox);
                SearchBox.SetQuery("", false);
                SearchBox.SetIconifiedByDefault(false);
                SearchBox.OnActionViewExpanded();
                SearchBox.Iconified        = false;
                SearchBox.QueryTextChange += SearchBoxOnQueryTextChange;
                SearchBox.QueryTextSubmit += SearchBoxOnQueryTextSubmit;
                SearchBox.ClearFocus();

                //Change text colors
                var editText = (EditText)SearchBox.FindViewById(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.Gray);
                editText.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                //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);
            }
        }
Esempio n. 9
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater menuInflater)                //Отличается от OnCreateOptionsMenu в Activity: возвращает void и принимает 2 параметра
        {
            base.OnCreateOptionsMenu(menu, menuInflater);

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

            MenuItemCompat.SetOnActionExpandListener(item, new SearchViewExpandListener(myEventsAdapter));
            var searchItem = MenuItemCompat.GetActionView(item);

            _searchView = searchItem.JavaCast <Android.Support.V7.Widget.SearchView>();

            if (_searchView != null)
            {
                try
                {
                    _searchView.QueryTextChange += (s, e) => myEventsAdapter.Filter.InvokeFilter(e.NewText);
                    _searchView.QueryTextSubmit += (s, e) =>
                    {
                        Toast.MakeText(Activity, "Searched for: " + e.Query, ToastLength.Short).Show();             //Do something fancy when search button on keyboard is pressed
                        //e.Handled = true;
                    };
                }
                catch (Exception e) { var a = e; throw; }
            }
        }
Esempio n. 10
0
        private void InitComponent(View view)
        {
            try
            {
                SearchView = view.FindViewById <SearchView>(Resource.Id.searchviewbox);
                SearchView.SetQuery("", false);
                SearchView.ClearFocus();
                SearchView.OnActionViewExpanded();
                SearchView.SetIconifiedByDefault(true);
                SearchView.OnActionViewExpanded();

                //Change text colors
                var editText = (EditText)SearchView.FindViewById(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.Gray);
                editText.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                TabLayout = view.FindViewById <TabLayout>(Resource.Id.Searchtabs);
                ViewPager = view.FindViewById <ViewPager>(Resource.Id.Searchviewpager);

                AppBarLayout = view.FindViewById <AppBarLayout>(Resource.Id.mainAppBarLayout);
                AppBarLayout.SetExpanded(true);

                //Set Tab
                ViewPager.OffscreenPageLimit = 2;
                SetUpViewPager(ViewPager);
                TabLayout.SetupWithViewPager(ViewPager);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 11
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _keyboardProvider  = Locator.Resolve <IKeyboardProvider>();
            _navigationService = Locator.Resolve <INavigationService>();

            SetContentView(Resource.Layout.main);
            CheckGooglePlayServicesIsInstalled();
            TitleTextView = FindViewById <TextView>(Resource.Id.toolbarTitleTextView);
            SearchView    = FindViewById <SearchView>(Resource.Id.toolbarSearchView);

            _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(_toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(false);

            _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            _drawerToggle = new ActionBarDrawerToggle(this, _drawerLayout, _toolbar, 0, 0);

            _drawerLayout.DrawerOpened += (_, __) => _drawerToggle.DrawerIndicatorEnabled = true;
            _drawerLayout.ViewTreeObserver.AddOnGlobalLayoutListener(this);
            _drawerLayout.AddDrawerListener(_drawerToggle);
            _drawerToggle.SyncState();

            FragmentManager.AddOnBackStackChangedListener(this);
            Forms.Init(this, savedInstanceState);
            await CheckPermission();

            _navigationService.NavigateTo <MainViewModel>(true);
        }
Esempio n. 12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            var GoTocartPageFloatingActionButton = FindViewById <FloatingActionButton>(Resource.Id.GoToCartPageButton);

            GoTocartPageFloatingActionButton.Click += GoToCartPage_Click;


            this.SearchView = FindViewById <SearchView>(Resource.Id.searchView);
            this.SearchView.QueryTextChange += SearchView_QueryTextChange;
            this.Products                    = ProductAPIController.GetProducts().Result;
            this.Adapter                     = new ProductsAdapter(this, this.Products, Resource.Layout.ProductAdapterItem);
            this.ProductsGridView            = FindViewById <GridView>(Resource.Id.ProductListView);
            this.ProductsGridView.ItemClick += ProductsGridView_ItemClick;
            this.FilterImageView             = FindViewById <ImageView>(Resource.Id.FilterImageView);
            this.FilterImageView.Click      += FilterImageView_Click;


            this.SortBySpiner               = FindViewById <Spinner>(Resource.Id.SortBySpiner);
            this.SortBySpiner.Adapter       = new ArrayAdapter(this, Android.Resource.Layout.SimpleExpandableListItem1, SearchByItems);
            this.SortBySpiner.ItemSelected += SortBySpiner_ItemSelected;



            this.ProductDescriptionActivityGenericTask = new Task <Intent>(() => new Intent(this, typeof(ProductDescriptionActivity)));
            this.ProductDescriptionActivityGenericTask.Start();
            this.CartActivityGenericTask = new Task <Intent>(() => new Intent(this, typeof(CartActivity)));
            this.CartActivityGenericTask.Start();
        }
Esempio n. 13
0
        private void AddSearchToToolBar()
        {
            if (Element == null)
            {
                return;
            }
            if (MainActivity.ToolBar == null)
            {
            }

            var toolBar = MainActivity.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
        }
Esempio n. 14
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.SearchMenu, menu);
            menu.TintIcons();

            //// Associate searchable configuration with the SearchView
            var item = menu.FindItem(Resource.Id.ActionSearch);

            //var searchView = MenuItemCompat.GetActionView(item);
            //var a = item.ActionView;
            _searchView = new SearchView(this);
            MenuItemCompat.SetActionView(item, _searchView);
            item.SetShowAsAction(ShowAsAction.CollapseActionView | ShowAsAction.IfRoom);
            //item.SetActionView(_searchView);

            _searchView.FocusChange += SearchView_FocusChange;
            _searchView.SetOnQueryTextFocusChangeListener(this);
            //item.SetOnMenuItemClickListener(this);

            _searchView.QueryTextChange += (sender, e) => {
                _adapter.Filter.InvokeFilter(e.NewText);
                System.Diagnostics.Debug.WriteLine("Shown elements :" + _adapter.Count);
            };

            _searchView.QueryTextSubmit += async(sender, e) =>
            {
                var searchResult = await _storage.SearchRepositories(e.Query);

                _adapter.Replace(searchResult);

                e.Handled = true;
            };

            return(true);
        }
        /// <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.menu_calendar, menu);

            try
            {
                var searchItem = menu.FindItem(Resource.Id.menu_search);

                var searvView = Android.Support.V4.View.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)
            {
            }
        }
Esempio n. 16
0
        private void AddSearchToToolBar()
        {
            var maintoolbar = MainActivity.ToolBar;

            //var maintoolbar = MainActivity.GetToolbar();
            //var maintoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            if (maintoolbar == null || Element == null)
            {
                return;
            }
            isLoaded          = true;
            maintoolbar.Title = Element.Title;
            maintoolbar.InflateMenu(Resource.Menu.mainmenu);

            _searchView = maintoolbar.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;
        }
Esempio n. 17
0
 public getAllEvent(FragmentActivity activity, ListView lvEventSearch, string query, TextView emptyText, SearchView searchView)
 {
     this.searchView    = searchView;
     this.emptyText     = emptyText;
     this.activity      = activity;
     this.lvEventSearch = lvEventSearch;
     this.query         = query;
 }
 public WeClipSearchFragmentLoadData(FragmentActivity activity, GridView gvWeClip, string query, TextView emptyText, SearchView searchView)
 {
     this.searchView = searchView;
     this.emptyText  = emptyText;
     this.activity   = activity;
     this.gvWeClip   = gvWeClip;
     this.query      = query;
 }
 public getAllUserData(FragmentActivity activity, ListView lvAllUser, string query, TextView emptyText, SearchView searchView)
 {
     this.searchView = searchView;
     this.emptyText  = emptyText;
     this.activity   = activity;
     this.lvAllUser  = lvAllUser;
     this.query      = query;
 }
Esempio n. 20
0
        void SetupSearchInput(Android.Support.V7.Widget.SearchView searchView)
        {
            var searchManager = Activity.GetSystemService(Context.SearchService).JavaCast <SearchManager> ();

            searchView.SetIconifiedByDefault(false);
            var searchInfo = searchManager.GetSearchableInfo(Activity.ComponentName);

            searchView.SetSearchableInfo(searchInfo);
        }
Esempio n. 21
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.search_toolbar, menu);
            IMenuItem searchItem = menu.FindItem(Resource.Id.search);

            searchItem.ExpandActionView();
            searchView           = searchItem.ActionView.JavaCast <SearchView>();
            searchView.MaxWidth  = int.MaxValue;
            searchView.QueryHint = GetString(Resource.String.youtube_search);
            searchView.SetQuery(((SearchView)MainActivity.instance.menu.FindItem(Resource.Id.search).ActionView).Query, false);
            searchView.QueryTextChange += (s, e) =>
            {
                Console.WriteLine("&Search view query changed, newText: " + e.NewText);
                if (e.NewText.Length > 0)
                {
                    Task.Run(() =>
                    {
                        try
                        {
                            using (WebClient client = new WebClient {
                                Encoding = System.Text.Encoding.UTF7
                            })
                            {
                                string json         = client.DownloadString("http://suggestqueries.google.com/complete/search?client=youtube&ds=yt&client=firefox&q=" + /*WebUtility.HtmlEncode(*/ e.NewText /*)*/);
                                json                = json.Substring(json.IndexOf(",") + 1);
                                json                = json.Remove(json.Length - 1);
                                List <string> items = JsonConvert.DeserializeObject <List <string> >(json);
                                suggestions         = items.ConvertAll(StringToSugest);
                                suggestions.InsertRange(0, History.Where(x => x.Text.StartsWith(e.NewText)));

                                if (SearchQuery == null || SearchQuery == "")
                                {
                                    RunOnUiThread(new Java.Lang.Runnable(() => { ListView.Adapter = new SuggestionAdapter(instance, Resource.Layout.SuggestionLayout, suggestions); }));
                                }
                            }
                        }
                        catch (Exception ex) { Console.WriteLine("&Search ex: " + ex.Message); }
                    });
                }
                else
                {
                    suggestions      = History;
                    adapter          = new SuggestionAdapter(instance, Resource.Layout.SuggestionLayout, suggestions);
                    ListView.Adapter = adapter;
                }
            };
            searchView.QueryTextSubmit += (s, e) =>
            {
                SearchQuery = e.NewText;
                AddQueryToHistory(e.NewText);
                Finish();
                OverridePendingTransition(0, 0);
                e.Handled = true;
            };
            searchItem.SetOnActionExpandListener(this);
            return(base.OnCreateOptionsMenu(menu));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            ViewModel = (EventViewModel)DataContext;
            Title     = ViewModel.EventName;

            SetActivityContentView(Resource.Layout.Event, Resource.Id.event_swipeRefreshLayout);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SetUpProgressDialog(this, "Loading Event...");

            ListView           = FindViewById <ListView>(Resource.Id.membersList);
            ListView.EmptyView = LayoutInflater.Inflate(Resource.Layout.emptyview, null);

            SearchView = FindViewById <SearchView>(Resource.Id.event_searchview);

            MemberAdapter       = new MemberAdapter(this, ViewModel.Members);
            ListView.Adapter    = MemberAdapter;
            ListView.ChoiceMode = ChoiceMode.Multiple;

            RSVPCounterTextView = FindViewById <TextView>(Resource.Id.taptocheckin_text);

            #region Events

            SearchView.QueryTextChange += (s, e) => MemberAdapter.Filter(e.NewText);

            SearchView.QueryTextSubmit += (s, e) => MemberAdapter.Filter(e.Query);

            ViewModel.Members.CollectionChanged += (s, e) =>
            {
                MemberAdapter.UpdateListView();
            };

            ViewModel.FinishedFirstLoad += (index) =>
            {
                if (ViewModel.Members.Count == 0)
                {
                    return;
                }

                Timer timer = new Timer()
                {
                    Interval = 1000
                };
                timer.Elapsed += (s, e) => RunOnUiThread(() => ListView.SetSelection(index));
            };

            MemberCheckedIn += (int pos) =>
            {
                ViewModel.CheckInCommand?.Execute(ViewModel.Members[pos]);
            };

            ViewModel.CountRefreshed += (s, e) => RefreshRSVPCounterTextView();

            #endregion
        }
Esempio n. 23
0
        private void SetupSearchView()
        {
            _searchView = _toolbar.FindViewById <SearchView>(Resource.Id.action_search);

            var searchIcon = (ImageView)_searchView.FindViewById(Resource.Id.search_button);

            searchIcon.SetImageResource(Resource.Mipmap.baseline_search_white_24);

            _searchView.QueryTextChange += (sender, args) => { SearchTextChanged?.Invoke(this, EventArgs.Empty); };
        }
Esempio n. 24
0
        private void AddSearchToToolBar()
        {
            var search         = Element as TabbedSearchPage;
            var searchTextTemp = string.Empty;

            if (search.SearchText != null)
            {
                searchTextTemp = search.SearchText;
            }

            var maintoolbar = MainActivity.ToolBar;

            if (maintoolbar == null || Element == null)
            {
                System.Diagnostics.Debug.WriteLine("SearchPageRenderer ToolBar or Element is null");
                return;
            }
            maintoolbar.Title = Element.Title;
            maintoolbar.InflateMenu(Resource.Menu.mainmenu);
            //if (MainActivity.ToolBar == null || Element == null)
            //{
            //    System.Diagnostics.Debug.WriteLine("SearchPageRenderer ToolBar or Element is null");
            //    return;
            //}

            //MainActivity.ToolBar.Title = Element.Title;
            //MainActivity.ToolBar.InflateMenu(Resource.Menu.mainmenu);

            var actionSearch = Resource.Id.action_search;

            System.Diagnostics.Debug.WriteLine("SearchPageRenderer AddSearchToToolBar actionSearch " + actionSearch);
            _searchView = maintoolbar.Menu?.FindItem(Resource.Id.action_search)?.ActionView?.JavaCast <SearchView>();
            // _searchView = MainActivity.ToolBar.Menu?.FindItem(Resource.Id.action_search)?.ActionView?.JavaCast<SearchView>();

            if (_searchView == null)
            {
                return;
            }

            //default open but has a debug make searchview hasnot cursor
            // _searchView.OnActionViewExpanded();
            //_searchView.SetBackgroundColor(Android.Graphics.Color.Green);
            //_searchView.SetIconifiedByDefault(false);

            _searchView.OnActionViewExpanded();
            _searchView.QueryTextChange += searchView_QueryTextChange;
            _searchView.QueryTextSubmit += searchView_QueryTextSubmit;

            //_searchView.QueryHint = (Element as SearchPage)?.SearchPlaceHolderText;
            //_searchView.ImeOptions = (int)Android.Views.InputMethods.ImeAction.Search;
            // donn't use this code it make the cursor miss
            //_searchView.InputType = (int)Android.Text.InputTypes.TextVariationNormal;
            //_searchView.MaxWidth = int.MaxValue;
            _searchView.SetQuery(searchTextTemp, false);
        }
Esempio n. 25
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.optionmenu, menu);
            menuitem = menu.FindItem(Resource.Id.action_search);
            var test = new SearchView(this);

            menuitem.SetActionView(test);
            var searchView = MenuItemCompat.GetActionView(menuitem);

            int       searchImgId = Resources.GetIdentifier("android:id/search_button", null, null);
            ImageView v           = (ImageView)searchView.FindViewById(searchImgId);

            //v.SetImageResource(Resource.Drawable.abc_ic_search);

            _searchView = searchView.JavaCast <SearchView>();

            setSearchIcons(_searchView);

            _searchView.QueryTextChange += (s, e) =>
            {
                var searchFor = e.NewText.ToLower();
                if (!String.IsNullOrEmpty(searchFor))
                {
                    //Console.System.Diagnostics.Debug.WriteLine("searchFor:" + searchFor);

                    // 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 _approvalList where i.POID.ToLower().Contains(searchFor) select i).ToList();
                    //foreach (var match in matches) {
                    //matchList.Add (match);
                    //}
                    ApprovalDetailList list = new ApprovalDetailList(this);

                    matches.ForEach(model => list.Add(model));
                    _approvalListAdapter.SetData(list);
                    _approvalListAdapter.NotifyDataSetChanged();
                    //if (_searchListView.Visibility == ViewStates.Gone && _searchView.Iconified == false)
                    //{
                    //    //_searchListView.Visibility = ViewStates.Visible;
                    //    _searchView.Iconified = true;
                    //}
                }
                else
                {
                    _approvalListAdapter.SetData(_approvalList);
                    _approvalListAdapter.NotifyDataSetChanged();
                }
            };
            _searchView.SetOnQueryTextFocusChangeListener(new CustomSearchViewOnFocusChangeListenter(this));
            _searchView.SetOnSearchClickListener(new CustomSearchviewclicklistener(rltitle));
            _searchView.SetOnCloseListener(new CustomSearchViewOnCloseListenter(rltitle, _approvalListAdapter, _approvalList));
            return(base.OnCreateOptionsMenu(menu));
        }
Esempio n. 26
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            var inflater = MenuInflater;

            inflater.Inflate(Resource.Menu.menu_main, menu);
            IMenuItem mSearch = menu.FindItem(Resource.Id.searchview);

            Android.Support.V7.Widget.SearchView mSearchView = (Android.Support.V7.Widget.SearchView)mSearch.ActionView;
            mSearchView.Visibility = ViewStates.Gone;

            return(true);
        }
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu_project_name, menu);
            var menuItem   = menu.FindItem(Resource.Id.action_project_search);
            var searchView = MenuItemCompat.GetActionView(menuItem);

            SearchView sView = searchView.JavaCast <SearchView>();

            sView.QueryTextChange += SearchQueryTextChange;

            return(true);
        }
Esempio n. 28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.HouseSearch);
            user_email = Intent.GetStringExtra("User_email");

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar1);

            searchbar = FindViewById <Android.Support.V7.Widget.SearchView>(Resource.Id.searchView1);
            mlistview = FindViewById <ListView>(Resource.Id.listViewSearchHouse);
            var layoutallcontent = FindViewById <LinearLayout>(Resource.Id.linearLayoutallcontent);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.toolbar_housesearch);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            toolbar.SetTitleTextAppearance(this, Resource.Style.ActionBarTitle);

            searchbar.QueryHint = toolbar.Title;
            adapter             = new MyHouseSearchAdapter(this, user_email);
            mlistview.Adapter   = adapter;

            GetUserHouses();

            searchbar.Click += delegate
            {
                searchbar.OnActionViewExpanded();
            };

            searchbar.QueryTextChange += delegate
            {
                SearchHouse(searchbar.Query);
            };

            searchbar.FocusChange += (e, s) =>
            {
                if (!s.HasFocus)
                {
                    InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                    imm.HideSoftInputFromWindow(this.searchbar.WindowToken, 0);
                }
            };



            layoutallcontent.Click += delegate
            {
                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(this.searchbar.WindowToken, 0);
            };
        }
Esempio n. 29
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            UserDialogs.Init(this);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            Instance            = this;
            listView            = FindViewById <ListView>(Resource.Id.lvresults);
            listView.ItemClick += OnListItemClick;
            toolbar             = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "TorrentTools";
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_backarrow);
            //SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            layoutWelcome = FindViewById <RelativeLayout>(Resource.Id.layout_welcome);

            tvStatusText              = FindViewById <IconTextView>(Resource.Id.status_text);
            rlStatusLayout            = FindViewById <RelativeLayout>(Resource.Id.status_layout);
            rlStatusLayout.Visibility = Android.Views.ViewStates.Gone;
            torSearchView             = FindViewById <Android.Support.V7.Widget.SearchView>(Resource.Id.menu_search);
            statusAnimShow            = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_slide_in_top);
            listViewAnimShow          = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_slide_in_bottom);
            statusAnimHide            = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_fade_out);
            welcomeAnimShow           = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_grow_fade_in_from_bottom);
            welcomeAnimShow.Duration  = 1000;
            layoutWelcome.Animation   = welcomeAnimShow;
            listViewAnimHide          = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_slide_out_bottom);

            Iconify.with(new MaterialModule());
            Iconify.with(new FontAwesomeModule());
            Iconify.with(new MaterialCommunityModule());
            //layoutWelcome.Visibility = ViewStates.Visible;
            //LoadFragment("SearchFragment");
            IsConnected    = true;
            searchCategory = TpbTorrentCategory.All;
            searchOrder    = TpbQueryOrder.ByDefault;

            var searchFragment = new SearchFragment();

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, searchFragment)
            .Commit();

            //Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;

            //Check network connection
            //var current = Connectivity.NetworkAccess;
            //if (current != NetworkAccess.Internet)
            //{
            // Toast.MakeText(this, "No internet connection detected", ToastLength.Short).Show();
            // }
        }
Esempio n. 30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.SearchView searchView = FindViewById <Android.Support.V7.Widget.SearchView>(Resource.Id.searchView);
            ImageView mCloseButton = (ImageView)searchView.FindViewById(Resource.Id.search_close_btn);

            mCloseButton.Enabled = false;
            mCloseButton.SetImageDrawable(null);
        }
Esempio n. 31
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            base.OnCreateOptionsMenu(menu, inflater);

            inflater.Inflate(HasSearchView ? Resource.Menu.options_menu : Resource.Menu.options_menu_nosearch, menu);

            IMenuItem searchItem = menu.FindItem(Resource.Id.action_search);
            if(null == searchItem) {
                return;
            }

            View actionView = Android.Support.V4.View.MenuItemCompat.GetActionView(searchItem);
            FilterView = actionView.JavaCast<Android.Support.V7.Widget.SearchView>();

            // TODO: let the subclasses set this up
            FilterView.QueryHint = Resources.GetString(Resource.String.search_hint);
        }
    public override bool OnCreateOptionsMenu(IMenu menu)
    {
      this.MenuInflater.Inflate(Resource.Menu.menu_search, menu);

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

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

      searchView.QueryTextSubmit += (sender, args) =>
      {
        Toast.MakeText(this, "You searched: " + args.Query, ToastLength.Short).Show();
      
      };


      return base.OnCreateOptionsMenu(menu);
    }
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.main, menu);

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

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

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

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

                try
                {
                    var json = WebServices.getSearchResult(e.Query);
                    var ProdData = JsonConvert.DeserializeObject<WebServices.RootObject> (json);

                    Console.Error.WriteLine(ProdData.data[0].title);
                }
                catch
                {
                    RunOnUiThread (() => {
                        chemicals.Clear();
                        _adapter.NotifyDataSetChanged ();
                        _adapter.NotifyDataSetInvalidated();

                    });

                    Console.Error.WriteLine("Tiada padanan"+chemicals.Count);
                }
                e.Handled = true;
                _searchView.ClearFocus();
            };

            MenuItemCompat.SetOnActionExpandListener(item, new SearchViewExpandListener(_adapter));

            return true;
        }
Esempio n. 34
0
		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			var inflater = MenuInflater;
			inflater.Inflate(Resource.Menu.actions, menu);
			var arg1 = menu.FindItem (Resource.Id.action_search);

			var test = new Android.Support.V7.Widget.SearchView (this);
			arg1.SetActionView (test);

			var searchView = MenuItemCompat.GetActionView (arg1);
			var searchView2 = searchView as Android.Support.V7.Widget.SearchView;
			searchView2.QueryTextChange += (sender, e) => {
				e.Handled = OnQueryTextChange (e.NewText);
			};

			searchView2.QueryTextSubmit += (sender, e) => {
				e.Handled = OnQueryTextSubmit (e.Query);
			};

			return true;
		}
Esempio n. 35
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate(Resource.Menu.search_menu, menu);

            var inflatedSearchView = menu.FindItem(Resource.Id.search);
            var actionSearchView = new Android.Support.V7.Widget.SearchView(Activity);
            inflatedSearchView.SetActionView(actionSearchView);

            var actionView = MenuItemCompat.GetActionView(inflatedSearchView);

            
            _searchView = actionView as Android.Support.V7.Widget.SearchView;
            if (_searchView != null)
            {
                _searchView.QueryTextSubmit += sView_QueryTextSubmit;
                _searchView.QueryTextChange += sView_QueryTextChange;

                // Change the search text color to white.
                // See SearchView Source code @ https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/SearchView.java
                var queryTextView = _searchView.FindViewById(Resource.Id.search_src_text) as EditText;
                if (queryTextView != null)
                {
                    queryTextView.SetTextColor(Color.White);
                }
            }

            base.OnCreateOptionsMenu(menu, inflater);
        }
Esempio n. 36
0
		public override bool OnCreateOptionsMenu (IMenu menu)
		{
			//change menu_search to your name
			if (!refreshing) {
				this.MenuInflater.Inflate (Resource.Menu.menu_home, menu);

				if (viewModel.Places.Count == 0)
					menu.RemoveItem (Resource.Id.action_navigation);

				var searchItem = menu.FindItem (Resource.Id.action_search);
				var provider = MenuItemCompat.GetActionView (searchItem);
				searchView = provider.JavaCast<Android.Support.V7.Widget.SearchView> ();

				searchView.QueryTextSubmit += (sender, args) => {
					RefreshData (true, args.Query.Trim ());
					var view = sender as Android.Support.V7.Widget.SearchView;
					if (view != null)
						view.ClearFocus ();
				};
			}
			return base.OnCreateOptionsMenu (menu);
		}