From 10617f02a95b162695ea068c0be6acceda74cf35 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 12 Aug 2017 10:09:01 -0700 Subject: Release 3.3.1 (#36) * Add open message joiner function * Update text extraction * Fix background tint * Rename logger file * Test codecov * Remove coverage * Enhancement/swipe (#35) * Merge swipe onPostCreate with swipe onCreate * Update samples and docs * Add deprecated method to maintain compatibility * Replace exception with illegal argument * Check if parent exists before configurations in searchview --- .../src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'searchview/src/main/kotlin/ca/allanwang/kau') diff --git a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt index cc56289..1376115 100644 --- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt +++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt @@ -10,7 +10,6 @@ import android.support.transition.ChangeBounds import android.support.transition.TransitionManager import android.support.transition.TransitionSet import android.support.v7.widget.AppCompatEditText -import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.RecyclerView import android.text.Editable import android.text.TextWatcher @@ -153,7 +152,7 @@ class SearchView @JvmOverloads constructor( } if (SearchItem.backgroundColor != backgroundColor) { SearchItem.backgroundColor = backgroundColor - tintForeground(backgroundColor) + tintBackground(backgroundColor) } val icons = mutableListOf(navIcon to iconNav, clearIcon to iconClear) val extra = extraIcon @@ -291,11 +290,12 @@ class SearchView @JvmOverloads constructor( */ fun bind(menu: Menu, @IdRes id: Int, @ColorInt menuIconColor: Int = Color.WHITE, config: Configs.() -> Unit = {}): SearchView { config(config) - menuItem = menu.findItem(id) ?: throw IllegalArgumentException("Menu item with given id doesn't exist") - if (menuItem!!.icon == null) menuItem!!.icon = GoogleMaterial.Icon.gmd_search.toDrawable(context, 18, menuIconColor) + val menuItem = menu.findItem(id) ?: throw IllegalArgumentException("Menu item with given id doesn't exist") + if (menuItem.icon == null) menuItem.icon = GoogleMaterial.Icon.gmd_search.toDrawable(context, 18, menuIconColor) card.gone() - menuItem!!.setOnMenuItemClickListener { configureCoords(it); revealOpen(); true } + menuItem.setOnMenuItemClickListener { configureCoords(it); revealOpen(); true } shadow.setOnClickListener { revealClose() } + this.menuItem = menuItem return this } @@ -310,6 +310,7 @@ class SearchView @JvmOverloads constructor( } private fun configureCoords(item: MenuItem) { + if (parent !is ViewGroup) return val view = parentViewGroup.findViewById(item.itemId) ?: return val locations = IntArray(2) view.getLocationOnScreen(locations) -- cgit v1.2.3