将AutoCompleteTextView中的Observable更改为EditText

我正在尝试使用Kotlin和RxJava编辑一些预先存在的代码,以便为用户提供更好的UI布局。

初始ui使用AutoCompleteTextEdit将用户的Google Places结果显示为用户类型。 我试图改变它,所以用户键入,结果显示在输入字段下的ListView而不是附加到输入字段。

我的问题是,我只能得到数据显示在列表视图中,如果我离开当前的代码,以便它也显示在AutoCompleteTextView由于代码是为observable和自定义RxFilterableArrayAdapter编写的方式。

有了这个代码,搜索工作,但显示在下拉菜单,以及列表视图。 (见下文)

private fun setupView(view:View) { val tripPlanningResult = view.findViewById(R.id.trip_planning_api_results) as ListView val starting_location = view.findViewById(R.id.trip_planning_starting_location) as AutoCompleteTextView val destination_address = view.findViewById(R.id.trip_planning_destination_address) as AutoCompleteTextView val plan_route_button = view.findViewById(R.id.trip_planning_plan_route_button) val tripPlanningService = TripPlanningService.sharedTripPlanningService(context) val cityBounds0 = CityCache.getInstance(context, "cities", true) .getCityRegion(cityId!!) //Creates an Observable to watch for text input from the AutoCompleteTextView val filterFeeder = object : RxFilterableArrayAdapter.RxFilterFeeder<TripPlanningService.ProposedLocation> { val inputs = PublishSubject<String>() override fun output(): Observable<List<TripPlanningService.ProposedLocation>> { return Observable.combineLatest(listOf(inputs, cityBounds0), { it }) .flatMap { val text = it[0] as String val cityBounds = it[1] as LatLngBounds tripPlanningService.proposeLocationsForUserInput(cityBounds, text) } } override fun input(filterText: String) { Timber.w("Got input text $filterText") inputs.onNext(filterText) } } val autoCompleteAdapter = RxFilterableArrayAdapter(context, android.R.layout.simple_list_item_1, filterFeeder) tripPlanningResult.setAdapter(autoCompleteAdapter) starting_location.setAdapter(autoCompleteAdapter) destination_address.setAdapter(autoCompleteAdapter) setAutoCompleteItemListeners(starting_location) setAutoCompleteItemListeners(destination_address) plan_route_button.setOnClickListener { sendRequest() } } 

我想将starting_location和destination_address更改为EditText,但仍然使用filterfeeder正确观察它们,并仅在tripPlanningResults中显示结果。 我似乎无法使适配器正确工作。

我怎样才能让EditText订阅像AutoCompleteTextView这样的Observable呢。