From d6c9450648af7f614d47587c140cb91a0e35c0a0 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Sat, 18 Nov 2023 23:30:10 -0500 Subject: Fix unable to submit gallery posts. --- .../infinityforreddit/activities/PostGalleryActivity.java | 3 +++ .../infinityforreddit/markdown/ImageAndGifBlockParser.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java index c18ba059..e66eb57f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java @@ -567,6 +567,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee promptAlertDialog(R.string.exit_when_submit, R.string.exit_when_submit_post_detail); return true; } else { + redditGalleryImageInfoList = adapter.getRedditGalleryImageInfoList(); if (!titleEditText.getText().toString().equals("") || redditGalleryImageInfoList != null) { promptAlertDialog(R.string.discard, R.string.discard_detail); return true; @@ -585,6 +586,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee return true; } + redditGalleryImageInfoList = adapter.getRedditGalleryImageInfoList(); if (redditGalleryImageInfoList == null || redditGalleryImageInfoList.isEmpty()) { Snackbar.make(coordinatorLayout, R.string.select_an_image, Snackbar.LENGTH_SHORT).show(); return true; @@ -635,6 +637,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee if (isPosting) { promptAlertDialog(R.string.exit_when_submit, R.string.exit_when_submit_post_detail); } else { + redditGalleryImageInfoList = adapter.getRedditGalleryImageInfoList(); if (!titleEditText.getText().toString().equals("") || redditGalleryImageInfoList != null) { promptAlertDialog(R.string.discard, R.string.discard_detail); } else { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java index 01e0f9e7..029a5b83 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java @@ -33,7 +33,7 @@ public class ImageAndGifBlockParser extends AbstractBlockParser { } public static class Factory extends AbstractBlockParserFactory { - private Pattern redditPreviewPattern = Pattern.compile("!\\[img]\\(https://preview.redd.it/\\w+.(jpg|png)((\\?+[-a-zA-Z0-9()@:%_+.~#?&/=]*)|)\\)"); + private final Pattern redditPreviewPattern = Pattern.compile("!\\[img]\\(https://preview.redd.it/\\w+.(jpg|png)((\\?+[-a-zA-Z0-9()@:%_+.~#?&/=]*)|)\\)"); private Map mediaMetadataMap; private final int fromIndex = "![img](https://preview.redd.it/".length(); -- cgit v1.2.3