Change spoiler bg colors
This commit is contained in:
parent
3c4c0ed46a
commit
b3233d3eb7
|
@ -28,7 +28,8 @@ class SpanHandler(context: Context) : TagHandler() {
|
||||||
|
|
||||||
override fun supportedTags() = listOf("span")
|
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)
|
private val textColor: Int = ThemeUtils.getColor(context, R.attr.riotx_text_primary)
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ class SpanHandler(context: Context) : TagHandler() {
|
||||||
if (mxSpoiler != null) {
|
if (mxSpoiler != null) {
|
||||||
SpannableBuilder.setSpans(
|
SpannableBuilder.setSpans(
|
||||||
visitor.builder(),
|
visitor.builder(),
|
||||||
SpoilerSpan(spoilerBgColor, textColor),
|
SpoilerSpan(spoilerBgColorHidden, spoilerBgColorRevealed, textColor),
|
||||||
tag.start(),
|
tag.start(),
|
||||||
tag.end()
|
tag.end()
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,7 +21,9 @@ import android.text.TextPaint
|
||||||
import android.text.style.ClickableSpan
|
import android.text.style.ClickableSpan
|
||||||
import android.view.View
|
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) {
|
override fun onClick(widget: View) {
|
||||||
isHidden = !isHidden
|
isHidden = !isHidden
|
||||||
|
@ -31,10 +33,11 @@ class SpoilerSpan(private val bgColor: Int, private val textColor: Int) : Clicka
|
||||||
private var isHidden = true
|
private var isHidden = true
|
||||||
|
|
||||||
override fun updateDrawState(tp: TextPaint) {
|
override fun updateDrawState(tp: TextPaint) {
|
||||||
tp.bgColor = bgColor
|
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
|
tp.bgColor = bgColorHidden
|
||||||
tp.color = Color.TRANSPARENT
|
tp.color = Color.TRANSPARENT
|
||||||
} else {
|
} else {
|
||||||
|
tp.bgColor = bgColorRevealed
|
||||||
tp.color = textColor
|
tp.color = textColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<attr name="vctr_unread_marker_line_color" format="color" />
|
<attr name="vctr_unread_marker_line_color" format="color" />
|
||||||
<attr name="vctr_markdown_block_background_color" format="color" />
|
<attr name="vctr_markdown_block_background_color" format="color" />
|
||||||
<attr name="vctr_room_activity_divider_color" format="color" />
|
<attr name="vctr_room_activity_divider_color" format="color" />
|
||||||
|
<attr name="vctr_spoiler_background_color" format="color" />
|
||||||
|
|
||||||
<!-- tab bar colors -->
|
<!-- tab bar colors -->
|
||||||
<attr name="vctr_tab_bar_inverted_background_color" format="color" />
|
<attr name="vctr_tab_bar_inverted_background_color" format="color" />
|
||||||
|
|
|
@ -101,6 +101,7 @@
|
||||||
<item name="vctr_search_mode_room_name_text_color">#CCC3C3C3</item>
|
<item name="vctr_search_mode_room_name_text_color">#CCC3C3C3</item>
|
||||||
<item name="vctr_unread_marker_line_color">@color/accent_color_dark</item>
|
<item name="vctr_unread_marker_line_color">@color/accent_color_dark</item>
|
||||||
<item name="vctr_markdown_block_background_color">@android:color/black</item>
|
<item name="vctr_markdown_block_background_color">@android:color/black</item>
|
||||||
|
<item name="vctr_spoiler_background_color">#FFFFFFFF</item>
|
||||||
<item name="vctr_room_activity_divider_color">#565656</item>
|
<item name="vctr_room_activity_divider_color">#565656</item>
|
||||||
|
|
||||||
<!-- tab bar colors -->
|
<!-- tab bar colors -->
|
||||||
|
|
|
@ -101,6 +101,7 @@
|
||||||
<item name="vctr_search_mode_room_name_text_color">#333C3C3C</item>
|
<item name="vctr_search_mode_room_name_text_color">#333C3C3C</item>
|
||||||
<item name="vctr_unread_marker_line_color">@color/accent_color_light</item>
|
<item name="vctr_unread_marker_line_color">@color/accent_color_light</item>
|
||||||
<item name="vctr_markdown_block_background_color">#FFEEEEEE</item>
|
<item name="vctr_markdown_block_background_color">#FFEEEEEE</item>
|
||||||
|
<item name="vctr_spoiler_background_color">#FF000000</item>
|
||||||
<item name="vctr_room_activity_divider_color">#FFF2F2F2</item>
|
<item name="vctr_room_activity_divider_color">#FFF2F2F2</item>
|
||||||
|
|
||||||
<!-- tab bar colors -->
|
<!-- tab bar colors -->
|
||||||
|
|
Loading…
Reference in New Issue