From d4fe5235e22a9a1150bbb9522e3d792ceab32c26 Mon Sep 17 00:00:00 2001 From: Balazs Toldi Date: Sun, 20 Aug 2023 10:33:10 +0200 Subject: [PATCH] Fix opening Image view activity from embedded images --- .../infinityforlemmy/activities/CommentActivity.java | 2 +- .../activities/FullMarkdownActivity.java | 2 +- .../activities/ViewSubredditDetailActivity.java | 2 +- .../activities/ViewUserDetailActivity.java | 2 +- .../infinityforlemmy/activities/WikiActivity.java | 2 +- .../adapters/CommentsListingRecyclerViewAdapter.java | 2 +- .../adapters/CommentsRecyclerViewAdapter.java | 2 +- .../adapters/PostDetailRecyclerViewAdapter.java | 2 +- .../adapters/RulesRecyclerViewAdapter.java | 2 +- .../infinityforlemmy/fragments/SidebarFragment.java | 2 +- .../toldi/infinityforlemmy/markdown/MarkdownUtils.java | 10 +++++----- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/CommentActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/CommentActivity.java index c2fd87cf..815531a0 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/CommentActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/CommentActivity.java @@ -204,7 +204,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA builder.linkColor(linkColor); } }; - Markwon postBodyMarkwon = MarkdownUtils.createFullRedditMarkwon(getApplication(), + Markwon postBodyMarkwon = MarkdownUtils.createFullRedditMarkwon(this, miscPlugin, parentTextColor, parentSpoilerBackgroundColor, null); MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(); binding.commentContentMarkdownView.setLayoutManager(new LinearLayoutManagerBugFixed(this)); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/FullMarkdownActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/FullMarkdownActivity.java index f9e11d0a..36790878 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/FullMarkdownActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/FullMarkdownActivity.java @@ -138,7 +138,7 @@ public class FullMarkdownActivity extends BaseActivity { builder.linkColor(linkColor); } }; - Markwon markwon = MarkdownUtils.createFullRedditMarkwon(getApplication(), + Markwon markwon = MarkdownUtils.createFullRedditMarkwon(this, miscPlugin, markdownColor, spoilerBackgroundColor, null); MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewSubredditDetailActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewSubredditDetailActivity.java index 8cd34a8c..eea0f5ec 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewSubredditDetailActivity.java @@ -538,7 +538,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp return true; }; - Markwon markwon = MarkdownUtils.createDescriptionMarkwon(getApplication(), miscPlugin, onLinkLongClickListener); + Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener); descriptionTextView.setOnLongClickListener(view -> { if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) { diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewUserDetailActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewUserDetailActivity.java index a5445082..241a6021 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/ViewUserDetailActivity.java @@ -472,7 +472,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele urlMenuBottomSheetFragment.show(getSupportFragmentManager(), null); return true; }; - Markwon markwon = MarkdownUtils.createDescriptionMarkwon(getApplication(), miscPlugin, onLinkLongClickListener); + Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener); descriptionTextView.setOnLongClickListener(view -> { if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) { diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/WikiActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/WikiActivity.java index 9fc3fb6b..f02b1bcf 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/WikiActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/WikiActivity.java @@ -175,7 +175,7 @@ public class WikiActivity extends BaseActivity { urlMenuBottomSheetFragment.show(getSupportFragmentManager(), null); return true; }; - markwon = MarkdownUtils.createFullRedditMarkwon(getApplication(), + markwon = MarkdownUtils.createFullRedditMarkwon(this, miscPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener); markwonAdapter = MarkdownUtils.createTablesAdapter(); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsListingRecyclerViewAdapter.java index a89fa72b..d3b1d996 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsListingRecyclerViewAdapter.java @@ -168,7 +168,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter { plugin.excludeInlineProcessor(HtmlInlineProcessor.class); })) @@ -59,7 +59,7 @@ public class MarkdownUtils { } @NonNull - public static Markwon createDescriptionMarkwon(Application context, MarkwonPlugin miscPlugin, + public static Markwon createDescriptionMarkwon(Activity context, MarkwonPlugin miscPlugin, BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener) { return Markwon.builder(context) .usePlugin(MarkwonInlineParserPlugin.create(plugin -> { @@ -73,7 +73,7 @@ public class MarkdownUtils { .setOnLinkLongClickListener(onLinkLongClickListener))) .usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS)) .usePlugin(TableEntryPlugin.create(context)) - .usePlugin(GlideImagesPlugin.create(context)) + .usePlugin(GlideImagesPlugin.create(context.getApplicationContext())) .usePlugin(new MarkwonLemmyLinkPlugin()) .build(); }