diff options
Diffstat (limited to 'sample/src')
-rw-r--r-- | sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 11 | ||||
-rw-r--r-- | sample/src/main/res/xml/changelog.xml | 13 |
2 files changed, 20 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 51010c0..83523fa 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -9,6 +9,7 @@ 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.SearchView import ca.allanwang.kau.searchview.bindSearchView import ca.allanwang.kau.utils.materialDialog import ca.allanwang.kau.utils.navigationBarColor @@ -20,6 +21,8 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial class MainActivity : KPrefActivity() { + lateinit var searchView: SearchView + override fun kPrefCoreAttributes(): CoreAttributeContract.() -> Unit = { textColor = { KPrefSample.textColor } accentColor = { KPrefSample.accentColor } @@ -95,6 +98,9 @@ class MainActivity : KPrefActivity() { subItems(R.string.sub_item, subPrefs()) { descRes = R.string.sub_item_desc } + + plainText(R.string.kau_lorem_ipsum) + } fun subPrefs(): KPrefAdapterBuilder.() -> Unit = { @@ -125,7 +131,7 @@ class MainActivity : KPrefActivity() { override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) - container.bindSearchView(menu, R.id.action_search) { + searchView = container.bindSearchView(menu, R.id.action_search) { textObserver = { observable, searchView -> observable.subscribe { @@ -155,4 +161,7 @@ class MainActivity : KPrefActivity() { return true } + override fun onBackPressed() { + if (!searchView.onBackPressed()) super.onBackPressed() + } } diff --git a/sample/src/main/res/xml/changelog.xml b/sample/src/main/res/xml/changelog.xml index 76d2563..55ddd34 100644 --- a/sample/src/main/res/xml/changelog.xml +++ b/sample/src/main/res/xml/changelog.xml @@ -6,14 +6,21 @@ <item text="" /> --> + <version title="v1.3"/> + <item text="Added kpref subitems" /> + <item text="Added DSL markers" /> + <item text="Added transition utils and other utils" /> + <item text="Added custom searchview with binders" /> + <item text="" /> + <item text="" /> + <item text="" /> + <item text="" /> + <version title="v1.2"/> <item text="Fix title attribute in changelog" /> <item text="Update support libs" /> <item text="Add is app installed utils" /> <item text="Add email builder" /> - <item text="" /> - <item text="" /> - <item text="" /> <version title="v1.1"/> <item text="Created kpref items" /> |