Use EditText instead of SimpleSearchView in SearchActivity.

This commit is contained in:
Docile-Alligator 2022-06-01 15:41:01 +08:00
parent adb77f44d0
commit f0747c65cb
11 changed files with 64 additions and 93 deletions

View File

@ -164,9 +164,6 @@ dependencies {
// Loading ProgressBar // Loading ProgressBar
implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE' implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
// SearchView
implementation 'com.github.Ferfalk:SimpleSearchView:0.2.0'
// Customizable TextView // Customizable TextView
implementation 'com.libRG:customtextview:2.4' implementation 'com.libRG:customtextview:2.4'

View File

@ -539,7 +539,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT:
return R.drawable.ic_post_layout_24dp; return R.drawable.ic_post_layout_24dp;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SEARCH: case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SEARCH:
return R.drawable.ic_search_black_24dp; return R.drawable.ic_search_24dp;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT:
return R.drawable.ic_subreddit_24dp; return R.drawable.ic_subreddit_24dp;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_USER: case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_USER:
@ -639,7 +639,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
fab.setImageResource(R.drawable.ic_post_layout_24dp); fab.setImageResource(R.drawable.ic_post_layout_24dp);
break; break;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH:
fab.setImageResource(R.drawable.ic_search_black_24dp); fab.setImageResource(R.drawable.ic_search_24dp);
break; break;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
fab.setImageResource(R.drawable.ic_subreddit_24dp); fab.setImageResource(R.drawable.ic_subreddit_24dp);

View File

@ -4,12 +4,15 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
@ -20,9 +23,6 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.ferfalk.simplesearchview.SimpleOnQueryTextListener;
import com.ferfalk.simplesearchview.SimpleSearchView;
import com.ferfalk.simplesearchview.SimpleSearchViewListener;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.r0adkll.slidr.Slidr; import com.r0adkll.slidr.Slidr;
@ -86,8 +86,8 @@ public class SearchActivity extends BaseActivity {
AppBarLayout appBarLayout; AppBarLayout appBarLayout;
@BindView(R.id.toolbar) @BindView(R.id.toolbar)
Toolbar toolbar; Toolbar toolbar;
@BindView(R.id.search_view_search_activity) @BindView(R.id.search_edit_text_search_activity)
SimpleSearchView simpleSearchView; EditText searchEditText;
@BindView(R.id.subreddit_name_relative_layout_search_activity) @BindView(R.id.subreddit_name_relative_layout_search_activity)
RelativeLayout subredditNameRelativeLayout; RelativeLayout subredditNameRelativeLayout;
@BindView(R.id.search_in_text_view_search_activity) @BindView(R.id.search_in_text_view_search_activity)
@ -152,18 +152,11 @@ public class SearchActivity extends BaseActivity {
searchOnlyUsers = getIntent().getBooleanExtra(EXTRA_SEARCH_ONLY_USERS, false); searchOnlyUsers = getIntent().getBooleanExtra(EXTRA_SEARCH_ONLY_USERS, false);
if (searchOnlySubreddits) { if (searchOnlySubreddits) {
simpleSearchView.setHint(getText(R.string.search_only_subreddits_hint)); searchEditText.setHint(getText(R.string.search_only_subreddits_hint));
} else if (searchOnlyUsers) { } else if (searchOnlyUsers) {
simpleSearchView.setHint(getText(R.string.search_only_users_hint)); searchEditText.setHint(getText(R.string.search_only_users_hint));
} }
simpleSearchView.setOnSearchViewListener(new SimpleSearchViewListener() {
@Override
public void onSearchViewClosed() {
finish();
}
});
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
boolean nsfw = mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false); boolean nsfw = mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false);
@ -189,21 +182,26 @@ public class SearchActivity extends BaseActivity {
finish(); finish();
}); });
simpleSearchView.setOnQueryTextListener(new SimpleOnQueryTextListener() { searchEditText.addTextChangedListener(new TextWatcher() {
@Override @Override
public boolean onQueryTextSubmit(@NonNull String query) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
search(query);
return true;
} }
@Override @Override
public boolean onQueryTextChange(@NonNull String newText) { public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!newText.isEmpty()) {
}
@Override
public void afterTextChanged(Editable s) {
if (!s.toString().trim().isEmpty()) {
if (subredditAutocompleteCall != null) { if (subredditAutocompleteCall != null) {
subredditAutocompleteCall.cancel(); subredditAutocompleteCall.cancel();
} }
subredditAutocompleteCall = mOauthRetrofit.create(RedditAPI.class).subredditAutocomplete(APIUtils.getOAuthHeader(mAccessToken), subredditAutocompleteCall = mOauthRetrofit.create(RedditAPI.class).subredditAutocomplete(APIUtils.getOAuthHeader(mAccessToken),
newText, nsfw); s.toString(), nsfw);
subredditAutocompleteCall.enqueue(new Callback<String>() { subredditAutocompleteCall.enqueue(new Callback<String>() {
@Override @Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
@ -228,10 +226,18 @@ public class SearchActivity extends BaseActivity {
} }
}); });
}
}
});
searchEditText.setOnEditorActionListener((v, actionId, event) -> {
if ((actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_SEARCH) || (event.getKeyCode() == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN )) {
if (!searchEditText.getText().toString().isEmpty()) {
search(searchEditText.getText().toString());
return true; return true;
} }
return false;
} }
return false;
}); });
if (savedInstanceState != null) { if (savedInstanceState != null) {
@ -243,11 +249,10 @@ public class SearchActivity extends BaseActivity {
} else { } else {
subredditNameTextView.setText(subredditName); subredditNameTextView.setText(subredditName);
} }
bindView();
} else { } else {
query = getIntent().getStringExtra(EXTRA_QUERY); query = getIntent().getStringExtra(EXTRA_QUERY);
bindView();
} }
bindView();
if (searchOnlySubreddits || searchOnlyUsers) { if (searchOnlySubreddits || searchOnlyUsers) {
subredditNameRelativeLayout.setVisibility(View.GONE); subredditNameRelativeLayout.setVisibility(View.GONE);
@ -351,12 +356,9 @@ public class SearchActivity extends BaseActivity {
protected void applyCustomTheme() { protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar);
simpleSearchView.setSearchBackground(new ColorDrawable(mCustomThemeWrapper.getColorPrimary()));
int toolbarPrimaryTextAndIconColorColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor(); int toolbarPrimaryTextAndIconColorColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor();
simpleSearchView.setIconsColor(toolbarPrimaryTextAndIconColorColor); searchEditText.setTextColor(toolbarPrimaryTextAndIconColorColor);
simpleSearchView.setTextColor(toolbarPrimaryTextAndIconColorColor); searchEditText.setHintTextColor(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor());
simpleSearchView.setBackIconColor(toolbarPrimaryTextAndIconColorColor);
simpleSearchView.setHintTextColor(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor());
int colorAccent = mCustomThemeWrapper.getColorAccent(); int colorAccent = mCustomThemeWrapper.getColorAccent();
searchInTextView.setTextColor(colorAccent); searchInTextView.setTextColor(colorAccent);
subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
@ -369,11 +371,10 @@ public class SearchActivity extends BaseActivity {
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
simpleSearchView.showSearch(false); searchEditText.requestFocus();
simpleSearchView.requestFocus();
if (query != null) { if (query != null) {
simpleSearchView.setQuery(query, false); searchEditText.setText(query);
query = null; query = null;
} }
@ -388,16 +389,12 @@ public class SearchActivity extends BaseActivity {
super.onPause(); super.onPause();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) { if (imm != null) {
imm.hideSoftInputFromWindow(simpleSearchView.getWindowToken(), 0); imm.hideSoftInputFromWindow(searchEditText.getWindowToken(), 0);
} }
} }
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (data != null && simpleSearchView.onActivityResult(requestCode, resultCode, data)) {
return;
}
if (resultCode == RESULT_OK && data != null) { if (resultCode == RESULT_OK && data != null) {
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) { if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME); subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
@ -440,13 +437,6 @@ public class SearchActivity extends BaseActivity {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.search_activity, menu);
simpleSearchView.setMenuItem(menu.findItem(R.id.action_search_search_activity));
return true;
}
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) { if (item.getItemId() == android.R.id.home) {

View File

@ -286,7 +286,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
fab.setImageResource(R.drawable.ic_post_layout_24dp); fab.setImageResource(R.drawable.ic_post_layout_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
fab.setImageResource(R.drawable.ic_search_black_24dp); fab.setImageResource(R.drawable.ic_search_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
fab.setImageResource(R.drawable.ic_subreddit_24dp); fab.setImageResource(R.drawable.ic_subreddit_24dp);

View File

@ -299,7 +299,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
fab.setImageResource(R.drawable.ic_post_layout_24dp); fab.setImageResource(R.drawable.ic_post_layout_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
fab.setImageResource(R.drawable.ic_search_black_24dp); fab.setImageResource(R.drawable.ic_search_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
fab.setImageResource(R.drawable.ic_subreddit_24dp); fab.setImageResource(R.drawable.ic_subreddit_24dp);
@ -525,7 +525,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT:
return R.drawable.ic_post_layout_24dp; return R.drawable.ic_post_layout_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH:
return R.drawable.ic_search_black_24dp; return R.drawable.ic_search_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT:
return R.drawable.ic_subreddit_24dp; return R.drawable.ic_subreddit_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER:

View File

@ -743,7 +743,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT:
return R.drawable.ic_post_layout_24dp; return R.drawable.ic_post_layout_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH:
return R.drawable.ic_search_black_24dp; return R.drawable.ic_search_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT:
return R.drawable.ic_subreddit_24dp; return R.drawable.ic_subreddit_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER:
@ -853,7 +853,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
fab.setImageResource(R.drawable.ic_post_layout_24dp); fab.setImageResource(R.drawable.ic_post_layout_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
fab.setImageResource(R.drawable.ic_search_black_24dp); fab.setImageResource(R.drawable.ic_search_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
fab.setImageResource(R.drawable.ic_subreddit_24dp); fab.setImageResource(R.drawable.ic_subreddit_24dp);

View File

@ -813,7 +813,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
fab.setImageResource(R.drawable.ic_post_layout_24dp); fab.setImageResource(R.drawable.ic_post_layout_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
fab.setImageResource(R.drawable.ic_search_black_24dp); fab.setImageResource(R.drawable.ic_search_24dp);
break; break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
fab.setImageResource(R.drawable.ic_subreddit_24dp); fab.setImageResource(R.drawable.ic_subreddit_24dp);
@ -1029,7 +1029,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT:
return R.drawable.ic_post_layout_24dp; return R.drawable.ic_post_layout_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH:
return R.drawable.ic_search_black_24dp; return R.drawable.ic_search_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT:
return R.drawable.ic_subreddit_24dp; return R.drawable.ic_subreddit_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER: case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER:

View File

@ -114,7 +114,7 @@ public class WebViewActivity extends BaseActivity {
protected void applyCustomTheme() { protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar);
Drawable closeIcon = Utils.getTintedDrawable(this, R.drawable.ic_close_black_24dp, mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor()); Drawable closeIcon = Utils.getTintedDrawable(this, R.drawable.ic_close_24dp, mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor());
toolbar.setNavigationIcon(closeIcon); toolbar.setNavigationIcon(closeIcon);
} }

View File

@ -13,32 +13,28 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<FrameLayout <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_frame_layout_search_activity" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator">
<androidx.appcompat.widget.Toolbar <EditText
android:id="@+id/toolbar" android:id="@+id/search_edit_text_search_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<com.ferfalk.simplesearchview.SimpleSearchView
android:id="@+id/search_view_search_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:backIconAlpha="1" android:background="#00000000"
app:backIconTint="@android:color/white" android:gravity="top"
app:cursorColor="@android:color/white" android:hint="@string/search"
app:hintColor="#E0E0E0" android:maxLines="1"
app:iconsAlpha="1" android:textSize="?attr/font_20"
app:iconsTint="@android:color/white" android:fontFamily="?attr/font_family"
app:searchBackground="?attr/colorPrimary" android:inputType="textNoSuggestions"
app:voiceSearch="true" /> android:imeOptions="actionSearch" />
</FrameLayout> </androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>

View File

@ -113,7 +113,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:padding="8dp" android:padding="8dp"
android:src="@drawable/ic_close_black_24dp" android:src="@drawable/ic_close_24dp"
android:background="?actionBarItemBackground" android:background="?actionBarItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true" /> android:focusable="true" />

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:application="ml.docilealligator.infinityforreddit.activities.SearchResultActivity">
<item
android:id="@+id/action_search_search_activity"
android:orderInCategory="1"
android:title="@string/action_search"
android:icon="@drawable/ic_search_toolbar_24dp"
app:showAsAction="ifRoom" />
</menu>