Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #471 from fieldsight/UI/add-empty-layout
Browse files Browse the repository at this point in the history
Adds empty layout
  • Loading branch information
yubarajpoudel authored Nov 6, 2019
2 parents 91f2140 + f186f4c commit 739a6e9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class FormsStateFragment extends Fragment {
private RecyclerView recyclerView;

private SwipeRefreshLayout swipeToRefresh;
private View emptyLayout;
private BaseRecyclerViewAdapter<FormState, FieldSightFormStateVH> adapter;
private String submissionStatus;
private String url = APIEndpoint.V3.GET_MY_FLAGGED_SUBMISSIONS;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -107,11 +109,13 @@ public void onSubscribe(Disposable d) {
public void onSuccess(List<FormState> 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);
}
});

Expand Down

0 comments on commit 739a6e9

Please sign in to comment.