From 56dd0a9acb6f5eeb18c337a83a1b49569071564e Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Fri, 24 Nov 2023 21:08:59 -0500 Subject: Fix markdown link not rendered in EmoteCloseBracketInlineProcessor. --- .../activities/AccountSavedThingActivity.java | 1 - .../markdown/EmoteCloseBracketInlineProcessor.java | 29 +++++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java index 5c99c275..76d8b4c6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java @@ -156,7 +156,6 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT private void initializeViewPager() { sectionsPagerAdapter = new SectionsPagerAdapter(this); binding.accountSavedThingViewPager2.setAdapter(sectionsPagerAdapter); - binding.accountSavedThingViewPager2.setOffscreenPageLimit(2); binding.accountSavedThingViewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); new TabLayoutMediator(binding.accountSavedThingTabLayout, binding.accountSavedThingViewPager2, (tab, position) -> { switch (position) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmoteCloseBracketInlineProcessor.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmoteCloseBracketInlineProcessor.java index c5c24b30..b24dc484 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmoteCloseBracketInlineProcessor.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmoteCloseBracketInlineProcessor.java @@ -101,21 +101,26 @@ public class EmoteCloseBracketInlineProcessor extends InlineProcessor { if (isLinkOrImage) { // If we got here, open is a potential opener - if (mediaMetadataMap == null) { - index = startIndex; - removeLastBracket(); + Node linkOrImage; + if (opener.image) { + if (mediaMetadataMap == null) { + index = startIndex; + removeLastBracket(); - return text("]"); - } - MediaMetadata mediaMetadata = mediaMetadataMap.get(dest); - if (mediaMetadata == null) { - index = startIndex; - removeLastBracket(); + return text("]"); + } + MediaMetadata mediaMetadata = mediaMetadataMap.get(dest); + if (mediaMetadata == null) { + index = startIndex; + removeLastBracket(); - return text("]"); - } + return text("]"); + } - Node linkOrImage = opener.image ? new Emote(mediaMetadata, title) : new Link(dest, title); + linkOrImage = new Emote(mediaMetadata, title); + } else { + linkOrImage = new Link(dest, title); + } Node node = opener.node.getNext(); while (node != null) { -- cgit v1.2.3