aboutsummaryrefslogtreecommitdiff
path: root/searchview
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-12 10:09:01 -0700
committerGitHub <noreply@github.com>2017-08-12 10:09:01 -0700
commit10617f02a95b162695ea068c0be6acceda74cf35 (patch)
tree06943d13034cbcf0e7bdd01960162e62952bb51c /searchview
parent02e1dbc84425b0ac7f771c82f70444f742397452 (diff)
downloadkau-10617f02a95b162695ea068c0be6acceda74cf35.tar.gz
kau-10617f02a95b162695ea068c0be6acceda74cf35.tar.bz2
kau-10617f02a95b162695ea068c0be6acceda74cf35.zip
Release 3.3.1 (#36)3.3.1
* 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
Diffstat (limited to 'searchview')
-rw-r--r--searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt11
1 files changed, 6 insertions, 5 deletions
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<View>(item.itemId) ?: return
val locations = IntArray(2)
view.getLocationOnScreen(locations)