mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Change spoiler bg colors
This commit is contained in:
parent
3c4c0ed46a
commit
b3233d3eb7
5 changed files with 11 additions and 4 deletions
|
@ -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()
|
||||
)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<attr name="vctr_unread_marker_line_color" format="color" />
|
||||
<attr name="vctr_markdown_block_background_color" format="color" />
|
||||
<attr name="vctr_room_activity_divider_color" format="color" />
|
||||
<attr name="vctr_spoiler_background_color" format="color" />
|
||||
|
||||
<!-- tab bar colors -->
|
||||
<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_unread_marker_line_color">@color/accent_color_dark</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>
|
||||
|
||||
<!-- tab bar colors -->
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
<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_markdown_block_background_color">#FFEEEEEE</item>
|
||||
<item name="vctr_spoiler_background_color">#FF000000</item>
|
||||
<item name="vctr_room_activity_divider_color">#FFF2F2F2</item>
|
||||
|
||||
<!-- tab bar colors -->
|
||||
|
|
Loading…
Reference in a new issue