From ae213259b3b0114d9298ba7623086fc6fb8e4adb Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sun, 22 Nov 2020 00:13:00 +0800 Subject: Correctly handle r/popular and r/all links. --- .../activities/LinkResolverActivity.java | 19 +++++-------------- .../infinityforreddit/activities/MainActivity.java | 10 ---------- 2 files changed, 5 insertions(+), 24 deletions(-) (limited to 'app/src/main/java') 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) { -- cgit v1.2.3