From 86667a6d8aa755e1e75d10a18e06bc1440a76d84 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 29 Oct 2019 15:51:18 +0100 Subject: [PATCH] Passes text color instead of context --- .../java/im/vector/riotx/features/html/SpoilerSpan.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/html/SpoilerSpan.kt b/vector/src/main/java/im/vector/riotx/features/html/SpoilerSpan.kt index f57984c4af..7dd76dd71b 100644 --- a/vector/src/main/java/im/vector/riotx/features/html/SpoilerSpan.kt +++ b/vector/src/main/java/im/vector/riotx/features/html/SpoilerSpan.kt @@ -16,29 +16,26 @@ package im.vector.riotx.features.html -import android.content.Context import android.graphics.Color import android.text.TextPaint import android.text.style.ClickableSpan import android.view.View -import im.vector.riotx.R -import im.vector.riotx.features.themes.ThemeUtils -class SpoilerSpan(val bgColor: Int, val context: Context) : ClickableSpan() { +class SpoilerSpan(private val bgColor: Int, private val textColor: Int) : ClickableSpan() { override fun onClick(widget: View) { isHidden = !isHidden widget.invalidate() } - var isHidden = true + private var isHidden = true override fun updateDrawState(tp: TextPaint) { tp.bgColor = bgColor if (isHidden) { tp.color = Color.TRANSPARENT } else { - tp.color = ThemeUtils.getColor(context, R.attr.riotx_text_primary) + tp.color = textColor } } }