From 93067af4fe84edce9274579cc501dd0cb5837500 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Fri, 17 Nov 2023 23:55:01 -0500 Subject: Continue implementing showing images from preview.redd.it in posts. --- .../infinityforreddit/markdown/ImageAndGifBlockParser.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'app') 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 0da8a93e..01e0f9e7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java @@ -1,7 +1,5 @@ package ml.docilealligator.infinityforreddit.markdown; -import android.util.Log; - import org.commonmark.node.Block; import org.commonmark.parser.block.AbstractBlockParser; import org.commonmark.parser.block.AbstractBlockParserFactory; @@ -37,19 +35,17 @@ 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 Map mediaMetadataMap; - private int fromIndex = "![img](https://preview.redd.it/".length(); + private final int fromIndex = "![img](https://preview.redd.it/".length(); @Override public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) { String line = state.getLine().toString(); - Log.i("asdfa", "s " + line + "fuck"); Matcher matcher = redditPreviewPattern.matcher(line); if (matcher.find()) { if (matcher.end() == line.length()) { int endIndex = line.indexOf('.', fromIndex); if (endIndex > 0) { String id = line.substring(fromIndex, endIndex); - Log.i("asdfasdf", "s " + id); return mediaMetadataMap.containsKey(id) ? BlockStart.of(new ImageAndGifBlockParser(mediaMetadataMap.get(id))) : BlockStart.none(); } } -- cgit v1.2.3