From c1e7d74b966f2ac702926878027b4d36a32f9f5c Mon Sep 17 00:00:00 2001 From: tonymanou Date: Sun, 8 Jan 2017 16:17:01 +0100 Subject: [PATCH] Reapply filter when reloading app list --- .../main/java/com/topjohnwu/magisk/MagiskHideFragment.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskHideFragment.java b/app/src/main/java/com/topjohnwu/magisk/MagiskHideFragment.java index 70275a841..73bc54f27 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MagiskHideFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/MagiskHideFragment.java @@ -7,6 +7,7 @@ import android.support.annotation.Nullable; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.RecyclerView; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -43,6 +44,7 @@ public class MagiskHideFragment extends Fragment implements CallbackHandler.Even private ApplicationAdapter appAdapter; private SearchView.OnQueryTextListener searchListener; + private String lastFilter; @Nullable @Override @@ -64,12 +66,14 @@ public class MagiskHideFragment extends Fragment implements CallbackHandler.Even searchListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { + lastFilter = query; appAdapter.filter(query); return false; } @Override public boolean onQueryTextChange(String newText) { + lastFilter = newText; appAdapter.filter(newText); return false; } @@ -109,5 +113,8 @@ public class MagiskHideFragment extends Fragment implements CallbackHandler.Even appAdapter.setLists(result.listApps, result.hideList); recyclerView.setVisibility(View.VISIBLE); mSwipeRefreshLayout.setRefreshing(false); + if (!TextUtils.isEmpty(lastFilter)) { + appAdapter.filter(lastFilter); + } } }