From a931fa42e3e938dcc1a60fec92b882aebd49a744 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 26 Jun 2017 19:55:04 -0700 Subject: Add some comments --- sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sample/src/main/kotlin') 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 4c22c2a..3cd714e 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -20,7 +20,7 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial class MainActivity : KPrefActivity() { - lateinit var searchView: SearchView + var searchView: SearchView? = null //some of the most common english words for show val wordBank: List by lazy { listOf("the", "name", "of", "very", "to", "through", @@ -178,7 +178,7 @@ class MainActivity : KPrefActivity() { override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) - searchView = bindSearchView(menu, R.id.action_search) { + if (searchView == null) searchView = bindSearchView(menu, R.id.action_search) { textObserver = { observable, searchView -> /* @@ -213,6 +213,6 @@ class MainActivity : KPrefActivity() { } override fun onBackPressed() { - if (!searchView.onBackPressed()) super.onBackPressed() + if (!(searchView?.onBackPressed() ?: false)) super.onBackPressed() } } -- cgit v1.2.3