public override bool OnCreateOptionsMenu(IMenu menu) { //change main_compat_menu ImageView iconsearch = (ImageView)FindViewById(Resource.Id.search_button); MenuInflater.Inflate(Resource.Menu.MenuToolbar, menu); //***** var item = menu.FindItem(Resource.Id.action_search); var searchView = MenuItemCompat.GetActionView(item); SearchView _searchView = searchView.JavaCast <Android.Widget.SearchView>(); _searchView.QueryTextChange += (s, e) => mAdapter.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(); e.Handled = true; }; MenuItemCompat.SetOnActionExpandListener(item, new SearchViewExpandListener(mAdapter)); //***** return(base.OnCreateOptionsMenu(menu)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var builder = new StrictMode.VmPolicy.Builder(); var policy = builder.DetectActivityLeaks().PenaltyLog().Build(); StrictMode.SetVmPolicy(policy); SetContentView(Resource.Layout.Main); SearchView = FindViewById <Android.Widget.SearchView>(Resource.Id.SearchView); StateIndicator = FindViewById <TextView>(Resource.Id.StateIndicator); TryNewScreen = FindViewById <Button>(Resource.Id.OpenNewActivity); TryNewScreen.Click += GoToSecondScreen; retainedFragment = FragmentManager.FindFragmentByTag("SearchPresenter") as SearchFragment; if (retainedFragment == null) { retainedFragment = new SearchFragment(); FragmentManager.BeginTransaction().Add(retainedFragment, "SearchPresenter").Commit(); retainedFragment.Presenter = new SearchPresenter(new SearchUseCase(new MySearchApi())); } retainedFragment.Presenter.AttachView(this); retainedFragment.Presenter.BindIntents(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.creating_test_view); testLogic = new GenerateOrCreateTestLogic(); searchViewWords = FindViewById <SearchView>(Resource.Id.sv_word_search); recyclerViewWords = FindViewById <RecyclerView>(Resource.Id.rv_words); buttonRu = FindViewById <Button>(Resource.Id.btn_ru); buttonEn = FindViewById <Button>(Resource.Id.btn_en); buttonStartTest = FindViewById <Button>(Resource.Id.btn_start_creating_test); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recyclerViewWords.SetLayoutManager(layoutManager); wordsAdapter = new WordsAdapter(testLogic, "ru"); recyclerViewWords.SetAdapter(wordsAdapter); buttonRu.Enabled = false; buttonRu.SetBackgroundResource(Resource.Drawable.background_ru_disenabled_button); searchViewWords.QueryTextChange += (sender, e) => TextChange(e.NewText); buttonRu.Click += (sender, e) => SelectRuWords(); buttonEn.Click += (sender, e) => SelectEnWords(); buttonStartTest.Click += (sender, e) => StartTest(); }
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater) { Activity.MenuInflater.Inflate (Resource.Menu.schedule_menu, menu); //Handle share action provider var shareMenuItem = menu.FindItem (Resource.Id.action_schedule_share); var shareActionProvider = (ShareActionProvider)shareMenuItem.ActionProvider; shareActionProvider.SetShareIntent (CreateIntent ()); //Handle search action provider var searchOption = menu.FindItem(Resource.Id.action_schedule_search); //Handle expand/colapse of action bar MenuItemCompat.SetOnActionExpandListener(searchOption, new SearchViewExpandListener(_adapter)); var searchItem = MenuItemCompat.GetActionView(searchOption); _searchView = searchItem.JavaCast<SearchView>(); _searchView.QueryTextChange += (s, e) => _adapter.Filter.InvokeFilter(e.NewText); _searchView.QueryTextSubmit += (s, e) => { Toast.MakeText(Activity, "Searched for: " + e.Query, ToastLength.Short).Show(); e.Handled = true; }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SelectCustomer); Android.Widget.SearchView searchView = FindViewById <Android.Widget.SearchView>(Resource.Id.searchViewCustomers); //get all customers from database customers = DatabaseRequest.GetAllFromTable <Customer>().OrderBy(x => x.Company).ToList(); //populate RecyclerView with all customers customersRecyclerView = FindViewById <RecyclerView>(Resource.Id.customersRecyclerView); customersLayoutManager = new LinearLayoutManager(this); customersRecyclerView.SetLayoutManager(customersLayoutManager); customersAdapter = new CustomersAdapter(customers); customersAdapter.ItemClick += OnItemClick; customersRecyclerView.SetAdapter(customersAdapter); searchView.QueryTextChange += delegate { string currentSearchViewValue = searchView.Query; var currentCustomersSearched = customers.Where(x => x.Company.ToLower().Contains(currentSearchViewValue.ToLower())).ToList(); //repopulate RecyclerView with currentCustomersSearched customersAdapter = new CustomersAdapter(currentCustomersSearched); customersAdapter.ItemClick += OnItemClick; customersRecyclerView.SetAdapter(customersAdapter); }; }
public override bool OnCreateOptionsMenu(IMenu menu) { try { var inflater = MenuInflater; inflater.Inflate(Resource.Menu.actions, menu); var arg1 = menu.FindItem(Resource.Id.action_search); var test = new Android.Widget.SearchView(this); arg1 .SetActionView(test) .SetShowAsAction(ShowAsAction.Always); var searchView = MenuItemCompat.GetActionView(arg1); //_searchView = searchView.JavaCast<Android.Support.V7.Widget.SearchView>(); var _searchView = searchView.JavaCast <SearchView>(); setSearchIcons(_searchView); _searchView.QueryTextChange += (s, e) => { adapter.Filter.InvokeFilter(e.NewText); }; _searchView.SetOnSearchClickListener(new ProductionSearchviewclicklistener(rltitle)); } catch (System.Exception ex) { // CustomLogger.CustomLog("From Activity: " + application.CurrentActivity + "\nMessage: " + ex.Message + "Stack Trace: " + ex.StackTrace + "\n\n", "", application.CurrentUserName); } return(base.OnCreateOptionsMenu(menu)); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.taskin_layout, null); recyclerview = view.FindViewById <RecyclerView>(Resource.Id.recyclerview1); linearLayout = view.FindViewById <LinearLayout>(Resource.Id.linearlayout1); prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); u_id = prefs.GetString("DesignationId", ""); geo = new Geolocation(); geolocation = geo.GetGeoLocation(Activity); HasOptionsMenu = true; //DividerItemDecoration itemDecor = new DividerItemDecoration(Activity, Orientation.Horizontal); //recyclerview.AddItemDecoration(itemDecor); DividerItemDecoration horizontalDecoration = new DividerItemDecoration(recyclerview.Context, DividerItemDecoration.Vertical); Drawable horizontalDivider = ContextCompat.GetDrawable(Activity, Resource.Drawable.divider); horizontalDecoration.SetDrawable(horizontalDivider); recyclerview.AddItemDecoration(horizontalDecoration); search = view.FindViewById <Android.Widget.SearchView>(Resource.Id.searchview); search.QueryTextChange += sv_QueryTextChange; getData(); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.taskin_layout, null); // temp_var = taskidmodel[0].taskid.ToString(); //initialTasks = db.GetinitialTaskssavelist(designationid); recyclerview = view.FindViewById <RecyclerView>(Resource.Id.recyclerview1); LinearLayout = view.FindViewById <LinearLayout>(Resource.Id.linearlayout1); DividerItemDecoration horizontalDecoration = new DividerItemDecoration(recyclerview.Context, DividerItemDecoration.Vertical); Drawable horizontalDivider = ContextCompat.GetDrawable(Activity, Resource.Drawable.divider); horizontalDecoration.SetDrawable(horizontalDivider); recyclerview.AddItemDecoration(horizontalDecoration); search = view.FindViewById <Android.Widget.SearchView>(Resource.Id.searchview); markdataAsync(); //else //{ // if (initialTasks.Count != 0) // { // recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false); // recyclerview.SetLayoutManager(recyclerview_layoutmanger); // recyclerview_adapter = new SavedTaskAdapter(Activity, initialTasks, recyclerview, FragmentManager); // recyclerview.SetAdapter(recyclerview_adapter); // } //} return(view); }
public static void SetTheme(this SearchView searchView, string editTextBackground, string textColor = null, string textSize = null, string fontStyle = null) { searchView.SetBackgroundColor(_theme.Colors[editTextBackground]); var editText = GetEditTextFromSearchView(searchView); editText.SetTheme( backgroundColor: editTextBackground, textColor: textColor, textSize: textSize, fontStyle: fontStyle); }
private void HandleQueryTextChanged(object sender, SearchView.QueryTextChangeEventArgs e) { var target = Target as SearchView; if (target == null) { return; } var value = target.Query; FireValueChanged(value); }
public void Include(Android.Widget.SearchView searchView) { searchView.QueryTextChange += (s, e) => { if (searchView.Query == null) { searchView.SetQuery(string.Empty, false); } }; searchView.QueryTextSubmit += (s, e) => { if (searchView.QueryHint == null) { searchView.SetQueryHint(string.Empty); } }; }
public override Android.Views.View GetSampleContent (Android.Content.Context context) { LinearLayout linear = new LinearLayout(context); linear.Orientation = Orientation.Vertical; sfGrid = new SfDataGrid (context); viewModel = new FilteringViewModel (context); viewModel.SetRowstoGenerate (100); sfGrid.AlternatingRowColor = Color.Rgb (206, 206, 206); this.sfGrid.AutoGeneratingColumn += GridAutoGenerateColumn; sfGrid.ItemsSource = (viewModel.BookInfo); filterText = new SearchView(context); filterText.SetQueryHint( "Enter the Text to filter"); filterText.QueryTextChange += OnFilterTextChanged; viewModel.filtertextchanged = OnFilterChanged; linear.AddView(filterText); linear.AddView(sfGrid); return linear; }
public override bool OnCreateOptionsMenu(IMenu menu) { try { var inflater = MenuInflater; inflater.Inflate(Resource.Menu.actions, menu); var arg1 = menu.FindItem(Resource.Id.action_search); var test = new Android.Widget.SearchView(this); arg1 .SetActionView(test) .SetShowAsAction(ShowAsAction.Always); var searchView = MenuItemCompat.GetActionView(arg1); //_searchView = searchView.JavaCast<Android.Support.V7.Widget.SearchView>(); var _searchView = searchView.JavaCast <SearchView>(); setSearchIcons(_searchView); //_searchView.SetBackgroundColor(Color.White); //_searchView.SetOnClickListener(new SearchViewOnClickListener(_searchListView)); //_searchView.Click += (s, e) => //{ // _adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, // truckList.Select(t => t.TruckName).ToArray()); // _searchListView.Adapter = _adapter; //}; _searchView.QueryTextChange += (s, e) => { adapter.Filter.InvokeFilter(e.NewText); //_searchListView.Visibility = ViewStates.Visible; }; _searchView.SetOnCloseListener(new TruckSearchViewOnCloseListenter(rltitle, this)); _searchView.SetOnSearchClickListener(new TruckSearchviewclicklistener(rltitle)); //ImageView searchIcon = (ImageView)_searchView.FindViewById(); //searchIcon.setImageResource(R.drawable.abc_ic_search); } catch (System.Exception ex) { // CustomLogger.CustomLog("From Activity: " + application.CurrentActivity + "\nMessage: " + ex.Message + "Stack Trace: " + ex.StackTrace + "\n\n", "", application.CurrentUserName); } return(base.OnCreateOptionsMenu(menu)); }
protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e) { base.OnElementChanged(e); if (e.NewElement != null) { MySearchBar Content = e.NewElement as MySearchBar; this.Control.SetBackgroundResource(Resource.Drawable.back_for_search); Android.Widget.SearchView searchView = (base.Control as Android.Widget.SearchView); int frameId = searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null); Android.Views.View frameView = (searchView.FindViewById(frameId) as Android.Views.View); frameView.SetBackgroundColor(Xamarin.Forms.Color.Transparent.ToAndroid()); // frameView.SetBackgroundResource(Resource.Drawable.textfield_searchview_holo_light); // Get native control (background set in shared code, but can use SetBackgroundColor here) searchView.SetInputType(InputTypes.ClassText | InputTypes.TextVariationNormal); // Access search textview within control int textViewId = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null); EditText textView = (searchView.FindViewById(textViewId) as EditText); // textView.SetBackgroundResource(Resource.Drawable.textfield_searchview_holo_light); // Set custom colors // textView.SetBackgroundColor( Android.Graphics.Color.White ); // textView.SetTextColor( G.Color.Rgb( 32, 32, 32 ) ); // textView.SetHintTextColor( G.Color.Rgb( 128, 128, 128 ) ); // // Customize frame color // int frameId = searchView.Context.Resources.GetIdentifier( "android:id/search_plate", null, null ); // Android.Views.View frameView = (searchView.FindViewById( frameId ) as Android.Views.View); // frameView.SetBackgroundColor( G.Color.Rgb( 96, 96, 96 ) ); // SetBackgr (this.Control); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment var view = inflater.Inflate(Resource.Layout.search_fragment, container, false); MainActivity.Instance.toolbar.SetTitle(Resource.String.search_title); MainActivity.Instance.SupportActionBar.SetDisplayHomeAsUpEnabled(false); searchView = view.FindViewById <Android.Widget.SearchView>(Resource.Id.searchView); var speakButton = view.FindViewById <ImageButton>(Resource.Id.ibSpeak); speakButton.SetImageDrawable(new IconDrawable(Application.Context, MaterialIcons.md_mic.ToString()).actionBarSize().colorRes(Resource.Color.colorTextWhite)); speakButton.Click += MainActivity.Instance.ShowFilterDialog; var spinnerCategory = view.FindViewById <Spinner>(Resource.Id.spinnerCategory); //spinnerCategory.setOnItemSelectedListener(this); spinnerCategory.Adapter = new CategoryListAdapter(MainActivity.Instance, categories); var spinnerOrder = view.FindViewById <Spinner>(Resource.Id.spinnerOrder); //spinnerCategory.setOnItemSelectedListener(this); spinnerOrder.Adapter = new OrderListAdapter(MainActivity.Instance, orderFilters); //searchView = view.FindViewById<Android.Support.V7.Widget.SearchView>(Resource.Id.searchView); //var simgid = searchView.Context.Resources.GetIdentifier("search_mag_icon", "id", ); //var id = searchView.Context.Resources.GetIdentifier("search_src_text", "id", null); //var searchEditText = searchView.FindViewById<EditText>(id); //var searchIcon = searchView.FindViewById<ImageView>(simgid); //searchIcon.SetColorFilter(Android.Graphics.Color.White); //searchEditText.SetTextColor(Android.Graphics.Color.White); //searchEditText.SetHintTextColor(Android.Graphics.Color.LightGray); //searchView.SubmitButtonEnabled = true; var btnSearch = view.FindViewById <Button>(Resource.Id.btnSearch); btnSearch.Click += ShowSearchResults; return(view); }
private void Init() { topToolbar = FindViewById <Toolbar>(Resource.Id.toolbarTopGroceriesList); groceryListView = FindViewById <ListView>(Resource.Id.listGroceries); categoriesComboBox = FindViewById <SfComboBox>(Resource.Id.cmboBoxCategories); searchButton = FindViewById <Button>(Resource.Id.btnSearchRecipe); searchButton.Click += SearchButton_Click; eatButton = FindViewById <Button>(Resource.Id.btnEat); eatButton.Click += EatButton_ClickAsync; searchView = FindViewById <SearchView>(Resource.Id.searchGroceries); groceriesFAB = FindViewById <FloatingActionButton>(Resource.Id.fABgroceries); groceriesFAB.Visibility = ViewStates.Invisible; if (ChamberOfSecrets.Instance.LoggedUser.UserStatus == Status.Nabavljac || ChamberOfSecrets.Instance.LoggedUser.UserStatus == Status.Administrator || ChamberOfSecrets.Instance.LoggedUser.UserStatus == Status.Supervizor) { groceriesFAB.Visibility = ViewStates.Visible; groceriesFAB.Click += GroceriesFAB_Click; } InitCategories(); SetDefault(); }
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "MyriadProRegular.ttf"); Android.Widget.SearchView label = (Android.Widget.SearchView)Control; AutoCompleteTextView objAutoTextView = (AutoCompleteTextView)(((this.Control. GetChildAt(0) as ViewGroup). GetChildAt(2) as ViewGroup). GetChildAt(1) as ViewGroup). GetChildAt(0); objAutoTextView.Typeface = font; // MySearchBar Content = sender as MySearchBar; objAutoTextView.Typeface = font; // objAutoTextView.set (Color.White); // objAutoTextView.SetHighlightColor (Color.White); // objAutoTextView.SetHighlightColor (Color.White); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ListaNotaslayout); listaRecycler = FindViewById <RecyclerView>(Resource.Id.listaNotasRecycler); toolbarNotas = FindViewById <Android.Widget.Toolbar>(Resource.Id.toolbarNotas); searchViewNotas = FindViewById <SearchView>(Resource.Id.action_search); fbNuevaNota = FindViewById <FloatingActionButton>(Resource.Id.fbNuevaNota); SetActionBar(toolbarNotas); ActionBar.Title = "Mis Notas"; listarNotas(); fbNuevaNota.Click += FbNuevaNota_Click; Window.EnterTransition = transicionSlide(); Window.ExitTransition = transicionSlide(); Window.ReturnTransition = transicionSlide(); Window.AllowEnterTransitionOverlap = false; //searchViewNotas.QueryTextChange += SearchViewNotas_QueryTextChange; }
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<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(); e.Handled = true; }; MenuItemCompat.SetOnActionExpandListener(item, new SearchViewExpandListener(_adapter)); return true; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.AddressBook, container, false); popupView = inflater.Inflate(Resource.Layout.ActionsOnContact, container, false); //view for actions popup emailView = inflater.Inflate(Resource.Layout.MailTemplate, container, false); //view for sending email template Android.App.ProgressDialog pd = Android.App.ProgressDialog.Show(Context, "", "Loadind contacts..", false, false); new Thread(new ThreadStart(() => { searchBox = view.FindViewById <Android.Widget.SearchView>(Resource.Id.searchBox); searchBox.QueryTextChange += (sender, e) => { if (!string.IsNullOrEmpty(e.NewText)) { List <Contact> newContactList = contList.FindAll(x => x.Name.ToLower().Contains(e.NewText.ToLower())); //filtering query for the list addressListView.Adapter = new AddressBookListAdapter(Activity, newContactList); } else { addressListView.Adapter = new AddressBookListAdapter(Activity, contList); } }; addressListView = view.FindViewById <ListView>(Resource.Id.addressBookList); addressListView.SetDrawSelectorOnTop(true); addressListView.ItemClick += ((sender, e) => { PopupWindow popup = CreateActionsPopup(contList[e.Position], e); popup.OutsideTouchable = true; popup.ShowAtLocation(View, GravityFlags.Center, 0, 0); }); GetContactList(); addressListView.Adapter = new AddressBookListAdapter(Activity, contList); pd.Dismiss(); })).Start(); return(view); }
private void InitView() { //设置标题栏 var btn_header_back = FindViewById<Button> (Resource.Id.btn_header_back); btn_header_back.Click += (sender, e) => { this.Finish(); }; FindViewById<TextView> (Resource.Id.tv_header_title).Text = "监护人绑定"; listView = FindViewById<ListView> (Resource.Id.lv_searchGuardian); searchView = FindViewById<SearchView> (Resource.Id.searchView); searchView.SetOnQueryTextListener (this); //设置searchview中textview颜色 var id = searchView.Context.Resources.GetIdentifier ("android:id/search_src_text", null, null); textView = (TextView)searchView.FindViewById(id); textView.SetTextColor (Resources.GetColor (Resource.Color.lightgray)); //查询 var txt_Querry = FindViewById<TextView> (Resource.Id.txt_Querry); txt_Querry.Click += (sender, e) => { OnQueryTextSubmit(textView.Text); }; applyGuardianListAdapter = new ApplyGuardianListAdapter (this); applyGuardianListAdapter.RefreshAction = () => { QuerryBindGuardian(textView.Text); }; listView.Adapter = applyGuardianListAdapter; //设置滑动listview停止加载图片 listView.SetOnScrollListener (new PauseOnScrollListener(Global.imageLoader,false,false)); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View v = inflater.Inflate(Resource.Layout.listarclientes, null); var ignored = base.OnCreateView(inflater, container, savedInstanceState); Dialog.SetTitle(Resources.GetText(Resource.String.titleFragmentListarClientes)); sv_teste = v.FindViewById <SearchView>(Resource.Id.sv_teste); lv_teste = v.FindViewById <ListView>(Resource.Id.lv_teste); sv_teste.QueryTextChange += delegate(object sender, SearchView.QueryTextChangeEventArgs args) { var service = new WebReference.Service(); service.ListaClienteAsync(args.NewText.ToUpper()); service.ListaClienteCompleted += ServiceOnListaClienteCompleted; }; return(v); }
void OnSearchTextChanged (object sender, SearchView.QueryTextChangeEventArgs e) { SearchQuery = e.NewText; Filter (this, new EventArgs()); Console.WriteLine ("OnSearchTextChanged {0}", SearchQuery); }
void OnSearchTextSubmit (object sender, SearchView.QueryTextSubmitEventArgs e) { SearchQuery = e.Query; Filter (this, new EventArgs()); Console.WriteLine ("OnQueryTextSubmit {0}", SearchQuery); }
void OnFilterTextChanged(object sender, SearchView.QueryTextChangeEventArgs e) { viewModel.FilterText = (sender as SearchView).Query.ToString(); }
void SetupSearchInput (SearchView searchView) { var searchManager = Activity.GetSystemService (Context.SearchService).JavaCast<SearchManager> (); searchView.SetIconifiedByDefault (false); var searchInfo = searchManager.GetSearchableInfo (Activity.ComponentName); searchView.SetSearchableInfo (searchInfo); }
public void SearchViewSuper(SearchView searchView, TextView textView) { searchView.SetBackgroundColor (Android.Graphics.Color.DarkOrange); searchView.SetOnQueryTextListener ((SearchView.IOnQueryTextListener) this); textView.SetTextColor(Android.Graphics.Color.White); textView.SetHintTextColor (Android.Graphics.Color.White); searchView.SetQueryHint ("Search Recipes..."); LinearLayout search_container = FindViewById<LinearLayout> (Resource.Id.search_container); search_container.Click += (sender, e) => { if (searchView.Iconified != false){ searchView.Iconified = false; } }; }
public override void Destroy () { sfGrid.AutoGeneratingColumn -= GridAutoGenerateColumn; sfGrid.Dispose (); conditionDropdown = null; columnDropdown = null; filterText = null; columnTextView = null; conditionTextView = null; sfGrid = null; viewModel = null; condtionAdapter = null; gridlayout.RemoveAllViews(); gridlayout = null; }
//I know this is wrong, but i will fix this later. // MvvmLight does not support EventHandler<T> binding //Binding library in the core project, does not support binding to event-to-command //So somehow i need to accomplish this task void OnQueryTextChanged (object sender, SearchView.QueryTextChangeEventArgs e) { if(string.IsNullOrEmpty(e.NewText)) { _viewModel.UserClearedTextCommand.Execute(null); } }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.search_layout); searchActivity = this; if (!MApplication.getInstance ().isLogedIn) { ActionBar.NavigationMode = ActionBarNavigationMode.Standard; ActionBar.SetTitle (Resource.String.search_result_title); ActionBar.SetDisplayShowTitleEnabled (false); ActionBar.SetDisplayHomeAsUpEnabled (true); ActionBar.SetDisplayShowHomeEnabled (true); } else { searchActivity.menu = ((UserDashBoardMain)searchActivity.Parent).menu; if (searchActivity.menu != null) { searchActivity.menu.GetItem (0).SetEnabled (false); searchActivity.menu.GetItem (0).SetVisible(false); } } setHeadingTitle (Resource.String.search_title); tvSearchResult = FindViewById<TextView> (Resource.Id.tv_noresult_search); tvSearchLimit = FindViewById<TextView> (Resource.Id.tv_notice_limit_search); llProgress = FindViewById<LinearLayout> (Resource.Id.llProgressBar); specListView = FindViewById<ListView> (Resource.Id.search_list_result); searchView = FindViewById<SearchView> (Resource.Id.searchView); sortPopup = new SortPopup (this); sortPopup.sortDelegate = this; strKeyWordSeach = ""; resetData(); llProgress.Visibility = ViewStates.Visible; specListView.ItemClick += OnListItemClick; specListView.SetOnScrollListener(searchActivity); inputManager = (InputMethodManager)this.GetSystemService (Context.InputMethodService); searchView.SetOnQueryTextListener (this); strSortType = Constants.SortBy.ProximityASC.ToString (); tvSearchResult.Visibility = ViewStates.Gone; if (this.Intent.Extras != null) { if (this.Intent.Extras.ContainsKey (constants.pKeyWordSearch) && constants.isSearchHome) { searchView.SetIconifiedByDefault (false); strKeyWordSeach = this.Intent.Extras.GetString (constants.pKeyWordSearch); searchView.SetQuery (strKeyWordSeach.Trim(), false); if (strKeyWordSeach.Trim ().Equals ("")) { tvSearchResult.Visibility = ViewStates.Visible; llProgress.Visibility = ViewStates.Gone; } else { getSpecialistProfilesRequest (); } constants.isSearchHome = false; } } else { searchView.SetIconifiedByDefault (false); searchView.RequestFocus (); llProgress.Visibility = ViewStates.Gone; } footerView = ((LayoutInflater)this.GetSystemService (Context.LayoutInflaterService)).Inflate (Resource.Layout.footer_loading_more, null, false); TCNotificationCenter.defaultCenter.addObserver (this, constants.kAddFavoriteSuccess, new TCSelector(updateSpecialistInfo)); TCNotificationCenter.defaultCenter.addObserver (this, constants.kRemoveFavoriteSuccess, new TCSelector (updateSpecialistInfo)); }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.MainPageFragmentLayout, container, false); _searchLayout = view.FindViewById (Resource.Id.segueta); // _locationContainer = view.FindViewById<LinearLayout> (Resource.Id.locationContainer); _searchView = view.FindViewById<SearchView> (Resource.Id.MainSearchView); return view; }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.SearchBar> e) { base.OnElementChanged(e); var element = (MvvmAspire.Controls.SearchBar)Element; // Get native control (background set in shared code, but can use SetBackgroundColor here) Android.Widget.SearchView searchView = (base.Control as Android.Widget.SearchView); searchView.SetInputType(InputTypes.ClassText | InputTypes.TextVariationNormal); int textViewId = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null); editText = (searchView.FindViewById(textViewId) as EditText); editText.SetTextColor(element.TextColor.ToAndroid()); //editText.TextAlignment = Android.Views.TextAlignment. editText.Gravity = GravityFlags.CenterVertical | GravityFlags.Start; if (element.PlaceholderColor != Xamarin.Forms.Color.Default) { editText.SetHintTextColor(element.PlaceholderColor.ToAndroid()); } //if (element.ShowSearchIconAsPlaceHolder) // editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(Android.Resource.Drawable.IcMenuSearch, 0, 0, 0); //editText.TextChanged += editText_TextChanged; int searchPlateId = searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null); LinearLayout searchPlateLayout = (searchView.FindViewById(searchPlateId) as LinearLayout); //searchPlateLayout.SetBackgroundColor(Android.Graphics.Color.Red); if (element.Background != null && element.Background.File != null) { searchPlateLayout.SetBackgroundResource(UIHelper.GetDrawableResource(element.Background)); } else { if (element.BackgroundColor != Xamarin.Forms.Color.Default) { searchPlateLayout.SetBackgroundColor(element.BackgroundColor.ToAndroid()); } } int frameId = searchView.Context.Resources.GetIdentifier("android:id/search_edit_frame", null, null); //Android.Views.View frameView = (searchView.FindViewById(frameId) as Android.Views.View); LinearLayout frameView = (searchView.FindViewById(frameId) as LinearLayout); if (element.Background != null && element.Background.File != null) { frameView.SetBackgroundResource(UIHelper.GetDrawableResource(element.Background)); } int searchIconId = searchView.Context.Resources.GetIdentifier("android:id/search_mag_icon", null, null); ImageView searchIcon = (searchView.FindViewById(searchIconId) as ImageView); if (element.SearchIcon != null && element.SearchIcon.File != null) { searchIcon.SetImageResource(UIHelper.GetDrawableResource(element.SearchIcon)); } else { searchIcon.SetImageResource(Android.Resource.Drawable.IcMenuSearch); } if (element.AlignSearchIconRight) { searchIcon.LayoutParameters = new LinearLayout.LayoutParams(0, 0); var iv = new ImageView(this.Context); iv.Click += (s, ev) => { if (Element.SearchCommand != null && Element.SearchCommand.CanExecute(Element.SearchCommandParameter)) { Element.SearchCommand.Execute(Element.SearchCommandParameter); } }; if (searchIcon.Drawable != null) { iv.SetImageDrawable(searchIcon.Drawable); } frameView.AddView(iv); this.SetBackgroundColor(Android.Graphics.Color.Transparent); } int search_close_btnID = searchView.Context.Resources.GetIdentifier("android:id/search_close_btn", null, null); ImageView search_close_btn = (searchView.FindViewById(search_close_btnID) as ImageView); search_close_btn.Click += search_close_btn_Click; SetTextInputTypes(element); search_close_btn.SetImageResource(Android.Resource.Drawable.IcMenuCloseClearCancel); //if (GetThemeName() == Android.Resource.Style.ThemeMaterialLightDarkActionBar) //{ //} CreateShapeDrawable(element); SetTypeface(); //if (element.HeightRequest > 0) //{ // editText.SetHeight(BaseUIHelper.ConvertDPToPixels(element.HeightRequest)); //} }
//I know this is wrong, but i will fix this later. // MvvmLight does not support EventHandler<T> binding //Binding library in the core project, does not support binding to event-to-command //So somehow i need to accomplish this task void OnQuerySubmit(object sender, SearchView.QueryTextSubmitEventArgs e) { _viewModel.UserIsTypingCommand.Execute(_searchView.Query); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.purchase_activity); spinner_purchase1 = FindViewById <Spinner>(Resource.Id.spinner_pur1); spinner_purchase2 = FindViewById <Spinner>(Resource.Id.spinner_pur2); logo_pur = FindViewById <ImageView>(Resource.Id.image_logo_pur); purchase_button = FindViewById <Button>(Resource.Id.purchase_btn); listView1 = FindViewById <ListView>(Resource.Id.listView1); date = FindViewById <EditText>(Resource.Id.edt_txt_date); alert = new Android.App.AlertDialog.Builder(this); myDB = new DBHelper(this); ic = myDB.PurchaseID(); ic.MoveToFirst(); pur_id = ic.GetInt(ic.GetColumnIndexOrThrow("max_id")) + 1; ic = myDB.vendor_list(); int j = 1; while (ic.MoveToNext()) { var a = ic.GetString(ic.GetColumnIndex("v_company_name")); var b = ic.GetInt(ic.GetColumnIndex("vendor_id")); vendor_dict.Add(a, b); vendor.Add(a); j++; } ic = myDB.category_list(); myUnit1.Add("All Categories"); int k = 0; while (ic.MoveToNext()) { var a = ic.GetString(ic.GetColumnIndex("cat_name")); var b = ic.GetInt(ic.GetColumnIndex("cat_id")); myUnit1.Add(a); category_dict.Add(a, b); k++; } purchase_button.Click += delegate { myDB.insertPurchase(pur_id, ven_id, date.Text, total_amt); }; listView1.ItemClick += listView_ItemClick1; date.Text = System.DateTime.Now.ToShortDateString(); //myDB = new DBHelper(this); showProductList(); spinner_purchase1.Adapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleListItem1, vendor); spinner_purchase1.ItemSelected += MyItemSelectedMethod2; spinner_purchase2.Adapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleListItem1, myUnit1); spinner_purchase2.ItemSelected += MyItemSelectedMethod3; sv = FindViewById <Android.Widget.SearchView>(Resource.Id.searchID_pro); sv.QueryTextChange += Sv_QueryTextChange; }
void OnQueryTextSubmit (object sender, SearchView.QueryTextSubmitEventArgs e) { }
void OnQueryTextChange (object sender, SearchView.QueryTextChangeEventArgs e) { // }