From f9a3c3d266bce2e59a29f62672c8b971cc726537 Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:49:20 +0800 Subject: [PATCH] Try to fix recyclerview disappearing after refresh (#61) * Try to fix recyclerview disappearing after refresh * Another attempt * Workaround: Use RefreshLayout's progress indicator --- .../main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.kt | 6 ++++-- .../java/com/hippo/ehviewer/ui/scene/GalleryListScene.kt | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.kt b/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.kt index 80291e3d2..134d164f0 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.kt @@ -346,7 +346,9 @@ class FavoritesScene : SearchBarScene() { is LoadState.Loading -> { showSearchBar() if (!binding.refreshLayout.isRefreshing) { - transition.showView(1) + // https://github.com/FooIbar/EhViewer/issues/45 + // transition.showView(1) + binding.refreshLayout.isRefreshing = true } } is LoadState.Error -> { @@ -361,11 +363,11 @@ class FavoritesScene : SearchBarScene() { binding.tip.text = empty transition.showView(2) } else { + transition.showView(0, false) if (vm.shouldScrollToTop) { vm.shouldScrollToTop = false binding.recyclerView.scrollToPosition(0) } - transition.showView(0) } } } diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.kt b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.kt index 4f4f06c58..8d22840dc 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.kt @@ -379,7 +379,9 @@ class GalleryListScene : SearchBarScene() { is LoadState.Loading -> { showSearchBar() if (!binding.refreshLayout.isRefreshing) { - transition.showView(1) + // https://github.com/FooIbar/EhViewer/issues/45 + // transition.showView(1) + binding.refreshLayout.isRefreshing = true } } is LoadState.Error -> { @@ -404,11 +406,11 @@ class GalleryListScene : SearchBarScene() { binding.tip.text = empty transition.showView(2) } else { + transition.showView(0, false) if (vm.shouldScrollToTop) { vm.shouldScrollToTop = false binding.recyclerView.scrollToPosition(0) } - transition.showView(0) } } }