aboutsummaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-21 15:33:48 -0700
committerAllan Wang <me@allanwang.ca>2017-06-21 15:33:48 -0700
commita15225fbb975a9d6e0d39741ea8ebf33f92fbdca (patch)
tree84b87a3d88c9c2629b96b4ee217c6247533779d2 /library
parenta8fb90b75c9827fa0f3af37044fc48272c15a670 (diff)
downloadkau-a15225fbb975a9d6e0d39741ea8ebf33f92fbdca.tar.gz
kau-a15225fbb975a9d6e0d39741ea8ebf33f92fbdca.tar.bz2
kau-a15225fbb975a9d6e0d39741ea8ebf33f92fbdca.zip
Tint toolbar
Diffstat (limited to 'library')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt7
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