summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2026-04-13 07:52:20 +0200
committercyberta <cyberta@riseup.net>2026-04-15 23:56:05 +0000
commitd09f3be086473e38100277dc575c7d1d7567e41b (patch)
treecc4fb2b933389f88efcc92aadeff9dd67046c198
parentd33310afc0dfa85a95419babc2f0f6c852074b70 (diff)
tweak search view layout
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java10
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java14
2 files changed, 23 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java
index 06349cf2..e8eff9e7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java
@@ -216,6 +216,10 @@ public class ExcludeAppsFragment extends Fragment implements SimpleCheckBox.OnCh
inflater.inflate(R.menu.allowed_apps, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.app_search_widget).getActionView();
if (searchView != null) {
+ searchView.setOnSearchClickListener(v -> {
+ ViewHelper.showCustomActionBar(ExcludeAppsFragment.this, false);
+ });
+
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
@@ -235,6 +239,7 @@ public class ExcludeAppsFragment extends Fragment implements SimpleCheckBox.OnCh
});
searchView.setOnCloseListener(() -> {
mListAdapter.getFilter().filter("");
+ ViewHelper.showCustomActionBar(this, true);
return false;
});
@@ -250,8 +255,10 @@ public class ExcludeAppsFragment extends Fragment implements SimpleCheckBox.OnCh
tintSearchViewChild((ViewGroup) v);
}
if (v instanceof ImageView) {
- ((ImageView) v).setColorFilter(getResources().getColor(R.color.colorActionBarTitleFont),
+ ((ImageView) v).setColorFilter(ContextCompat.getColor(view.getContext(), R.color.colorActionBarTitleFont),
android.graphics.PorterDuff.Mode.SRC_IN);
+ } else if (v instanceof TextView) {
+ ((TextView) v).setTextColor(ContextCompat.getColor(view.getContext(), R.color.colorActionBarTitleFont));
}
}
}
@@ -269,6 +276,7 @@ public class ExcludeAppsFragment extends Fragment implements SimpleCheckBox.OnCh
mRecyclerView.setAdapter(mListAdapter);
ViewHelper.setActionBarSubtitle(this, exclude_apps_fragment_title);
+ ViewHelper.showCustomActionBar(this, true);
new Thread(() -> mListAdapter.populateList(getActivity())).start();
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java
index 3d4fb7ce..5e2f7680 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java
@@ -57,6 +57,20 @@ public class ViewHelper {
/**
* Sets the subtitle of an activities action bar. The activity needs to be an AppCompatActivity.
* @param fragment
+ */
+ public static void showCustomActionBar(Fragment fragment, Boolean isVisible) {
+ AppCompatActivity appCompatActivity = (AppCompatActivity) fragment.getActivity();
+ if (appCompatActivity != null) {
+ ActionBar actionBar = appCompatActivity.getSupportActionBar();
+ if (actionBar != null) {
+ actionBar.getCustomView().setVisibility(isVisible ? VISIBLE : GONE);
+ }
+ }
+ }
+
+ /**
+ * Sets the subtitle of an activities action bar. The activity needs to be an AppCompatActivity.
+ * @param fragment
* @param stringId
*/
public static void setActionBarSubtitle(Fragment fragment, @StringRes int stringId) {