Commit e1110ec4 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Turn drawable property immutable on QuoteMarginSpan

parent 1e80d270
...@@ -127,7 +127,7 @@ class MessageParser @Inject constructor(val context: Application, private val co ...@@ -127,7 +127,7 @@ class MessageParser @Inject constructor(val context: Application, private val co
} }
class QuoteMarginSpan(quoteDrawable: Drawable, private var pad: Int) : LeadingMarginSpan, LineHeightSpan { class QuoteMarginSpan(quoteDrawable: Drawable, private var pad: Int) : LeadingMarginSpan, LineHeightSpan {
private var drawable: Drawable = quoteDrawable private val drawable: Drawable = quoteDrawable
override fun getLeadingMargin(first: Boolean): Int { override fun getLeadingMargin(first: Boolean): Int {
return drawable.intrinsicWidth + pad return drawable.intrinsicWidth + pad
...@@ -148,14 +148,14 @@ class MessageParser @Inject constructor(val context: Application, private val co ...@@ -148,14 +148,14 @@ class MessageParser @Inject constructor(val context: Application, private val co
} }
override fun chooseHeight(text: CharSequence, start: Int, end: Int, override fun chooseHeight(text: CharSequence, start: Int, end: Int,
istartv: Int, v: Int, spanstartv: Int, v: Int,
fm: Paint.FontMetricsInt) { fm: Paint.FontMetricsInt) {
if (end == (text as Spanned).getSpanEnd(this)) { if (end == (text as Spanned).getSpanEnd(this)) {
val ht = drawable.intrinsicHeight val ht = drawable.intrinsicHeight
var need = ht - (v + fm.descent - fm.ascent - istartv) var need = ht - (v + fm.descent - fm.ascent - spanstartv)
if (need > 0) if (need > 0)
fm.descent += need fm.descent += need
need = ht - (v + fm.bottom - fm.top - istartv) need = ht - (v + fm.bottom - fm.top - spanstartv)
if (need > 0) if (need > 0)
fm.bottom += need fm.bottom += need
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment