diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-26 19:55:04 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-26 19:55:04 -0700 |
commit | a931fa42e3e938dcc1a60fec92b882aebd49a744 (patch) | |
tree | c693c837f93dd6998818f4e2cc42db96ac8c3d81 /library | |
parent | cb2da7537c544e847373981a861b6a8ec151b847 (diff) | |
download | kau-a931fa42e3e938dcc1a60fec92b882aebd49a744.tar.gz kau-a931fa42e3e938dcc1a60fec92b882aebd49a744.tar.bz2 kau-a931fa42e3e938dcc1a60fec92b882aebd49a744.zip |
Add some comments
Diffstat (limited to 'library')
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt index a0330c5..5936a07 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt @@ -360,11 +360,11 @@ class SearchView @JvmOverloads constructor( * The cardView matches the parent's width, so menuX is correct */ configs.openListener?.invoke(this) + shadow.fadeIn() editText.showKeyboard() card.circularReveal(menuX, menuHalfHeight, duration = configs.revealDuration) { cardTransition() recycler.visible() - shadow.fadeIn() } } @@ -396,7 +396,11 @@ annotation class KauSearch fun Activity.bindSearchView(menu: Menu, @IdRes id: Int, @ColorInt menuIconColor: Int = Color.WHITE, config: SearchView.Configs.() -> Unit = {}): SearchView = findViewById<ViewGroup>(android.R.id.content).bindSearchView(menu, id, menuIconColor, config) - +/** + * Bind searchView to a menu item; call this in [Activity.onCreateOptionsMenu] + * Be wary that if you may reinflate the menu many times (eg through [Activity.invalidateOptionsMenu]), + * it may be worthwhile to hold a reference to the searchview and only bind it if it hasn't been bound before + */ @KauSearch fun ViewGroup.bindSearchView(menu: Menu, @IdRes id: Int, @ColorInt menuIconColor: Int = Color.WHITE, config: SearchView.Configs.() -> Unit = {}): SearchView { val searchView = SearchView(context) |