aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt11
1 files changed, 8 insertions, 3 deletions
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()
}