Skip to content

Commit

Permalink
Merge branch 'master' into 2805-fragment-lifecycle-issue-illegalstate…
Browse files Browse the repository at this point in the history
…exception-in-baseresourcefragment
  • Loading branch information
dogi authored Dec 5, 2023
2 parents 0edfb9c + 65ae47b commit e493130
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ dependencies {
implementation 'com.github.kizitonwose:CalendarView:1.1.0'
implementation "io.noties.markwon:editor:4.6.2"
implementation "io.noties.markwon:image:4.6.2"
implementation "io.noties.markwon:html:4.6.2"
implementation 'com.caverock:androidsvg-aar:1.4'
implementation "androidx.core:core-ktx:1.12.0"
implementation "com.github.VaibhavLakhera:Circular-Progress-View:0.1.2"
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonPlugin;
import io.noties.markwon.html.HtmlPlugin;
import io.noties.markwon.image.ImagesPlugin;
import io.noties.markwon.image.file.FileSchemeHandler;
import io.noties.markwon.image.network.NetworkSchemeHandler;
import io.noties.markwon.image.network.OkHttpNetworkSchemeHandler;
import io.noties.markwon.movement.MovementMethodPlugin;
import io.realm.Realm;
import io.realm.RealmResults;
Expand All @@ -58,13 +61,17 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
id = getArguments().getString("courseId");
}
markwon = Markwon.builder(context)
.usePlugin(HtmlPlugin.create())
.usePlugin(ImagesPlugin.create())
.usePlugin(MovementMethodPlugin.none())
.usePlugin(new AbstractMarkwonPlugin() {
@Override
public void configure(@NonNull MarkwonPlugin.Registry registry) {
registry.require(ImagesPlugin.class, imagesPlugin ->
imagesPlugin.addSchemeHandler(FileSchemeHandler.create())
registry.require(ImagesPlugin.class, imagesPlugin -> {
imagesPlugin.addSchemeHandler(FileSchemeHandler.create());
imagesPlugin.addSchemeHandler(NetworkSchemeHandler.create());
imagesPlugin.addSchemeHandler(OkHttpNetworkSchemeHandler.create());
}
);
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonPlugin;
import io.noties.markwon.html.HtmlPlugin;
import io.noties.markwon.image.ImagesPlugin;
import io.noties.markwon.image.file.FileSchemeHandler;
import io.noties.markwon.image.network.NetworkSchemeHandler;
import io.noties.markwon.image.network.OkHttpNetworkSchemeHandler;
import io.noties.markwon.movement.MovementMethodPlugin;
import io.realm.Case;
import io.realm.Realm;
Expand Down Expand Up @@ -73,13 +76,17 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
}
setUserVisibleHint(false);
markwon = Markwon.builder(context)
.usePlugin(HtmlPlugin.create())
.usePlugin(ImagesPlugin.create())
.usePlugin(MovementMethodPlugin.none())
.usePlugin(new AbstractMarkwonPlugin() {
@Override
public void configure(@NonNull MarkwonPlugin.Registry registry) {
registry.require(ImagesPlugin.class, imagesPlugin ->
imagesPlugin.addSchemeHandler(FileSchemeHandler.create())
registry.require(ImagesPlugin.class, imagesPlugin -> {
imagesPlugin.addSchemeHandler(FileSchemeHandler.create());
imagesPlugin.addSchemeHandler(NetworkSchemeHandler.create());
imagesPlugin.addSchemeHandler(OkHttpNetworkSchemeHandler.create());
}
);
}
})
Expand Down Expand Up @@ -230,7 +237,7 @@ public static String prependBaseUrlToImages(String markdownContent, String baseU
String relativePath = matcher.group(1);
String modifiedPath = relativePath.replaceFirst("resources/", "");
String fullUrl = baseUrl + modifiedPath;
matcher.appendReplacement(result, "![](" + fullUrl + ")");
matcher.appendReplacement(result, "<img src=" + fullUrl + " width=600 height=350/>");
}
matcher.appendTail(result);

Expand Down

0 comments on commit e493130

Please sign in to comment.