aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHermes Junior <ohermesjunior@gmail.com>2020-05-11 01:39:35 +0000
committerOHermesJunior <ohermesjunior@gmail.com>2020-05-11 01:39:35 +0000
commitadf8fa4e6a859029ac2d17ee79296e2afcda5b7a (patch)
treeafba2f048d3b6a293fc4895199200c8f4a75c658 /app
parenta2dc0b1c0d51d74ca5c3c5942af2b113ebbd27be (diff)
downloadinfinity-for-reddit-adf8fa4e6a859029ac2d17ee79296e2afcda5b7a.tar
infinity-for-reddit-adf8fa4e6a859029ac2d17ee79296e2afcda5b7a.tar.gz
infinity-for-reddit-adf8fa4e6a859029ac2d17ee79296e2afcda5b7a.tar.bz2
infinity-for-reddit-adf8fa4e6a859029ac2d17ee79296e2afcda5b7a.tar.lz
infinity-for-reddit-adf8fa4e6a859029ac2d17ee79296e2afcda5b7a.tar.xz
infinity-for-reddit-adf8fa4e6a859029ac2d17ee79296e2afcda5b7a.tar.zst
infinity-for-reddit-adf8fa4e6a859029ac2d17ee79296e2afcda5b7a.zip
Improve some regex of link resolver.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java13
1 files changed, 3 insertions, 10 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 76ed0e1b..defe8e3a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
@@ -31,10 +31,9 @@ public class LinkResolverActivity extends AppCompatActivity {
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
private static final String POST_PATTERN = "/r/\\w+/comments/\\w+/{0,1}\\w+/{0,1}";
- private static final String COMMENT_PATTERN = "/(r|u|user)/\\w+/comments/\\w+/{0,1}\\w+/\\w+/{0,1}";
+ private static final String COMMENT_PATTERN = "/(r|u|U|user)/\\w+/comments/\\w+/{0,1}\\w+/\\w+/{0,1}";
private static final String SUBREDDIT_PATTERN = "/[rR]/\\w+/{0,1}";
- private static final String USER_PATTERN_1 = "/user/\\w+/{0,1}";
- private static final String USER_PATTERN_2 = "/[uU]/\\w+/{0,1}";
+ private static final String USER_PATTERN = "/([uU]|user)/\\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}";
@@ -123,13 +122,7 @@ public class LinkResolverActivity extends AppCompatActivity {
intent.putExtra(ViewSubredditDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
}
- } else if (path.matches(USER_PATTERN_1)) {
- Intent intent = new Intent(this, ViewUserDetailActivity.class);
- intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, segments.get(1));
- intent.putExtra(ViewUserDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
- intent.putExtra(ViewUserDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
- startActivity(intent);
- } else if (path.matches(USER_PATTERN_2)) {
+ } else if (path.matches(USER_PATTERN)) {
Intent intent = new Intent(this, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, segments.get(1));
intent.putExtra(ViewUserDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);