From e039b08e42d55681af9262989349096ef6ae3488 Mon Sep 17 00:00:00 2001 From: robustTechie Date: Sat, 25 Apr 2020 12:44:38 +0530 Subject: [PATCH] Fix: Delete elements from document list in identifier --- .../online/documentlist/DocumentListFragment.java | 9 +++++++++ .../online/documentlist/DocumentListPresenter.java | 7 +------ .../mifosxdroid/online/DocumentListPresenterTest.java | 3 +-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.java b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.java index 1d5a71a431b..54728f1ad46 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.java +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.java @@ -223,6 +223,15 @@ public void onRequestPermissionsResult(int requestCode, public void showDocumentList(final List documents) { mDocumentList = documents; mDocumentListAdapter.setDocuments(mDocumentList); + mDocumentListAdapter.notifyDataSetChanged(); + + if (documents.isEmpty()) { + showEmptyDocuments(); + } else { + if (ll_error.getVisibility() == View.VISIBLE) { + ll_error.setVisibility(View.GONE); + } + } } @Override diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListPresenter.java b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListPresenter.java index f6c0d991212..fc7a6682280 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListPresenter.java +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListPresenter.java @@ -62,12 +62,7 @@ public void onError(Throwable e) { @Override public void onNext(List documents) { getMvpView().showProgressbar(false); - if (!documents.isEmpty()) { - getMvpView().showDocumentList(documents); - } else { - getMvpView().showEmptyDocuments(); - } - + getMvpView().showDocumentList(documents); } })); } diff --git a/mifosng-android/src/test/java/com/mifos/mifosxdroid/online/DocumentListPresenterTest.java b/mifosng-android/src/test/java/com/mifos/mifosxdroid/online/DocumentListPresenterTest.java index a038a36ab22..c7de5bb21c2 100644 --- a/mifosng-android/src/test/java/com/mifos/mifosxdroid/online/DocumentListPresenterTest.java +++ b/mifosng-android/src/test/java/com/mifos/mifosxdroid/online/DocumentListPresenterTest.java @@ -77,8 +77,7 @@ public void testLoadDocumentEmptyList() { stubDataManagerGetDocuments(Observable.just(emptyDocuments)); mDocumentListPresenter.loadDocumentList(entityType, entityId); - - verify(mDocumentListMvpView).showEmptyDocuments(); + verify(mDocumentListMvpView, never()).showDocumentList(documentList); verify(mDocumentListMvpView, never()).showFetchingError(R.string.failed_to_fetch_documents); }