From 7bf8c382e13682a74e6ba5ccbf59a548dbf80cef Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Tue, 11 Jun 2024 22:18:51 +0200 Subject: [PATCH] fix: Show/hide the list of lists appropriately when showing errors (#740) Previous code didn't hide the list-of-lists if an error occurred after the list was displayed (e.g., load the list, turn on airplane mode, reload the list). Hide the list when errors are shown, and show it when there is content. --- .../src/main/kotlin/app/pachli/feature/lists/ListsActivity.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/feature/lists/src/main/kotlin/app/pachli/feature/lists/ListsActivity.kt b/feature/lists/src/main/kotlin/app/pachli/feature/lists/ListsActivity.kt index 1ba51220d..cc5797642 100644 --- a/feature/lists/src/main/kotlin/app/pachli/feature/lists/ListsActivity.kt +++ b/feature/lists/src/main/kotlin/app/pachli/feature/lists/ListsActivity.kt @@ -222,6 +222,7 @@ class ListsActivity : BaseActivity(), MenuProvider { private fun bind(state: Result) { state.onFailure { + binding.listsRecycler.hide() binding.messageView.show() binding.swipeRefreshLayout.isRefreshing = false @@ -238,9 +239,11 @@ class ListsActivity : BaseActivity(), MenuProvider { adapter.submitList(lists.lists.sortedWith(compareByListTitle)) binding.swipeRefreshLayout.isRefreshing = false if (lists.lists.isEmpty()) { + binding.listsRecycler.hide() binding.messageView.show() binding.messageView.setup(BackgroundMessage.Empty()) } else { + binding.listsRecycler.show() binding.messageView.hide() } }