private void TxtSearch_TextChanged(object sender, Android.Text.TextChangedEventArgs e) { if (txtSearch.Text.Length > 0) { txtSearch.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.ic_cross_81577_32, 0); } else { txtSearch.SetCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } txtSearch.ShowDropDown(); }
private void SearchText_AfterTextChanged(object sender, Android.Text.AfterTextChangedEventArgs e) { AutoCompleteTextView SearchText = FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteSearchTextView); if (!SearchText.IsPopupShowing && SearchText.Text.Length > 0) { SearchText.ShowDropDown(); } }
private void EditTextFromFocusChanged(object sender, View.FocusChangeEventArgs e) { editTextInputFrom.ShowDropDown(); if (e.HasFocus) { editTextFromIsFocused = false; } else { editTextFromIsFocused = true; } }
private void AgencyDropDown_Click(object sender, EventArgs e) { if (showAgencyDropdown) { AgencyTextView.ShowDropDown(); showAgencyDropdown = false; } else { AgencyTextView.DismissDropDown(); showAgencyDropdown = true; } }
internal static void UpdateSuggestions(this AutoCompleteTextView autoCompleteTextView, Dictionary <string, int> groupsDictionary, Activity activity) { var groupsDictionaryKeys = groupsDictionary.Select(x => x.Key).ToArray(); var suggestAdapter = new ArrayAdapter(activity.BaseContext, Android.Resource.Layout.SimpleDropDownItem1Line, groupsDictionaryKeys); //TODO field? autoCompleteTextView.Adapter = null; autoCompleteTextView.Adapter = suggestAdapter; autoCompleteTextView.ShowDropDown(); }
private async void autoCompleteAddress_TextChanged(object sender, Android.Text.TextChangedEventArgs e) { var st = sender.GetType(); var results = await PlaceBLL.Instance.GetLocationFromAddress(this, e.Text.ToString(), 10); string[] test = new string[results.Count]; for (int i = 0; i < results.Count; i++) { var item = results.ElementAt(i); test[i] = item.SubThoroughfare + " " + item.Thoroughfare + " " + item.PostalCode + " " + item.Locality; } ArrayAdapter autoCompleteAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, test); autoCompleteAddress.Adapter = autoCompleteAdapter; autoCompleteAddress.ShowDropDown(); }
private void FromButton_Click(object sender, EventArgs e) { PopupMenu menu = new PopupMenu(this, sender as View); menu.MenuItemClick += (s, a) => { if (a.Item.ItemId == 0) { UpdateAutoFrom(); } else if (a.Item.ItemId == 1) { fromTextView.RequestFocus(); fromTextView.ShowDropDown(); fromTextView.SelectAll(); fromTextView.PostDelayed(() => { InputMethodManager inputMethodManager = GetSystemService(Context.InputMethodService) as InputMethodManager; inputMethodManager.ShowSoftInput(fromTextView, ShowFlags.Forced); }, 250); } else { Stop stop = TramUrWayApplication.GetStop(a.Item.ItemId); fromTextView.Text = stop.Name; } }; // Auto: based on current location and favorites if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) == Permission.Granted) { menu.Menu.Add(1, 0, 1, "Automatique").SetIcon(Resource.Drawable.ic_place); } // Favorite stops foreach (Stop stop in TramUrWayApplication.Config.FavoriteStops.GroupBy(s => s.Name).Select(g => g.First())) { menu.Menu.Add(1, stop.Id, 2, stop.Name); } // Other: focus the search box and trigger autocomplete menu.Menu.Add(1, 1, 3, "Autre ..."); menu.Show(); }
protected async void updateAdapter(string query) { //Tries to get suggested results, shows whatever it can get try { //Checks that the query is not blank, fetches suggestions using current location if so if (query.Length > 0) { //Gets up to 3 suggested results string[] suggestedResults = await mbi.FetchAutocompleteSuggestions(query, 3, map.MyLocation.Latitude, map.MyLocation.Longitude); //Clears the adapter adapter.Clear(); //Sets the adapter to contain the suggested results adapter.AddAll(suggestedResults); } //If the query was blank, clear the adapter else { adapter.Clear(); } //Makes sure that the current location is always an option adapter.Add("Current Location"); //If the dialog should not be shown, dismiss the dialog if (!showDialog) { view.DismissDropDown(); } //Notifies the adapter that the data has been changed. adapter.NotifyDataSetChanged(); } //Always shows the drop down if the flag is set when this function is called finally { if (showDialog) { view.ShowDropDown(); } } }
private void EditTextFromFocusChanged(object sender, View.FocusChangeEventArgs e) { editTextInputFrom.ShowDropDown(); editTextFromIsFocused = !e.HasFocus; }
private void ModelSearch_Click(object sender, EventArgs e) { _modelSearch.ShowDropDown(); //show the dropdown always }