Skip to content

Commit

Permalink
fix: the last candidate font size is abnormal
Browse files Browse the repository at this point in the history
  • Loading branch information
nopdan committed May 10, 2024
1 parent ee4f035 commit e84a7ae
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
private val highlightTextColor: Int?,
private val highlightBackColor: Int?,
private val textColor: Int?,
private val textSize: Int,
) : ClickableSpan() {
override fun onClick(tv: View) {
textInputManager?.onCandidatePressed(index)
}

override fun updateDrawState(ds: TextPaint) {
ds.textSize = sp(textSize).toFloat()
ds.isUnderlineText = false
ds.typeface = typeface
if (index == highlightIndex) {
Expand Down Expand Up @@ -319,6 +321,7 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
highlightLabelColor,
highlightCandidateBackColor,
labelColor,
labelTextSize,
)
inSpans(alignmentSpan, labelSpan, labelTextSizeSpan) { append(label) }

Expand All @@ -329,6 +332,7 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
highlightCandidateTextColor,
highlightCandidateBackColor,
candidateTextColor,
candidateTextSize,
)
inSpans(alignmentSpan, candidateSpan, candidateTextSizeSpan) { append(text) }
currentLineLength += text.length
Expand All @@ -341,6 +345,7 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
highlightCommentTextColor,
highlightCandidateBackColor,
commentTextColor,
commentTextSize,
)
inSpans(alignmentSpan, commentSpan, commentTextSizeSpan) { append(comment) }
currentLineLength += comment.length
Expand Down

0 comments on commit e84a7ae

Please sign in to comment.