From f186f4c6a667fe5bf36c84a446a0b7f19351bf85 Mon Sep 17 00:00:00 2001 From: Nishon Tandukar Date: Wed, 6 Nov 2019 10:20:30 +0545 Subject: [PATCH] Adds empty layout --- .../java/org/fieldsight/naxa/v3/forms/FormsStateFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FormsStateFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FormsStateFragment.java index f68738ee2..e59ef780b 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FormsStateFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FormsStateFragment.java @@ -49,6 +49,7 @@ public class FormsStateFragment extends Fragment { private RecyclerView recyclerView; private SwipeRefreshLayout swipeToRefresh; + private View emptyLayout; private BaseRecyclerViewAdapter adapter; private String submissionStatus; private String url = APIEndpoint.V3.GET_MY_FLAGGED_SUBMISSIONS; @@ -76,6 +77,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, private void bindUI(View view) { recyclerView = view.findViewById(R.id.recycler_view_list); swipeToRefresh = view.findViewById(R.id.swipe_container); + emptyLayout = view.findViewById(R.id.root_layout_empty_layout); } @Override @@ -107,11 +109,13 @@ public void onSubscribe(Disposable d) { public void onSuccess(List formStates) { updateList(formStates); swipeToRefresh.setRefreshing(false); + emptyLayout.setVisibility(formStates.isEmpty() ? View.VISIBLE : View.GONE); } @Override public void onError(Throwable e) { swipeToRefresh.setRefreshing(false); + emptyLayout.setVisibility(View.VISIBLE); } });