diff options
2 files changed, 20 insertions, 30 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java index df680b01..d88c75ce 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java @@ -309,6 +309,14 @@ public class SearchActivity extends BaseActivity { setSearchInThingText(); } else { query = getIntent().getStringExtra(EXTRA_QUERY); + searchInSubredditOrUserName = getIntent().getStringExtra(EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME); + searchInMultiReddit = getIntent().getParcelableExtra(EXTRA_SEARCH_IN_MULTIREDDIT); + searchInThingType = getIntent().getIntExtra(EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT); + if (searchInSubredditOrUserName != null) { + binding.subredditNameTextViewSearchActivity.setText(searchInSubredditOrUserName); + } else if (searchInMultiReddit != null) { + binding.subredditNameTextViewSearchActivity.setText(searchInMultiReddit.getDisplayName()); + } } bindView(); @@ -339,16 +347,6 @@ public class SearchActivity extends BaseActivity { requestThingSelectionForCurrentActivityLauncher.launch(intent); }); } - - Intent intent = getIntent(); - searchInSubredditOrUserName = intent.getStringExtra(EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME); - searchInMultiReddit = intent.getParcelableExtra(EXTRA_SEARCH_IN_MULTIREDDIT); - searchInThingType = intent.getIntExtra(EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT); - if (searchInSubredditOrUserName != null) { - binding.subredditNameTextViewSearchActivity.setText(searchInSubredditOrUserName); - } else if (searchInMultiReddit != null) { - binding.subredditNameTextViewSearchActivity.setText(searchInMultiReddit.getDisplayName()); - } } private void bindView() { @@ -450,11 +448,9 @@ public class SearchActivity extends BaseActivity { } else { Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class); intent.putExtra(SearchResultActivity.EXTRA_QUERY, query); - if (searchInSubredditOrUserName != null) { - intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, searchInSubredditOrUserName); - intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_MULTIREDDIT, searchInMultiReddit); - intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_THING_TYPE, searchInThingType); - } + intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, searchInSubredditOrUserName); + intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_MULTIREDDIT, searchInMultiReddit); + intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_THING_TYPE, searchInThingType); startActivity(intent); finish(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java index c9eb510f..059bea5a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -345,11 +345,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect } case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: { Intent intent = new Intent(this, SearchActivity.class); - if (mSearchInSubredditOrUserName != null && !mSearchInSubredditOrUserName.equals("")) { - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName); - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_MULTIREDDIT, mSearchInMultiReddit); - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType); - } + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName); + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_MULTIREDDIT, mSearchInMultiReddit); + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType); startActivity(intent); break; } @@ -435,11 +433,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect return true; } else if (itemId == R.id.action_search_search_result_activity) { Intent intent = new Intent(this, SearchActivity.class); - if (mSearchInSubredditOrUserName != null && !mSearchInSubredditOrUserName.equals("")) { - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName); - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_MULTIREDDIT, mSearchInMultiReddit); - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType); - } + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName); + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_MULTIREDDIT, mSearchInMultiReddit); + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType); intent.putExtra(SearchActivity.EXTRA_QUERY, mQuery); finish(); startActivity(intent); @@ -549,11 +545,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect break; case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH: Intent intent = new Intent(this, SearchActivity.class); - if (mSearchInSubredditOrUserName != null && !mSearchInSubredditOrUserName.equals("")) { - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName); - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_MULTIREDDIT, mSearchInMultiReddit); - intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType); - } + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName); + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_MULTIREDDIT, mSearchInMultiReddit); + intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType); startActivity(intent); break; case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: { |