diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-04-01 04:26:28 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-04-01 04:26:28 +0000 |
commit | 4ac1cec9e8a355127a2780c6edb1dd28da37d3a3 (patch) | |
tree | 59d1b9321a5cdca9ebb7f798268d81615920cb97 /app/src/main/java/ml/docilealligator | |
parent | 3c972ed07df11ca6c7f032728b9db8aa8cc22d28 (diff) | |
download | infinity-for-reddit-4ac1cec9e8a355127a2780c6edb1dd28da37d3a3.tar infinity-for-reddit-4ac1cec9e8a355127a2780c6edb1dd28da37d3a3.tar.gz infinity-for-reddit-4ac1cec9e8a355127a2780c6edb1dd28da37d3a3.tar.bz2 infinity-for-reddit-4ac1cec9e8a355127a2780c6edb1dd28da37d3a3.tar.lz infinity-for-reddit-4ac1cec9e8a355127a2780c6edb1dd28da37d3a3.tar.xz infinity-for-reddit-4ac1cec9e8a355127a2780c6edb1dd28da37d3a3.tar.zst infinity-for-reddit-4ac1cec9e8a355127a2780c6edb1dd28da37d3a3.zip |
Handle more post links.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java index a4de701f..10de74cc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java @@ -33,6 +33,7 @@ public class LinkResolverActivity extends AppCompatActivity { private static final String POST_PATTERN = "/r/[\\w-]+/comments/\\w+/?\\w+/?"; private static final String POST_PATTERN_2 = "/(u|U|user)/[\\w-]+/comments/\\w+/?\\w+/?"; + private static final String POST_PATTERN_3 = "/[\\w-]+$"; private static final String COMMENT_PATTERN = "/(r|u|U|user)/[\\w-]+/comments/\\w+/?[\\w-]+/\\w+/?"; private static final String SUBREDDIT_PATTERN = "/[rR]/[\\w-]+/?"; private static final String USER_PATTERN = "/(u|U|user)/[\\w-]+/?"; @@ -137,6 +138,12 @@ public class LinkResolverActivity extends AppCompatActivity { } else { deepLinkError(uri); } + } else if (path.matches(POST_PATTERN_3)) { + Intent intent = new Intent(this, ViewPostDetailActivity.class); + intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, path.substring(1)); + intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname); + intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName); + startActivity(intent); } else if (path.matches(COMMENT_PATTERN)) { int commentsIndex = segments.lastIndexOf("comments"); if (commentsIndex >= 0 && commentsIndex < segments.size() - 1) { |