Android-RTEditor
Android-RTEditor copied to clipboard
Request: add TextView helper class which is used to convert from the generated Html
If we wish to only view the content that was saved before on the RTEditText, into TextView, using the normal Html.fromHtml
isn't enough, as it doesn't handle lists well, and a lot more tags.
Please add an option to somehow view such content on TextView.
For now, the only workaround is to still use RTEditText, yet extend from it and have it disabled:
class ViewOnlyRtEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : RTEditText(context, attrs, defStyleAttr) {
init {
isEnabled = false
isFocusable = false
isFocusableInTouchMode = false
}
override fun onTouchEvent(event: MotionEvent?): Boolean = false
}
@AndroidDeveloperLB I am new to Kotlin. Would it be possible for you to provide a Java implementation of this if it's not too much trouble?
I have found a different workaround. Instead of extending from RTEditText, you can simply declare it in place of the TextView, set its android:editable="false" and use it as usual in the relevant view by called rtEditText.setRichTextEditing(true, value)
@Saunved I've moved forward to other things. To learn Kotlin, I usually just converted Java and looked at the result.
What the above means, is:
- First line is the various CTORs of the class.
- the "init" part is shared between them, so it will run no matter which CTOR is used.
- the "onTouchEvent" just returns false.
@AndroidDeveloperLB Thanks for the help :)