public AutocompleteSuggestionUpdater(AutoCompleteTextView view, ArrayAdapterNoFilter adapter, MapboxMap map, MapBoxInterface mbi) { this.view = view; this.adapter = adapter; this.map = map; this.mbi = mbi; updateAdapter("Central Park"); adapter.Clear(); }
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 PassthroughFilter(ArrayAdapterNoFilter adapter) { this.adapter = adapter; }