From a15225fbb975a9d6e0d39741ea8ebf33f92fbdca Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 21 Jun 2017 15:33:48 -0700 Subject: Tint toolbar --- library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'library/src/main') diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt index eb285ef..5d702e7 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt @@ -221,5 +221,12 @@ fun EditText.tintCursor(@ColorInt color: Int) { } catch (e: Exception) { e.printStackTrace() } +} +fun Toolbar.tint(@ColorInt color: Int, tintTitle: Boolean = true) { + if (tintTitle) { + setTitleTextColor(color) + setSubtitleTextColor(color) + } + (0 until childCount).asSequence().forEach { (getChildAt(it) as? ImageButton)?.setColorFilter(color) } } \ No newline at end of file -- cgit v1.2.3