diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-24 19:09:54 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-24 19:09:54 -0700 |
commit | 6ad176dde0a84a0eb96dea2f9c7eb34394045526 (patch) | |
tree | 17859e9be76430d4489ae008de8428c11e14f9ec /sample/src | |
parent | b536b151f1012e730782f615dceed6be7e3a9652 (diff) | |
download | kau-6ad176dde0a84a0eb96dea2f9c7eb34394045526.tar.gz kau-6ad176dde0a84a0eb96dea2f9c7eb34394045526.tar.bz2 kau-6ad176dde0a84a0eb96dea2f9c7eb34394045526.zip |
Push working build
Diffstat (limited to 'sample/src')
-rw-r--r-- | sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index 7c4de5a..7680588 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -7,8 +7,13 @@ import ca.allanwang.kau.email.sendEmail import ca.allanwang.kau.kpref.CoreAttributeContract import ca.allanwang.kau.kpref.KPrefActivity import ca.allanwang.kau.kpref.KPrefAdapterBuilder +import ca.allanwang.kau.logging.KL +import ca.allanwang.kau.searchview.SearchItem import ca.allanwang.kau.searchview.bindSearchView -import ca.allanwang.kau.utils.* +import ca.allanwang.kau.utils.materialDialog +import ca.allanwang.kau.utils.navigationBarColor +import ca.allanwang.kau.utils.startActivity +import ca.allanwang.kau.utils.toast import ca.allanwang.kau.views.RippleCanvas import com.mikepenz.google_material_typeface_library.GoogleMaterial @@ -120,9 +125,18 @@ class MainActivity : KPrefActivity() { override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) - //workaround for menuY since this view draws under the status bar - val statusBarHeight = dimen(R.dimen.kau_status_bar_height).toInt().dpToPx - container.bindSearchView(menu, R.id.action_search) + container.bindSearchView(menu, R.id.action_search) { + textObserver = { + observable, searchView -> + observable.subscribe { + text -> + KL.e(text) + searchView.results = if (text.length == 3) emptyList() else Array<String>(text.length, { text }).map { SearchItem(it) } + } + } + noResultsFound = R.string.kau_no_results_found + shouldClearOnClose = false + } return true } |