diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-26 13:25:17 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-26 13:25:17 -0700 |
commit | c9302a7b0f3c66b3514f1f5b83c86757db33008a (patch) | |
tree | c14f8b1ae70997be4905d0675deffd37b0ca0562 /library/src/main/kotlin | |
parent | 3839f9a406b4da9ba888afdaa6ba9c9a157badf6 (diff) | |
download | kau-c9302a7b0f3c66b3514f1f5b83c86757db33008a.tar.gz kau-c9302a7b0f3c66b3514f1f5b83c86757db33008a.tar.bz2 kau-c9302a7b0f3c66b3514f1f5b83c86757db33008a.zip |
add Extra icon
Diffstat (limited to 'library/src/main/kotlin')
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt | 12 |
1 files changed, 12 insertions, 0 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 e3931b9..46bce6a 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt @@ -55,6 +55,17 @@ class SearchView @JvmOverloads constructor( iconNav.setSearchIcon(value) if (value == null) iconNav.gone() } + /** + * Optional icon just to the left of the clear icon + * This is not implemented by default, but can be used for anything, such as mic or redirects + * Make sure you add a click listener to [iconExtra] if you plan on using this + */ + var extraIcon: IIcon? = null + set(value) { + field = value + iconExtra.setSearchIcon(value) + if (value == null) iconClear.gone() + } var clearIcon: IIcon? = GoogleMaterial.Icon.gmd_clear set(value) { field = value @@ -145,6 +156,7 @@ class SearchView @JvmOverloads constructor( private val editText: AppCompatEditText by bindView(R.id.search_edit_text) val textEvents: Observable<String> private val progress: ProgressBar by bindView(R.id.search_progress) + val iconExtra: ImageView by bindView(R.id.search_extra) private val iconClear: ImageView by bindView(R.id.search_clear) private val divider: View by bindView(R.id.search_divider) private val recycler: RecyclerView by bindView(R.id.search_recycler) |