Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
fix 279: Filter results retain in CustomersFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
PatelVatsalB21 committed Mar 17, 2021
1 parent 592099e commit beb96fc
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
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;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()));

Expand Down

0 comments on commit beb96fc

Please sign in to comment.