aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-04-04 09:38:46 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-04-04 09:38:46 +0000
commit420e9518bc1e4bd8bc0b623425b04ed90c68eb91 (patch)
tree036a2063195fd70fef2b15a93a4b6b2315bf9bf4 /app
parentd6dd171ac43db9e3674149f75e05c35f52e18cb2 (diff)
downloadinfinity-for-reddit-420e9518bc1e4bd8bc0b623425b04ed90c68eb91.tar
infinity-for-reddit-420e9518bc1e4bd8bc0b623425b04ed90c68eb91.tar.gz
infinity-for-reddit-420e9518bc1e4bd8bc0b623425b04ed90c68eb91.tar.bz2
infinity-for-reddit-420e9518bc1e4bd8bc0b623425b04ed90c68eb91.tar.lz
infinity-for-reddit-420e9518bc1e4bd8bc0b623425b04ed90c68eb91.tar.xz
infinity-for-reddit-420e9518bc1e4bd8bc0b623425b04ed90c68eb91.tar.zst
infinity-for-reddit-420e9518bc1e4bd8bc0b623425b04ed90c68eb91.zip
Support redd.it links.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
index 2cd62f20..18799121 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
@@ -37,6 +37,7 @@ public class LinkResolverActivity extends AppCompatActivity {
private static final String USER_PATTERN_2 = "/[uU]/\\w+/{0,1}";
private static final String SIDEBAR_PATTERN = "/[rR]/\\w+/about/sidebar";
private static final String MULTIREDDIT_PATTERN = "/user/\\w+/m/\\w+/{0,1}";
+ private static final String REDD_IT_POST_PATTERN = "/\\w+/{0,1}";
@Inject
@Named("default")
@@ -130,7 +131,12 @@ public class LinkResolverActivity extends AppCompatActivity {
Intent intent = new Intent(this, ViewMultiRedditDetailActivity.class);
intent.putExtra(ViewMultiRedditDetailActivity.EXTRA_MULTIREDDIT_PATH, path);
startActivity(intent);
- } else {
+ } else if (path.matches(REDD_IT_POST_PATTERN)) {
+ Intent intent = new Intent(this, ViewPostDetailActivity.class);
+ intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, path.substring(1));
+ startActivity(intent);
+ }
+ else {
deepLinkError(uri);
}
}