md支持图片

pull/457/head
gedoor 4 years ago
parent dfe1fb54ff
commit 5a6928407c
  1. 3
      app/build.gradle
  2. 9
      app/src/main/assets/help/help.md
  3. 12
      app/src/main/java/io/legado/app/ui/widget/dialog/TextDialog.kt

@ -197,7 +197,8 @@ dependencies {
implementation 'net.ricecode:string-similarity:1.0.0'
//MarkDown
implementation 'ru.noties.markwon:core:3.1.0'
implementation 'io.noties.markwon:core:4.6.0'
implementation 'io.noties.markwon:image-glide:4.6.0'
//
implementation 'com.hankcs:hanlp:portable-1.7.8'

File diff suppressed because one or more lines are too long

@ -8,10 +8,11 @@ import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.noties.markwon.Markwon
import io.noties.markwon.image.glide.GlideImagesPlugin
import kotlinx.android.synthetic.main.dialog_text_view.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import ru.noties.markwon.Markwon
class TextDialog : BaseDialogFragment() {
@ -63,11 +64,10 @@ class TextDialog : BaseDialogFragment() {
val content = it.getString("content") ?: ""
when (it.getInt("mode")) {
MD -> text_view.post {
Markwon.create(requireContext())
.setMarkdown(
text_view,
content
)
Markwon.builder(requireContext())
.usePlugin(GlideImagesPlugin.create(requireContext()))
.build()
.setMarkdown(text_view, content)
}
else -> text_view.text = content
}

Loading…
Cancel
Save