From 07bca6d6356ef51ce38a9190bf7be9d51bdd89f7 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 30 Mar 2020 14:54:55 +0800 Subject: Fix some issues of searching. --- .../ml/docilealligator/infinityforreddit/Activity/MainActivity.java | 1 - .../docilealligator/infinityforreddit/Activity/SearchActivity.java | 6 +++--- .../infinityforreddit/Activity/SearchResultActivity.java | 4 +++- .../infinityforreddit/Activity/ViewMultiRedditDetailActivity.java | 1 - .../infinityforreddit/Activity/ViewSubredditDetailActivity.java | 2 -- .../infinityforreddit/Activity/ViewUserDetailActivity.java | 1 - app/src/main/res/xml/advanced_preferences.xml | 2 +- 7 files changed, 7 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index 3cc64c30..0a768805 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -745,7 +745,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb return true; case R.id.action_search_main_activity: Intent intent = new Intent(this, SearchActivity.class); - intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false); startActivity(intent); return true; case R.id.action_refresh_main_activity: diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java index e075d9a5..0160401a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java @@ -171,9 +171,9 @@ public class SearchActivity extends BaseActivity { Intent intent = getIntent(); if (intent.hasExtra(EXTRA_SUBREDDIT_NAME)) { - subredditName = intent.getExtras().getString(EXTRA_SUBREDDIT_NAME); + subredditName = intent.getStringExtra(EXTRA_SUBREDDIT_NAME); subredditNameTextView.setText(subredditName); - subredditIsUser = intent.getExtras().getBoolean(EXTRA_SUBREDDIT_IS_USER); + subredditIsUser = intent.getBooleanExtra(EXTRA_SUBREDDIT_IS_USER, false); } } @@ -196,7 +196,7 @@ public class SearchActivity extends BaseActivity { simpleSearchView.setIconsColor(toolbarPrimaryTextAndIconColorColor); simpleSearchView.setTextColor(toolbarPrimaryTextAndIconColorColor); simpleSearchView.setBackIconColor(toolbarPrimaryTextAndIconColorColor); - simpleSearchView.setHintTextColor(mCustomThemeWrapper.getSecondaryTextColor()); + simpleSearchView.setHintTextColor(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor()); searchInTextView.setTextColor(mCustomThemeWrapper.getColorAccent()); subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java index 7c8f25a5..dc168e74 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java @@ -231,7 +231,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect return true; case R.id.action_search_search_result_activity: Intent intent = new Intent(this, SearchActivity.class); - intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false); + if (mSubredditName != null && !mSubredditName.equals("")) { + intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, mSubredditName); + } intent.putExtra(SearchActivity.EXTRA_QUERY, mQuery); finish(); startActivity(intent); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java index 0fb5b439..d6d32b67 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java @@ -215,7 +215,6 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT return true; case R.id.action_search_view_multi_reddit_detail_activity: Intent intent = new Intent(this, SearchActivity.class); - intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false); startActivity(intent); return true; case R.id.action_refresh_view_multi_reddit_detail_activity: diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 474a5912..4cd8035d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -662,8 +662,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp case R.id.action_search_view_subreddit_detail_activity: Intent intent = new Intent(this, SearchActivity.class); intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName); - intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_IS_USER, false); - intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false); startActivity(intent); return true; case R.id.action_refresh_view_subreddit_detail_activity: diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java index 96adba7b..c6bfec6a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java @@ -583,7 +583,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele Intent intent = new Intent(this, SearchActivity.class); intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, username); intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_IS_USER, true); - intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false); startActivity(intent); return true; case R.id.action_refresh_view_user_detail_activity: diff --git a/app/src/main/res/xml/advanced_preferences.xml b/app/src/main/res/xml/advanced_preferences.xml index e475af51..432623d3 100644 --- a/app/src/main/res/xml/advanced_preferences.xml +++ b/app/src/main/res/xml/advanced_preferences.xml @@ -28,7 +28,7 @@ \ No newline at end of file -- cgit v1.2.3