From beb96fc6d893f38b4b219fb89b9cb6f48746c1bf Mon Sep 17 00:00:00 2001 From: PatelVatsalB21 Date: Wed, 17 Mar 2021 13:07:59 +0530 Subject: [PATCH] fix 279: Filter results retain in CustomersFragment --- .../customers/customerlist/CustomersFragment.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java b/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java index b4d80d1f..6d501ab4 100644 --- a/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java +++ b/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; + import androidx.annotation.Nullable; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.transition.TransitionManager; @@ -13,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.appcompat.widget.SearchView; + import android.text.TextUtils; import android.view.LayoutInflater; import android.view.Menu; @@ -96,6 +98,7 @@ public class CustomersFragment extends FineractBaseFragment implements Customers private Integer detailsCustomerPosition; private boolean isNewCustomer = false; private SweetUIErrorHandler sweetUIErrorHandler; + private SearchView searchView; public static CustomersFragment newInstance() { CustomersFragment fragment = new CustomersFragment(); @@ -143,8 +146,12 @@ public void onResume() { @Override public void onRefresh() { - customerPresenter.fetchCustomers(0, false); sweetUIErrorHandler.hideSweetErrorLayoutUI(rvCustomers, layoutError); + if (llSearch.getVisibility() == View.VISIBLE) { + findCustomer(searchView.getQuery().toString()); + } else { + customerPresenter.fetchCustomers(0, false); + } } @OnClick(R.id.btn_try_again) @@ -264,7 +271,7 @@ private void setUpSearchInterface(Menu menu) { SearchManager manager = (SearchManager) getActivity(). getSystemService(Context.SEARCH_SERVICE); - SearchView searchView = (SearchView) menu.findItem( + searchView = (SearchView) menu.findItem( R.id.menu_customer_search).getActionView(); searchView.setSearchableInfo(manager.getSearchableInfo(getActivity().getComponentName()));