From ed3efcef75bdcea962c1e281039d8bd96639e6a1 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 26 Jun 2017 20:06:24 -0700 Subject: Update kau --- app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt index 2103a8ee..5cc5cfe8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt @@ -69,7 +69,6 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { field = value if (value && hiddenSearchView == null) { hiddenSearchView = FrostWebViewSearch(this, this) - currentFragment.frostWebView.addView(hiddenSearchView) } } var searchView: SearchView? = null @@ -321,10 +320,11 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { toolbar.tint(Prefs.iconColor) setMenuIcons(menu, Prefs.iconColor, R.id.action_settings to GoogleMaterial.Icon.gmd_settings) - searchView = coordinator.bindSearchView(menu, R.id.action_search) { + searchView = bindSearchView(menu, R.id.action_search) { textObserver = { observable, _ -> - observable.subscribe { + observable.observeOn(AndroidSchedulers.mainThread()).subscribe { + L.d("Input $it") hiddenSearchView?.query(it) } } @@ -336,6 +336,10 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { closeListener = { hiddenSearchView?.pauseLoad = true } + onItemClick = { + position, key, content, searchView -> + launchWebOverlay(key) + } } return true } @@ -367,6 +371,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { } override fun onBackPressed() { + if (searchView?.onBackPressed() ?: false) return if (currentFragment.onBackPressed()) return super.onBackPressed() } -- cgit v1.2.3