ExpandableTextView
ExpandableTextView copied to clipboard
Issue with SpannableString
Hello, I've tried using your library with the following:
When setting the text such as: binding.tvMessage.text = "Hello world" it does display the whole text but when using binding.tvMessage.text = SpannableString("Hello world") it only show the first letter then Show More button is displayed.
Note: This is reproductible with the sample app of the project.
binding.expandTvProg
.setAnimationDuration(500)
.setReadMoreText("View More")
.setReadLessText("View Less")
.setCollapsedLines(3)
.setIsExpanded(false)
.setIsUnderlined(true)
.setExpandType(EXPAND_TYPE_LAYOUT)
.setEllipsizedTextColor(ContextCompat.getColor(this, R.color.purple_200))
binding.expandTvProg.setText(SpannableString("Hello World"), TextView.BufferType.SPANNABLE)
I have found the fix for this and it is quite simple:
You have to replace the isAllTextVisible
private fun String.isAllTextVisible(): Boolean = this == text
to
private fun String.isAllTextVisible(): Boolean = this == text.toString()
Tell me what you think about it :)
Fixed on version 1.0.5