diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-11-21 16:13:00 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-11-21 16:13:00 +0000 |
commit | ae213259b3b0114d9298ba7623086fc6fb8e4adb (patch) | |
tree | c8744be3260272eb8027e7d89f6ab8555cf85c19 /app/src | |
parent | 2c194d51200737de81915b9ca1ef105aad001e52 (diff) | |
download | infinity-for-reddit-ae213259b3b0114d9298ba7623086fc6fb8e4adb.tar infinity-for-reddit-ae213259b3b0114d9298ba7623086fc6fb8e4adb.tar.gz infinity-for-reddit-ae213259b3b0114d9298ba7623086fc6fb8e4adb.tar.bz2 infinity-for-reddit-ae213259b3b0114d9298ba7623086fc6fb8e4adb.tar.lz infinity-for-reddit-ae213259b3b0114d9298ba7623086fc6fb8e4adb.tar.xz infinity-for-reddit-ae213259b3b0114d9298ba7623086fc6fb8e4adb.tar.zst infinity-for-reddit-ae213259b3b0114d9298ba7623086fc6fb8e4adb.zip |
Correctly handle r/popular and r/all links.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java | 19 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java | 10 |
2 files changed, 5 insertions, 24 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 a01a69ec..bac8f3da 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java @@ -139,20 +139,11 @@ public class LinkResolverActivity extends AppCompatActivity { deepLinkError(uri); } } else if (path.matches(SUBREDDIT_PATTERN)) { - String subredditName = path.substring(3); - if (subredditName.equals("popular") || subredditName.equals("all")) { - Intent intent = new Intent(this, MainActivity.class); - intent.putExtra(MainActivity.EXTRA_POST_TYPE, subredditName); - intent.putExtra(MainActivity.EXTRA_MESSSAGE_FULLNAME, messageFullname); - intent.putExtra(MainActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName); - startActivity(intent); - } else { - Intent intent = new Intent(this, ViewSubredditDetailActivity.class); - intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, path.substring(3)); - intent.putExtra(ViewSubredditDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname); - intent.putExtra(ViewSubredditDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName); - startActivity(intent); - } + Intent intent = new Intent(this, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, path.substring(3)); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName); + startActivity(intent); } else if (path.matches(USER_PATTERN)) { Intent intent = new Intent(this, ViewUserDetailActivity.class); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, segments.get(1)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index 15eb3be1..ed20aaf3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -112,7 +112,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, RandomBottomSheetFragment.RandomOptionSelectionCallback { - static final String EXTRA_POST_TYPE = "EPT"; static final String EXTRA_MESSSAGE_FULLNAME = "ENF"; static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; @@ -844,15 +843,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } }); - if (getIntent().hasExtra(EXTRA_POST_TYPE)) { - String type = getIntent().getStringExtra(EXTRA_POST_TYPE); - if (type != null && type.equals("popular")) { - viewPager2.setCurrentItem(1); - } else { - viewPager2.setCurrentItem(2); - } - } - loadUserData(); if (mAccessToken != null) { |