diff --git a/vector/src/main/java/im/vector/riotx/features/html/SpanHandler.kt b/vector/src/main/java/im/vector/riotx/features/html/SpanHandler.kt index 33d8f87271..dbc09cf0a9 100644 --- a/vector/src/main/java/im/vector/riotx/features/html/SpanHandler.kt +++ b/vector/src/main/java/im/vector/riotx/features/html/SpanHandler.kt @@ -28,7 +28,8 @@ class SpanHandler(context: Context) : TagHandler() { override fun supportedTags() = listOf("span") - private val spoilerBgColor: Int = ThemeUtils.getColor(context, R.attr.vctr_markdown_block_background_color) + private val spoilerBgColorHidden: Int = ThemeUtils.getColor(context, R.attr.vctr_spoiler_background_color) + private val spoilerBgColorRevealed: Int = ThemeUtils.getColor(context, R.attr.vctr_markdown_block_background_color) private val textColor: Int = ThemeUtils.getColor(context, R.attr.riotx_text_primary) @@ -37,7 +38,7 @@ class SpanHandler(context: Context) : TagHandler() { if (mxSpoiler != null) { SpannableBuilder.setSpans( visitor.builder(), - SpoilerSpan(spoilerBgColor, textColor), + SpoilerSpan(spoilerBgColorHidden, spoilerBgColorRevealed, textColor), tag.start(), tag.end() ) 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 7dd76dd71b..d8236f0746 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 @@ -21,7 +21,9 @@ import android.text.TextPaint import android.text.style.ClickableSpan import android.view.View -class SpoilerSpan(private val bgColor: Int, private val textColor: Int) : ClickableSpan() { +class SpoilerSpan(private val bgColorHidden: Int, + private val bgColorRevealed: Int, + private val textColor: Int) : ClickableSpan() { override fun onClick(widget: View) { isHidden = !isHidden @@ -31,10 +33,11 @@ class SpoilerSpan(private val bgColor: Int, private val textColor: Int) : Clicka private var isHidden = true override fun updateDrawState(tp: TextPaint) { - tp.bgColor = bgColor if (isHidden) { + tp.bgColor = bgColorHidden tp.color = Color.TRANSPARENT } else { + tp.bgColor = bgColorRevealed tp.color = textColor } } diff --git a/vector/src/main/res/values/attrs.xml b/vector/src/main/res/values/attrs.xml index e9a4296add..c30a1d99d9 100644 --- a/vector/src/main/res/values/attrs.xml +++ b/vector/src/main/res/values/attrs.xml @@ -34,6 +34,7 @@ + diff --git a/vector/src/main/res/values/theme_dark.xml b/vector/src/main/res/values/theme_dark.xml index f09cb0c874..f61a89482a 100644 --- a/vector/src/main/res/values/theme_dark.xml +++ b/vector/src/main/res/values/theme_dark.xml @@ -101,6 +101,7 @@ #CCC3C3C3 @color/accent_color_dark @android:color/black + #FFFFFFFF #565656 diff --git a/vector/src/main/res/values/theme_light.xml b/vector/src/main/res/values/theme_light.xml index 1da010b8ff..aa343a11fc 100644 --- a/vector/src/main/res/values/theme_light.xml +++ b/vector/src/main/res/values/theme_light.xml @@ -101,6 +101,7 @@ #333C3C3C @color/accent_color_light #FFEEEEEE + #FF000000 #FFF2F2F2