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

Fix-282: SearchBar collapse fixed in CustomersFragment #149

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
SearchView searchView;

public static CustomersFragment newInstance() {
CustomersFragment fragment = new CustomersFragment();
Expand Down Expand Up @@ -264,7 +267,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 Expand Up @@ -315,6 +318,16 @@ private void findCustomer(String query) {
}


@Override
public void onPause() {
super.onPause();
TransitionManager.beginDelayedTransition(coordinator);
llSearch.setVisibility(View.GONE);
sweetUIErrorHandler.hideSweetErrorLayoutUI(rvCustomers, layoutError);
searchView.onActionViewCollapsed();
rgSearch.clearCheck();
}

@Override
public void onItemClick(View childView, int position) {
detailsCustomerPosition = position;
Expand Down