diff options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java | 12 |
1 files changed, 12 insertions, 0 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 cf28ff85..f9fa34f3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java @@ -92,6 +92,8 @@ public class SearchActivity extends BaseActivity { Toolbar toolbar; @BindView(R.id.search_edit_text_search_activity) EditText searchEditText; + @BindView(R.id.clear_search_edit_view_search_activity) + ImageView clearSearchTextImageView; @BindView(R.id.link_handler_image_view_search_activity) ImageView linkHandlerImageView; @BindView(R.id.subreddit_name_relative_layout_search_activity) @@ -154,6 +156,8 @@ public class SearchActivity extends BaseActivity { setSupportActionBar(toolbar); + clearSearchTextImageView.setVisibility(View.GONE); + searchOnlySubreddits = getIntent().getBooleanExtra(EXTRA_SEARCH_ONLY_SUBREDDITS, false); searchOnlyUsers = getIntent().getBooleanExtra(EXTRA_SEARCH_ONLY_USERS, false); @@ -236,6 +240,9 @@ public class SearchActivity extends BaseActivity { } }); + clearSearchTextImageView.setVisibility(View.VISIBLE); + } else { + clearSearchTextImageView.setVisibility(View.GONE); } } }); @@ -250,6 +257,10 @@ public class SearchActivity extends BaseActivity { return false; }); + clearSearchTextImageView.setOnClickListener(view -> { + searchEditText.getText().clear(); + }); + linkHandlerImageView.setOnClickListener(view -> { if (!searchEditText.getText().toString().equals("")) { Intent intent = new Intent(this, LinkResolverActivity.class); @@ -378,6 +389,7 @@ public class SearchActivity extends BaseActivity { int toolbarPrimaryTextAndIconColorColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor(); searchEditText.setTextColor(toolbarPrimaryTextAndIconColorColor); searchEditText.setHintTextColor(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor()); + clearSearchTextImageView.setColorFilter(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); linkHandlerImageView.setColorFilter(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); int colorAccent = mCustomThemeWrapper.getColorAccent(); searchInTextView.setTextColor(colorAccent); |