protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Window.SetSoftInputMode(SoftInput.AdjustNothing); Methods.App.FullScreenApp(this); // Create your application here SetContentView(Resource.Layout.Search_Layout); //Get Value And Set Toolbar InitComponent(); InitToolbar(); SetRecyclerViewAdapters(); DataKey = Intent.GetStringExtra("Key") ?? "Data not available"; if (DataKey != "Data not available" && !string.IsNullOrEmpty(DataKey)) { SearchText = DataKey; if (SearchText == "Random") { SearchText = "a"; } else { SearchView?.ClearFocus(); } } //Close keyboard InputMethodManager inputManager = (InputMethodManager)GetSystemService(InputMethodService); if (inputManager.IsActive) { if (ToolBar != null) { inputManager = (InputMethodManager)GetSystemService(InputMethodService); inputManager.HideSoftInputFromWindow(ToolBar.WindowToken, 0); } } SearchView.ClearFocus(); AdsGoogle.Ad_Interstitial(this); } catch (Exception e) { Console.WriteLine(e); } }
static void displayDictResult(QueryDictResult inResult) { display(dictSrv, view, inResult); view.clearUserInput(); inputUser.ClearFocus(); view.setFocusOnResult(); }
public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e) { if (actionId == ImeAction.Search) { SearchText = v.Text; SearchView.ClearFocus(); v.ClearFocus(); SearchViewOnQueryTextSubmit(SearchText); SearchView.ClearFocus(); v.ClearFocus(); return(true); } return(false); }
protected void configureActv(AutoCompleteTextView actv, AutoCompleteTextView actvOther, FrameLayout frame, Button clear, Button navButton) { //Initializes the actv suggestions adapter ArrayAdapterNoFilter adapter = new ArrayAdapterNoFilter(this, Android.Resource.Layout.SimpleDropDownItem1Line); //Initializes the suggestions updater for the adapter AutocompleteSuggestionUpdater suggestor = new AutocompleteSuggestionUpdater(actv, adapter, map, mbi); //Sets the adapter of the actv actv.Adapter = adapter; //Sets the updater to update the suggestions when the text changes actv.AddTextChangedListener(suggestor); InputMethodManager imm = (InputMethodManager)GetSystemService(Activity.InputMethodService); //Sets delegates for handling the opacity of the navigation button actv.AfterTextChanged += delegate { //Updates the color of the actv based on whether the address is valid makeActvTurnGreenWhenAddressesAreValid(actv, frame); }; //Sets delegate for when the enter button is pushed on the keyboard actv.EditorAction += delegate { //Unfocuses from the actv, closes the dropdown, and hides the keyboard. actv.ClearFocus(); actv.DismissDropDown(); imm.HideSoftInputFromWindow(actv.WindowToken, 0); }; //Sets delegate for if the actv is clicked actv.ItemClick += delegate { //Closes the dropdown menu, turns off the suggestor, updates the route button's opacity, and hides the keyboard actv.DismissDropDown(); suggestor.showDialog = false; Tools.makeRouteButtonOpaqueIfBothAddressesAreValid(actv.Text, actvOther.Text, navButton, mbi); imm.HideSoftInputFromWindow(actv.WindowToken, 0); }; //Sets delegate for if the actv changes color frame.LayoutChange += delegate { //Updates the route button's opacity Tools.makeRouteButtonOpaqueIfBothAddressesAreValid(actv.Text, actvOther.Text, navButton, mbi); }; //Sets delegate for if the clear button has been pressed clear.Click += delegate { //Closes the dropdown menu, updates the route button's opacity, //gets the suggestor ready to start making suggestions when the user types again, and clears the text in the box actv.DismissDropDown(); Tools.makeRouteButtonOpaqueIfBothAddressesAreValid(actv.Text, actvOther.Text, navButton, mbi); suggestor.showDialog = true; actv.Text = ""; }; }
public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e) { switch (actionId) { case ImeAction.Search: SearchText = v.Text; SearchView.ClearFocus(); v.ClearFocus(); SearchViewOnQueryTextSubmit(SearchText); SearchView.ClearFocus(); v.ClearFocus(); return(true); default: return(false); } }
private void AgencyTextView_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { AgencyTextView.ClearFocus(); agency.SetTag(AgencyTextView.Text); route.SetAgencyTag(agency.Tag()); route.StartRouteDate(); RouteTextView.Adapter = route.Adapter(); RouteTextView.Text = string.Empty; RouteTextView.Enabled = true; routeDropDown.Enabled = true; }
protected override void OnPause() { try { //SearchView.SetQuery("", false); SearchView?.ClearFocus(); //SearchView.OnActionViewCollapsed(); base.OnPause(); AddOrRemoveEvent(false); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void SearchBoxOnClick(object sender, EventArgs e) { try { Bundle bundle = new Bundle(); bundle.PutString("Key", ""); SearchFragment = new SearchFragment { Arguments = bundle }; GlobalContext.FragmentBottomNavigator.DisplayFragment(SearchFragment); SearchBox.ClearFocus(); } catch (Exception exception) { Console.WriteLine(exception); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Window.SetSoftInputMode(SoftInput.AdjustNothing); Methods.App.FullScreenApp(this); // Create your application here SetContentView(Resource.Layout.Search_Tabbed_Layout); DataKey = Intent.GetStringExtra("Key") ?? "Data not available"; if (DataKey != "Data not available" && !string.IsNullOrEmpty(DataKey)) { SearchText = DataKey; } //Get Value And Set Toolbar InitComponent(); InitToolbar(); if (SearchText == "Random" || SearchText == "Random_Groups" || SearchText == "Random_Pages") { SearchText = "a"; } else if (!string.IsNullOrEmpty(SearchText)) { Search(SearchText); } else { if (SearchView == null) { return; } //SearchView.SetQuery(SearchText, false); SearchView.ClearFocus(); //SearchView.OnActionViewCollapsed(); } } catch (Exception e) { Console.WriteLine(e); } }
private void InitToolbar() { try { ToolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (ToolBar != null) { ToolBar.Title = ""; ToolBar.SetTitleTextColor(Color.White); SetSupportActionBar(ToolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); } SearchView = FindViewById <AutoCompleteTextView>(Resource.Id.searchBox); SearchView.SetOnEditorActionListener(this); //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); } }
/// <summary> /// Метод, предназначенный для описания основной логики связанной со страницой "Search". /// </summary> private void CreateOptionsPageSearch() { // Инициализация элементов управления. AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView)searchPage.FindViewById(Resource.Id.autoCompleteTextView1); ImageButton image = searchPage.FindViewById <ImageButton>(Resource.Id.imageButton1); image.SetImageBitmap(bitmapFromVector(this, Resource.Drawable.sendIcon, 4)); // Создаем адаптер для автозаполнения элемента AutoCompleteTextView. ArrayAdapter <string> adapter = new MyAdapterForText(this, Resource.Layout.simple_dropdown, parsedDataBase); autoCompleteTextView.Adapter = adapter; // Событие обработки ввода ФИО image.Click += delegate { // Считывание введенной информации. string name = autoCompleteTextView.Text; if (name != "") { // Преобразование введенной информации. name = string.Join(" ", name.Split(' ', StringSplitOptions.RemoveEmptyEntries).Select(x => char.ToUpper(x[0]) + x.Remove(0, 1).ToLower()).ToArray()); // Если выбранное место для посищения не выходит за лимит,то добавляем его на карту. if (findHumanFromMarker.Count < countOfMarkers) { // Поиск введенных ФИО среди ФИО базы данных. if (parsedDataBase.ContainsKey(name.First()) && parsedDataBase[name.First()].Select(x => x.fullName).Contains(name)) { autoCompleteTextView.Text = null; // Скрытие системной клавиатуры. InputMethodManager imm = (InputMethodManager)GetSystemService(InputMethodService); imm.HideSoftInputFromWindow(image.WindowToken, HideSoftInputFlags.NotAlways); // Установка страницы с картой. autoCompleteTextView.ClearFocus(); viewPager.CurrentItem = 1; // Нахождение Выбранного человека. Human selectedHuman = parsedDataBase[name.First()].Where(x => x.fullName == name).First(); // Если выбранное место, не выбиралось раннее, то добавляем его на карту. if (!findMarkerFromHuman.ContainsKey(selectedHuman)) { // Создание маркера. Marker marker = map.AddMarker(new MarkerOptions().SetPosition(selectedHuman.coordinatesForMap)); marker.HideInfoWindow(); // Установка иконки маркера. marker.SetIcon(BitmapDescriptorFactory.FromBitmap(bitmapFromVector(ApplicationContext, Resource.Drawable.mainMarker, 3))); // Добавления нужных данных в словари. findHumanFromMarker.Add(marker.Id, selectedHuman); findMarkerFromHuman.Add(selectedHuman, marker); } // Если выбиралось раннее, то сообщаем об этом пользователю. else { Toast.MakeText(this, "Вы уже выбрали данное место для посещения!", ToastLength.Long).Show(); } } // Если в базе данных не найдены ФИО, сообщаем об этом пользователю. else { autoCompleteTextView.Text = null; Toast.MakeText(this, $"Данное ФИО не найдено в базе данных!", ToastLength.Long).Show(); } } // Сообщаем пользователю о достигнутом лимите маркеров на карте. else { autoCompleteTextView.Text = null; Toast.MakeText(this, $"Вы не можете выбрать для посещения больше чем {countOfMarkers} мест!", ToastLength.Long).Show(); } } // Если была нажата кнопка, но при этом пользователь ничего не ввел, сообщаем ему об этом. else { Toast.MakeText(this, "Сначала введите ФИО, потом нажмите на кнопку", ToastLength.Long).Show(); } }; }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Window?.SetSoftInputMode(SoftInput.AdjustNothing); Methods.App.FullScreenApp(this); // Create your application here SetContentView(Resource.Layout.Search_Tabbed_Layout); DataKey = Intent?.GetStringExtra("Key") ?? "Data not available"; if (DataKey != "Data not available" && !string.IsNullOrEmpty(DataKey)) { SearchText = DataKey; } //Get Value And Set Toolbar InitComponent(); InitToolbar(); switch (SearchText) { case "Random": case "Random_Groups": case "Random_Pages": SearchText = "a"; break; default: { switch (string.IsNullOrEmpty(SearchText)) { case false: Search(SearchText); break; default: { switch (SearchView) { case null: return; } //SearchView.SetQuery(SearchText, false); SearchView.ClearFocus(); //SearchView.OnActionViewCollapsed(); break; } } break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }