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

Fix-280: Filter results and empty customers fixed in CustomersFragment #148

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 @@ -193,8 +195,7 @@ public void showMoreCustomers(List<Customer> customers) {
public void showEmptyCustomers(String message) {
showRecyclerView(false);
sweetUIErrorHandler.showSweetCustomErrorUI(getString(R.string.customer),
getString(Integer.parseInt(message)),
R.drawable.ic_customer_black_24dp, rvCustomers, layoutError);
message, R.drawable.ic_customer_black_24dp, rvCustomers, layoutError);
}

@Override
Expand Down Expand Up @@ -225,7 +226,12 @@ public void showMessage(String errorMessage) {

@Override
public void searchCustomerList(Customer customer) {
customerAdapter.setCustomers(Collections.singletonList(customer));
if (customer.getIdentifier() != null && !customer.getIdentifier().isEmpty()) {
customerAdapter.setCustomers(Collections.singletonList(customer));
} else {
customerAdapter.setCustomers(new ArrayList<Customer>());
showEmptyCustomers(getString(R.string.empty_customer_list));
}
}

@Override
Expand Down Expand Up @@ -299,6 +305,7 @@ public boolean onClose() {
rgSearch.clearCheck();
TransitionManager.beginDelayedTransition(coordinator);
llSearch.setVisibility(View.GONE);
sweetUIErrorHandler.hideSweetErrorLayoutUI(rvCustomers, layoutError);
return false;
}
});
Expand Down