mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 11:26:01 +03:00
Passes text color instead of context
This commit is contained in:
parent
42e0d0f769
commit
86667a6d8a
1 changed files with 3 additions and 6 deletions
|
@ -16,29 +16,26 @@
|
||||||
|
|
||||||
package im.vector.riotx.features.html
|
package im.vector.riotx.features.html
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.text.TextPaint
|
import android.text.TextPaint
|
||||||
import android.text.style.ClickableSpan
|
import android.text.style.ClickableSpan
|
||||||
import android.view.View
|
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) {
|
override fun onClick(widget: View) {
|
||||||
isHidden = !isHidden
|
isHidden = !isHidden
|
||||||
widget.invalidate()
|
widget.invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
var isHidden = true
|
private var isHidden = true
|
||||||
|
|
||||||
override fun updateDrawState(tp: TextPaint) {
|
override fun updateDrawState(tp: TextPaint) {
|
||||||
tp.bgColor = bgColor
|
tp.bgColor = bgColor
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
tp.color = Color.TRANSPARENT
|
tp.color = Color.TRANSPARENT
|
||||||
} else {
|
} else {
|
||||||
tp.color = ThemeUtils.getColor(context, R.attr.riotx_text_primary)
|
tp.color = textColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue