aboutsummaryrefslogtreecommitdiff
path: root/library/src/main/kotlin/ca/allanwang/kau/views/TextSwitcherThemed.kt
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/main/kotlin/ca/allanwang/kau/views/TextSwitcherThemed.kt')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/views/TextSwitcherThemed.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/views/TextSwitcherThemed.kt b/library/src/main/kotlin/ca/allanwang/kau/views/TextSwitcherThemed.kt
new file mode 100644
index 0000000..bdc529c
--- /dev/null
+++ b/library/src/main/kotlin/ca/allanwang/kau/views/TextSwitcherThemed.kt
@@ -0,0 +1,23 @@
+package ca.allanwang.kau.views
+
+import android.content.Context
+import android.util.AttributeSet
+import android.widget.TextSwitcher
+import android.widget.TextView
+
+/**
+ * Created by Allan Wang on 2017-06-21.
+ */
+class TextSwitcherThemed @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null
+) : TextSwitcher(context, attrs) {
+
+ var textColor: Int = -1
+ get() = field
+ set(value) {
+ field = value
+ if (value != -1) {
+ (getChildAt(0) as TextView).setTextColor(value)
+ (getChildAt(1) as TextView).setTextColor(value)
+ }
+ }
+} \ No newline at end of file