Package icyllis.modernui.markflow
Class Markflow.Builder
java.lang.Object
icyllis.modernui.markflow.Markflow.Builder
- Enclosing class:
Markflow
-
Method Summary
Modifier and TypeMethodDescriptionbufferType
(TextView.BufferType bufferType) Specify the buffer type when applying text to a TextView.build()
Build a Markflow instance.textSetter
(TextSetter textSetter) Specify a method to install a rendered Markdown to a TextView.usePlugin
(MarkflowPlugin plugin) Register a plugin.
-
Method Details
-
bufferType
Specify the buffer type when applying text to a TextView. The default isTextView.BufferType.SPANNABLE
.Note that if you insist on
TextView.BufferType.SPANNABLE
and your rendered Markdown text contains too many spans, consider setting a factory that returns aSpannableStringBuilder
via theTextView.setSpannableFactory(icyllis.modernui.text.Spannable.Factory)
It uses interval tree and hash table internally, making it much more efficient thanSpannableString
(default factory) when processing long and complex text. Although the text is editable, the TextView is not editable (bufferType is SPANNABLE).- Returns:
- this
-
textSetter
Specify a method to install a rendered Markdown to a TextView. By default,TextView.setText(CharSequence, TextView.BufferType)
is called directly.- Returns:
- this
-
usePlugin
Register a plugin.It's better to create a new Plugin object if it is mutable, depending on the implementation.
- Returns:
- this
-
build
Build a Markflow instance. This builder can be reused and the state will be preserved.- Throws:
IllegalStateException
- no plugins were added, or required plugins were not added, or there were circular dependencies.
-