diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-21 15:33:48 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-21 15:33:48 -0700 |
commit | a15225fbb975a9d6e0d39741ea8ebf33f92fbdca (patch) | |
tree | 84b87a3d88c9c2629b96b4ee217c6247533779d2 | |
parent | a8fb90b75c9827fa0f3af37044fc48272c15a670 (diff) | |
download | kau-a15225fbb975a9d6e0d39741ea8ebf33f92fbdca.tar.gz kau-a15225fbb975a9d6e0d39741ea8ebf33f92fbdca.tar.bz2 kau-a15225fbb975a9d6e0d39741ea8ebf33f92fbdca.zip |
Tint toolbar
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt | 7 |
1 files changed, 7 insertions, 0 deletions
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 |