aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-11-18 04:55:01 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-11-18 04:55:01 +0000
commit93067af4fe84edce9274579cc501dd0cb5837500 (patch)
tree205d235744537179b320f1d9b25f55cb457b78b5 /app/src/main
parent178f6927dbef5a8e69452d5e3a3422ed84c092d3 (diff)
downloadinfinity-for-reddit-93067af4fe84edce9274579cc501dd0cb5837500.tar
infinity-for-reddit-93067af4fe84edce9274579cc501dd0cb5837500.tar.gz
infinity-for-reddit-93067af4fe84edce9274579cc501dd0cb5837500.tar.bz2
infinity-for-reddit-93067af4fe84edce9274579cc501dd0cb5837500.tar.lz
infinity-for-reddit-93067af4fe84edce9274579cc501dd0cb5837500.tar.xz
infinity-for-reddit-93067af4fe84edce9274579cc501dd0cb5837500.tar.zst
infinity-for-reddit-93067af4fe84edce9274579cc501dd0cb5837500.zip
Continue implementing showing images from preview.redd.it in posts.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java6
1 files changed, 1 insertions, 5 deletions
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<String, Post.MediaMetadata> 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();
}
}