Theme color of quotation bar
Change-Id: Ia9d9c34c1bb276fea42b00131ea1915f93f23263
This commit is contained in:
parent
3e95246908
commit
abccf99f55
|
@ -17,6 +17,7 @@
|
|||
|
||||
<attr name="message_highlight_bg_color" format="color" />
|
||||
<attr name="code_block_bg_color" format="color" />
|
||||
<attr name="quote_bar_color" format="color" />
|
||||
|
||||
<attr name="user_color_pl_100" format="color" />
|
||||
<attr name="user_color_pl_95" format="color" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<item name="dense_dropdown_text_input">@style/Widget.Vector.TextInputLayout.Dense.ExposedDropdownMenu.Dark.SC</item>
|
||||
<item name="message_highlight_bg_color">?vctr_header_background</item>
|
||||
<item name="code_block_bg_color">#19ffffff</item>
|
||||
<item name="quote_bar_color">?code_block_bg_color</item>
|
||||
<item name="user_color_pl_0">@color/user_color_element_pl_0</item>
|
||||
<item name="user_color_pl_1">@color/user_color_element_pl_1</item>
|
||||
<item name="user_color_pl_50">@color/user_color_element_pl_50</item>
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<item name="dense_dropdown_text_input">@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu</item>
|
||||
<item name="message_highlight_bg_color">?vctr_header_background</item>
|
||||
<item name="code_block_bg_color">#19000000</item>
|
||||
<item name="quote_bar_color">?code_block_bg_color</item>
|
||||
<item name="user_color_pl_0">@color/user_color_element_pl_0</item>
|
||||
<item name="user_color_pl_1">@color/user_color_element_pl_1</item>
|
||||
<item name="user_color_pl_50">@color/user_color_element_pl_50</item>
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
<item name="colorAccentPale">@color/accent_sc_pale</item>
|
||||
<item name="message_highlight_bg_color">@color/accent_sc_alpha25</item>
|
||||
<item name="code_block_bg_color">@color/code_background_sc</item>
|
||||
<item name="quote_bar_color">?vctr_content_quaternary</item>
|
||||
<item name="user_color_pl_0">@color/user_color_sc_pl_0</item>
|
||||
<item name="user_color_pl_1">@color/user_color_sc_pl_1</item>
|
||||
<item name="user_color_pl_50">@color/user_color_sc_pl_50</item>
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
<item name="colorAccentPale">@color/accent_sc_pale</item>
|
||||
<item name="message_highlight_bg_color">#ffe0e0e0</item>
|
||||
<item name="code_block_bg_color">@color/code_background_sc_light</item>
|
||||
<item name="quote_bar_color">?vctr_content_quaternary</item>
|
||||
<item name="user_color_pl_0">@color/user_color_sc_pl_0</item>
|
||||
<item name="user_color_pl_1">@color/user_color_sc_pl_1</item>
|
||||
<item name="user_color_pl_50">@color/user_color_sc_pl_50</item>
|
||||
|
|
|
@ -37,8 +37,11 @@ class EventHtmlRenderer @Inject constructor(private val htmlConfigure: MatrixHtm
|
|||
|
||||
private fun resolveCodeBlockBackground() =
|
||||
ThemeUtils.getColor(context, R.attr.code_block_bg_color)
|
||||
private fun resolveQuoteBarColor() =
|
||||
ThemeUtils.getColor(context, R.attr.quote_bar_color)
|
||||
|
||||
private var codeBlockBackground: Int = resolveCodeBlockBackground()
|
||||
private var quoteBarColor: Int = resolveQuoteBarColor()
|
||||
|
||||
interface PostProcessor {
|
||||
fun afterRender(renderedText: Spannable)
|
||||
|
@ -52,6 +55,7 @@ class EventHtmlRenderer @Inject constructor(private val htmlConfigure: MatrixHtm
|
|||
super.configureTheme(builder)
|
||||
builder.codeBlockBackgroundColor(codeBlockBackground)
|
||||
.codeBackgroundColor(codeBlockBackground)
|
||||
.blockQuoteColor(quoteBarColor)
|
||||
}
|
||||
}
|
||||
))
|
||||
|
@ -60,8 +64,17 @@ class EventHtmlRenderer @Inject constructor(private val htmlConfigure: MatrixHtm
|
|||
private var markwon: Markwon = buildMarkwon()
|
||||
get() {
|
||||
val newCodeBlockBackground = resolveCodeBlockBackground()
|
||||
val newQuoteBarColor = resolveQuoteBarColor()
|
||||
var changed = false
|
||||
if (codeBlockBackground != newCodeBlockBackground) {
|
||||
codeBlockBackground = newCodeBlockBackground
|
||||
changed = true
|
||||
}
|
||||
if (quoteBarColor != newQuoteBarColor) {
|
||||
quoteBarColor = newQuoteBarColor
|
||||
changed = true
|
||||
}
|
||||
if (changed) {
|
||||
field = buildMarkwon()
|
||||
}
|
||||
return field
|
||||
|
|
Loading…
Reference in New Issue