Fix #1034 Canvas: trying to draw too large (Huge images)

This commit is contained in:
Stefan Niedermann 2021-01-26 10:41:53 +01:00
parent 23b61c91a6
commit 7491d884fe
4 changed files with 5 additions and 3 deletions

View file

@ -4,7 +4,6 @@ buildscript {
repositories {
google()
jcenter()
}
dependencies {
apply plugin: 'maven'
@ -20,5 +19,6 @@ allprojects {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
}

View file

@ -0,0 +1 @@
- 🖼 Downscale and display huge images in preview mode instead of crash (#1034)

View file

@ -23,7 +23,7 @@ android {
}
ext {
markwonVersion = "4.6.1"
markwonVersion = "4.6.2-SNAPSHOT"
rxMarkdownVersion = "0.1.3"
}

View file

@ -23,6 +23,7 @@ import io.noties.markwon.SoftBreakAddsNewLinePlugin;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.ext.tables.TablePlugin;
import io.noties.markwon.ext.tasklist.TaskListPlugin;
import io.noties.markwon.image.DefaultDownScalingMediaDecoder;
import io.noties.markwon.image.ImagesPlugin;
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
import io.noties.markwon.linkify.LinkifyPlugin;
@ -84,7 +85,7 @@ public class MarkwonMarkdownViewer extends AppCompatTextView implements Markdown
.usePlugin(TaskListPlugin.create(context))
.usePlugin(LinkifyPlugin.create(true))
.usePlugin(LinkClickInterceptorPlugin.create())
.usePlugin(ImagesPlugin.create())
.usePlugin(ImagesPlugin.create(plugin -> plugin.defaultMediaDecoder(DefaultDownScalingMediaDecoder.create(context.getResources().getDisplayMetrics().widthPixels, 0))))
.usePlugin(SoftBreakAddsNewLinePlugin.create())
.usePlugin(SyntaxHighlightPlugin.create(prism4j, prism4jTheme))
.usePlugin(new ToggleableTaskListPlugin((toggledCheckboxPosition, newCheckedState) -> {