Ensure that search query is readable
This commit is contained in:
parent
2854346635
commit
959f29c8b8
|
@ -247,7 +247,12 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (!super.onOptionsItemSelected(item)) {
|
||||
if (item.getItemId() == R.id.action_search) {
|
||||
item.getActionView().post(() -> iconTintManager.updateTint());
|
||||
}
|
||||
if (super.onOptionsItemSelected(item)) {
|
||||
return true;
|
||||
} else {
|
||||
if (feed == null) {
|
||||
((MainActivity) getActivity()).showSnackbarAbovePlayer(
|
||||
R.string.please_wait_for_data, Toast.LENGTH_LONG);
|
||||
|
@ -298,8 +303,6 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
|||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(getActivity(), e.getMessage());
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.appcompat.widget.SearchView;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.fragment.SearchFragment;
|
||||
|
||||
/**
|
||||
|
@ -33,6 +34,7 @@ public class MenuItemUtils extends de.danoeh.antennapod.core.menuhandler.MenuIte
|
|||
public static void setupSearchItem(Menu menu, MainActivity activity, long feedId) {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
final SearchView sv = (SearchView) searchItem.getActionView();
|
||||
sv.setBackgroundColor(ThemeUtils.getColorFromAttr(activity, android.R.attr.windowBackground));
|
||||
sv.setQueryHint(activity.getString(R.string.search_label));
|
||||
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
@ -33,12 +35,20 @@ public abstract class ToolbarIconTintManager implements AppBarLayout.OnOffsetCha
|
|||
public void updateTint() {
|
||||
if (isTinted) {
|
||||
doTint(new ContextThemeWrapper(context, R.style.Theme_AntennaPod_Dark));
|
||||
toolbar.getNavigationIcon().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_ATOP);
|
||||
toolbar.getOverflowIcon().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_ATOP);
|
||||
safeSetColorFilter(toolbar.getNavigationIcon(), new PorterDuffColorFilter(0xffffffff, Mode.SRC_ATOP));
|
||||
safeSetColorFilter(toolbar.getOverflowIcon(), new PorterDuffColorFilter(0xffffffff, Mode.SRC_ATOP));
|
||||
safeSetColorFilter(toolbar.getCollapseIcon(), new PorterDuffColorFilter(0xffffffff, Mode.SRC_ATOP));
|
||||
} else {
|
||||
doTint(context);
|
||||
toolbar.getNavigationIcon().clearColorFilter();
|
||||
toolbar.getOverflowIcon().clearColorFilter();
|
||||
safeSetColorFilter(toolbar.getNavigationIcon(), null);
|
||||
safeSetColorFilter(toolbar.getOverflowIcon(), null);
|
||||
safeSetColorFilter(toolbar.getCollapseIcon(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void safeSetColorFilter(Drawable icon, PorterDuffColorFilter filter) {
|
||||
if (icon != null) {
|
||||
icon.setColorFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue